Wait with Interpolation Overrides

Sequences of linear and circular interpolation commands can also be executed using Wait(WaitCondition *pWaitCondition) functions. The timing at which to override the previous interpolation command and execute the next interpolation command can be set using trigger motion.

The Linear Interpolation Override Type should be set to the default value of FastBlending, as it typically has the smoothest and fastest transition segment.

As explained in Interpolation Overrides, interpolations cannot be overridden again during the transition segment. The MotionStartedOverrideReady wait condition type will wait until the trigger motion has executed and the transition segment has finished. At this timing, the next trigger motion function can be called.

Wait with Interpolation Override Example

The following code executes a simple sequence of interpolation commands using trigger motion functions and Wait(WaitCondition *pWaitCondition) functions.

Motion::LinearIntplCommand lin;
Trigger trig;
Motion::WaitCondition wait;

//Set interpolation command parameters
lin.axisCount = 2;
lin.axis[0] = 0;
lin.axis[1] = 1;

lin.profile.type = ProfileType::Trapezoidal;
lin.profile.velocity = 10000;
lin.profile.acc = 10000;
lin.profile.dec = 10000;

//Set trigger parameters (trigger at 2000 remaining distance)
trig.triggerAxis = 0;
trig.triggerType = TriggerType::RemainingDistance;
trig.triggerValue = 2000;

//Set wait condition parameters
wait.waitConditionType = Motion::WaitConditionType::MotionStartedOverrideReady;
wait.axisCount = 1;
wait.axis[0] = 0;

//Execute linear interpolation to position (10000, 0)
lin.target[0] = 10000;
lin.target[1] = 0;
wmxlib_CoreMotion->motion->StartLinearIntplPos(&lin);

//Execute trigger linear interpolation to position (10000, 10000)
lin.target[0] = 10000;
lin.target[1] = 10000;
wmxlib_CoreMotion->motion->StartLinearIntplPos(&lin, &trig);

//Wait until trigger motion executes
wmxlib_CoreMotion->motion->Wait(&wait);

//Execute trigger linear interpolation to position (0, 10000)
lin.target[0] = 0;
lin.target[1] = 10000;
wmxlib_CoreMotion->motion->StartLinearIntplPos(&lin, &trig);

//Wait until trigger motion executes
wmxlib_CoreMotion->motion->Wait(&wait);

//Execute trigger linear interpolation to position (0, 0)
lin.target[0] = 0;
lin.target[1] = 0;
wmxlib_CoreMotion->motion->StartLinearIntplPos(&lin, &trig);

The following plots show the position, velocity, and acceleration when the above code is executed.

../_images/WMXDOC_FUNC_WAIT_INTERPOLATION_OVERRIDE_image0.png