Trigger Conditions for Output Commands
By default, the type parameter of an output command is set to Immediate. This type will immediately set the output.
Other possible type parameters include the following:
All output commands are evaluated during the execution of the next non-output command (interpolation command or sleep command) in the path. When the non-output command finishes, if the trigger condition has not been satisfied yet, the output is set.Distance-based trigger conditions will trigger based on the remaining or completed distance of the linear or circular interpolation command.
If a distance-based trigger condition is specified for a sleep command, the output will either be set immediately (e.g. if the trigger condition is a positive remaining distance) or at the end of the sleep command (e.g. if the trigger condition is a positive completed distance).
Distance-based trigger conditions are not affected by the subdivision of linear or circular interpolation commands by the sampleDistance parameter.
Stopping execution with the StopPathIntplLookahead function and then resuming execution will not affect the position where the distance-based trigger condition triggers.
Time-based trigger conditions will trigger based on the times calculated by the look ahead parameters. Time-based trigger conditions will be affected by look ahead parameters such as compositeVel, compositeAcc, velocityLimit, and accLimit.
Time-based trigger conditions are compatible with sleep commands. Time-based trigger conditions can set the output at the specified timing during a sleep command.
Smoothing circular interpolations that are inserted when the smoothRadius is nonzero are considered to be part of the preceding linear interpolation. This will affect the distance and time triggers of the two linear interpolations that are smoothed, as shown in the following figure.

Output Trigger Condition Example
The following code will set the output bit when the linear interpolation moves 2000 units.
//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 = 2;
path.point[0].type = AdvMotion::PathIntplLookaheadSegmentType::SetOutputBit;
path.point[0].data.setOutputBit.value = 1;
path.point[0].data.setOutputBit.byteAddress = 0;
path.point[0].data.setOutputBit.bitAddress = 0;
path.point[0].data.setOutputBit.triggerValue = 2000;
path.point[0].data.setOutputBit.type = AdvMotion::PathIntplOutputType::CompletedDist;
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] = 4000;
path.point[1].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);
Multiple Output Commands
Multiple output commands can be added to trigger multiple outputs during the execution of one interpolation or sleep command. For example, the following code will set the output bit when the linear interpolation moves 2000 units and 3000 units.
//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 = 3;
path.point[0].type = AdvMotion::PathIntplLookaheadSegmentType::SetOutputBit;
path.point[0].data.setOutputBit.value = 1;
path.point[0].data.setOutputBit.byteAddress = 0;
path.point[0].data.setOutputBit.bitAddress = 0;
path.point[0].data.setOutputBit.triggerValue = 2000;
path.point[0].data.setOutputBit.type = AdvMotion::PathIntplOutputType::CompletedDist;
path.point[1].type = AdvMotion::PathIntplLookaheadSegmentType::SetOutputBit;
path.point[1].data.setOutputBit.value = 1;
path.point[1].data.setOutputBit.byteAddress = 0;
path.point[1].data.setOutputBit.bitAddress = 1;
path.point[1].data.setOutputBit.triggerValue = 3000;
path.point[1].data.setOutputBit.type = AdvMotion::PathIntplOutputType::CompletedDist;
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] = 4000;
path.point[2].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);
Order of Evaluation
When adding multiple output commands before an interpolation or sleep command, the outputs will only trigger in the order that they are added. For example, the following code will set both output bits when the linear interpolation moves 3000 units, because the second output command cannot trigger until the first output command triggers.
//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 = 3;
path.point[0].type = AdvMotion::PathIntplLookaheadSegmentType::SetOutputBit;
path.point[0].data.setOutputBit.value = 1;
path.point[0].data.setOutputBit.byteAddress = 0;
path.point[0].data.setOutputBit.bitAddress = 0;
path.point[0].data.setOutputBit.triggerValue = 3000;
path.point[0].data.setOutputBit.type = AdvMotion::PathIntplOutputType::CompletedDist;
path.point[1].type = AdvMotion::PathIntplLookaheadSegmentType::SetOutputBit;
path.point[1].data.setOutputBit.value = 1;
path.point[1].data.setOutputBit.byteAddress = 0;
path.point[1].data.setOutputBit.bitAddress = 1;
path.point[1].data.setOutputBit.triggerValue = 2000;
path.point[1].data.setOutputBit.type = AdvMotion::PathIntplOutputType::CompletedDist;
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] = 4000;
path.point[2].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);
Command Finishes Before Trigger Condition
If the interpolation or sleep command finishes before the trigger condition is satisfied, then the output will be set when the interpolation or sleep command finishes. For example, the following code will set the output bit when the linear interpolation finishes (moves 4000 units), even though the trigger condition will never be satisfied.
//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 = 2;
path.point[0].type = AdvMotion::PathIntplLookaheadSegmentType::SetOutputBit;
path.point[0].data.setOutputBit.value = 1;
path.point[0].data.setOutputBit.byteAddress = 0;
path.point[0].data.setOutputBit.bitAddress = 0;
path.point[0].data.setOutputBit.triggerValue = 5000;
path.point[0].data.setOutputBit.type = AdvMotion::PathIntplOutputType::CompletedDist;
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] = 4000;
path.point[1].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);