Axis Velocity and Acceleration Limits
In the examples of Overview, Sample Distance, and Smooth Radius, the velocity and acceleration along the path was set, but the velocity and acceleration of each individual axis was not explicitly set. If the smoothRadius is small, the commanded axes will suddenly accelerate or decelerate at the corners.
No Velocity or Acceleration Limit Example
The following sample code sets the smoothRadius to just 50.
//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;
conf.sampleDistance = 100;
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[0].data.linear.smoothRadius = 50;
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[1].data.linear.smoothRadius = 50;
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[2].data.linear.smoothRadius = 50;
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 and acceleration of each axis when the above sequence is executed from position (0, 0).

There is a large spike in the accelerations of each axis at the corners.
Acceleration Limit Example
To limit the accelerations of each axis but otherwise execute the path as fast as possible, the accLimit parameter for each axis can be set.
The following sample code sets the acceleration limits of each axis at 5000 user units per second^2.
//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;
conf.sampleDistance = 100;
conf.accLimit[0] = 5000;
conf.accLimit[1] = 5000;
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[0].data.linear.smoothRadius = 50;
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[1].data.linear.smoothRadius = 50;
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[2].data.linear.smoothRadius = 50;
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 and acceleration of each axis when the above sequence is executed from position (0, 0).

The acceleration of each axis is limited to approximately below 5000 user units per second squared. If the sampleDistance is increased, the profile will be generated with a more precise acceleration limit.
Velocity Limit Example
Similar to the accLimit, the velocityLimit can be set to limit the velocity of the axis to be below a certain value.
The following sample code sets the acceleration limits of each axis at 5000 user units per second^2, the velocity limit of axis 0 at 700 user units per second, and the velocity limit of axis 1 at 500 user units per second.
//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;
conf.sampleDistance = 100;
conf.accLimit[0] = 5000;
conf.accLimit[1] = 5000;
conf.velocityLimit[0] = 700;
conf.velocityLimit[1] = 500;
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[0].data.linear.smoothRadius = 50;
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[1].data.linear.smoothRadius = 50;
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[2].data.linear.smoothRadius = 50;
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 and acceleration of each axis when the above sequence is executed from position (0, 0).

As seen above, the acceleration limit can be specified together with the velocity limit, or either could be specified without the other. The acceleration and velocity limits can be specified for any or all of the interpolating axes. For example, it is possible to set only the acceleration limit for axis 0 and only the velocity limit for axis 1. To not set an acceleration limit or velocity limit for an axis, set accLimit or velocityLimit to 0.