Long Path Interpolations

Path interpolations with many segments can be executed by allocating a large buffer with the CreatePathIntplBuffer function, and then specifying additional segments with the optional arguments of the path interpolation function.

Long Path Interpolation Example

The following code executes a long path interpolation consisting of 5120 linear segments.

If the path interpolation buffers for the commanded axes have already been created after starting the engine (the buffers are automatically created when the StartPathIntplPos, StartPathIntplMov, StartPathIntpl3DPos, or StartPathIntpl3DMov function is called), the path interpolation buffers must first be freed with FreePathIntplBuffer before executing this code.

//Main path interpolation command for setting the interpolation parameters and the first maxPathInterpolateAppendPoints segments
AdvMotion::PathIntplCommand path;

//Additional path interpolation commands for setting the additional segments
AdvMotion::PathIntplAdditionalCommand addlPath[9];

path.axis[0] = 0;
path.axis[1] = 1;

//Use single motion profile for entire path
path.enableConstProfile = 1;
path.profile[0].type = ProfileType::Trapezoidal;
path.profile[0].velocity = 10000;
path.profile[0].acc = 20000;
path.profile[0].dec = 20000;

//Define segments
path.numPoints = wmx3Api::constants::maxPathInterpolateAppendPoints;
for (int i = 0; i < wmx3Api::constants::maxPathInterpolateAppendPoints; i++) {
    path.type[i] = AdvMotion::PathIntplSegmentType::Linear;
    path.target[0][i] = i+1;
    path.target[1][i] = 2*i;
}

for (int k = 0; k < 9; k++) {
    addlPath[k].numPoints = wmx3Api::constants::maxPathInterpolateAppendPoints;
    for (int i = 0; i < wmx3Api::constants::maxPathInterpolateAppendPoints; i++) {
        addlPath[k].type[i] = AdvMotion::PathIntplSegmentType::Linear;
        addlPath[k].target[0][i] = i+1+(k+1)*wmx3Api::constants::maxPathInterpolateAppendPoints;
        addlPath[k].target[1][i] = k%2 ? 2*i : 2*(wmx3Api::constants::maxPathInterpolateAppendPoints-1-i);
    }
}

//Create buffer
wmxlib_AdvancedMotion->advMotion->CreatePathIntplBuffer(0, 10*wmx3Api::constants::maxPathInterpolateAppendPoints);

wmxlib_AdvancedMotion->advMotion->StartPathIntplPos(&path, 9, addlPath);

The following plots show the positions and velocities when the above code is executed.

../_images/WMXDOC_FUNC_PTH_image24.png