Overview
Wait functions in the CoreMotion module will stop the execution of the calling thread until the wait condition is satisfied.
The following are the available overloaded Wait functions.
Wait(AxisSelection *pAxisSelection, unsigned int waitTimeMilliseconds)
Wait(WaitCondition *pWaitCondition, unsigned int waitTimeMilliseconds)
Wait Example
The following code executes a simple sequence of motion commands with Wait functions in between them.
Motion::PosCommand pos;
//Set position command parameters
pos.axis = 0;
pos.profile.type = ProfileType::Trapezoidal;
pos.profile.velocity = 10000;
pos.profile.acc = 10000;
pos.profile.dec = 10000;
//Execute motion to move axis forward 10000
pos.target = 10000;
wmxlib_CoreMotion->motion->StartMov(&pos);
//Wait until motion is finished
wmxlib_CoreMotion->motion->Wait(0);
//Execute motion to move axis backward 10000
pos.target = -10000;
wmxlib_CoreMotion->motion->StartMov(&pos);
//Wait until motion is finished
wmxlib_CoreMotion->motion->Wait(0);
//Execute motion to move axis forward 10000
pos.target = 10000;
wmxlib_CoreMotion->motion->StartMov(&pos);
The following plots show the position, velocity, and acceleration when the above code is executed.

Interpolation Sequence Example
Wait functions can also be used to sequentially execute a series of interpolation command API functions. The axis parameter of the Wait function can be set to either interpolating axis.
The following code executes a simple sequence of interpolation commands with Wait functions in between them.
Motion::LinearIntplCommand lin;
//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;
//Execute interpolation to position (10000, -10000)
lin.target[0] = 10000;
lin.target[1] = -10000;
wmxlib_CoreMotion->motion->StartLinearIntplPos(&lin);
//Wait until motion is finished
wmxlib_CoreMotion->motion->Wait(0);
//Execute interpolation to position (0, 0)
lin.target[0] = 0;
lin.target[1] = 0;
wmxlib_CoreMotion->motion->StartLinearIntplPos(&lin);
//Wait until motion is finished
wmxlib_CoreMotion->motion->Wait(0);
//Execute interpolation to position (10000, -10000)
lin.target[0] = 10000;
lin.target[1] = -10000;
wmxlib_CoreMotion->motion->StartLinearIntplPos(&lin);
The following plots show the position, velocity, and acceleration when the above code is executed.
