Overview
Path interpolation with look ahead is a more advanced version of path interpolation with the following features:
Velocity limits and acceleration limits can be specified for each interpolating axis. The interpolation velocity and acceleration during each path segment will be adjusted so that the path completes in the shortest time possible while not exceeding any of the axis limits.
Up to six axes may be incorporated into the path.
Four types of two-dimensional circular interpolations, one type of three-dimensional circular interpolations, and up to six-dimensional linear interpolations can be appended to the path.
Automatic smoothing can append circular interpolations in three dimensional space. Angle tolerances can be set for automatic smoothing to only apply smoothing for sharp angles.
The buffer memory size for path interpolation with look ahead can be set by the user. A large buffer may be specified to look ahead a longer distance when calculating the velocities and accelerations of each path segment.
Additional points may be dynamically appended to the path as it executes. This allows a path of indefinite length to be executed.
To execute path interpolation with look ahead, four functions must be called:
CreatePathIntplLookaheadBuffer
This function creates the buffer memory space that will be used to store path interpolation commands. This function only needs to be called once (per path interpolation with look ahead execution channel) after starting the engine. This function may fail if contiguous memory of the specified size could not be obtained from the system. For deterministic behavior, this function should be called during the initialization of the user application, and not immediately before using the path interpolation with look ahead execution channel. For additional information, see Function Calls Related to Memory Allocation.
SetPathIntplLookaheadConfiguration
This function configures the options for path interpolation with look ahead. This function must be called to at least set the velocity and acceleration along the path.
-
This function adds interpolation commands to the path interpolation. This function can be called before or after starting the execution of path interpolation with look ahead.
-
This function starts the execution of path interpolation with look ahead. If there are no interpolation commands in the path interpolation with look ahead buffer, execution will automatically begin the next time more interpolation commands are added.
Path Interpolation with Look Ahead Example
The following sample code executes path interpolation with look ahead with four linear interpolations, with all options disabled.
//Create the path interpolation with look ahead buffer
wmxlib_AdvancedMotion->advMotion->CreatePathIntplLookaheadBuffer(0, 1000);
//Configure the path interpolation with look ahead channel
AdvMotion::PathIntplLookaheadConfiguration conf;
conf.axisCount = 2;
conf.axis[0] = 0;
conf.axis[1] = 1;
conf.compositeVel = 1000;
conf.compositeAcc = 2000;
wmxlib_AdvancedMotion->advMotion->SetPathIntplLookaheadConfiguration(0, &conf);
//Add the path interpolation with look ahead commands
AdvMotion::PathIntplLookaheadCommand path;
path.numPoints = 4;
path.point[0].type = AdvMotion::PathIntplLookaheadSegmentType::Linear;
path.point[0].data.linear.axisCount = 2;
path.point[0].data.linear.axis[0] = 0;
path.point[0].data.linear.axis[1] = 1;
path.point[0].data.linear.target[0] = 1000;
path.point[0].data.linear.target[1] = 0;
path.point[1].type = AdvMotion::PathIntplLookaheadSegmentType::Linear;
path.point[1].data.linear.axisCount = 2;
path.point[1].data.linear.axis[0] = 0;
path.point[1].data.linear.axis[1] = 1;
path.point[1].data.linear.target[0] = 1000;
path.point[1].data.linear.target[1] = 1000;
path.point[2].type = AdvMotion::PathIntplLookaheadSegmentType::Linear;
path.point[2].data.linear.axisCount = 2;
path.point[2].data.linear.axis[0] = 0;
path.point[2].data.linear.axis[1] = 1;
path.point[2].data.linear.target[0] = 0;
path.point[2].data.linear.target[1] = 1000;
path.point[3].type = AdvMotion::PathIntplLookaheadSegmentType::Linear;
path.point[3].data.linear.axisCount = 2;
path.point[3].data.linear.axis[0] = 0;
path.point[3].data.linear.axis[1] = 1;
path.point[3].data.linear.target[0] = 0;
path.point[3].data.linear.target[1] = 0;
wmxlib_AdvancedMotion->advMotion->AddPathIntplLookaheadCommand(0, &path);
//Execute path interpolation with look ahead
wmxlib_AdvancedMotion->advMotion->StartPathIntplLookahead(0);
//Wait for the path interpolation with look ahead to complete
AdvMotion::PathIntplLookaheadStatus pathStatus;
wmxlib_AdvancedMotion->advMotion->GetPathIntplLookaheadStatus(0, &pathStatus);
while(pathStatus.remainCommandCount > 0) {
Sleep(10);
wmxlib_AdvancedMotion->advMotion->GetPathIntplLookaheadStatus(0, &pathStatus);
}
//Move the axes to Idle state
wmxlib_AdvancedMotion->advMotion->StopPathIntplLookahead(0);
//Wait until the path interpolation with look ahead is in Stopped state
wmxlib_AdvancedMotion->advMotion->GetPathIntplLookaheadStatus(0, &pathStatus);
while(pathStatus.state != AdvMotion::PathIntplLookaheadState::Stopped) {
Sleep(10);
wmxlib_AdvancedMotion->advMotion->GetPathIntplLookaheadStatus(0, &pathStatus);
}
//Free the path interpolation with look ahead buffer (normally, the buffer should only be freed at the end of the application)
wmxlib_AdvancedMotion->advMotion->FreePathIntplLookaheadBuffer(0);
The following plots show the two-dimensional trajectory and the velocity of each axis when the above sequence is executed from position (0, 0).
