Move to Specific Path Position

Several overloaded StartPathIntplWithRotation functions have target point or target position arguments that allow motion to a specific position along the path.

If the axes are moved off of the path using another motion function, the StartPathIntplWithRotation function will return the PathInterpolationAxesHaveBeenMoved error. If this occurs, the path must be cleared (with the ClearPathIntplWithRotation function) and then redefined.

Angle correction motion is also executed while traversing the path in the reverse direction.

The following sample code executes a path partway, pauses, executes the remainder of the path, pauses, and finally backtracks along the path to the starting position.

//Create the path interpolation with rotation buffer
wmxlib_AdvancedMotion->advMotion->CreatePathIntplWithRotationBuffer(0, 1000);

//Configure the path interpolation with rotation channel
AdvMotion::PathIntplWithRotationConfiguration conf;

conf.axis[0] = 0; //X axis
conf.axis[1] = 1; //Y axis
conf.rotationalAxis = 2; //Rotational axis
conf.centerOfRotation[0] = 500; //X axis center of rotation position
conf.centerOfRotation[1] = 500; //Y axis center of rotation position

//Rotational axis angle correction motion profile parameters
conf.angleCorrectionProfile.type = ProfileType::Trapezoidal;
conf.angleCorrectionProfile.velocity = 90;
conf.angleCorrectionProfile.acc = 180;
conf.angleCorrectionProfile.dec = 180;

wmxlib_AdvancedMotion->advMotion->SetPathIntplWithRotationConfiguration(0, &conf);

//Add the path interpolation with rotation commands
AdvMotion::PathIntplWithRotationCommand path;

path.numPoints = 4;

path.point[0].type = AdvMotion::PathIntplSegmentType::Linear;
path.point[0].profile.type = ProfileType::Trapezoidal;
path.point[0].profile.velocity = 1000;
path.point[0].profile.acc = 2000;
path.point[0].profile.dec = 2000;
path.point[0].target[0] = 1000;
path.point[0].target[1] = 0;

path.point[1].type = AdvMotion::PathIntplSegmentType::Linear;
path.point[1].profile.type = ProfileType::Trapezoidal;
path.point[1].profile.velocity = 1000;
path.point[1].profile.acc = 2000;
path.point[1].profile.dec = 2000;
path.point[1].target[0] = 1000;
path.point[1].target[1] = 1000;

path.point[2].type = AdvMotion::PathIntplSegmentType::Linear;
path.point[2].profile.type = ProfileType::Trapezoidal;
path.point[2].profile.velocity = 1000;
path.point[2].profile.acc = 2000;
path.point[2].profile.dec = 2000;
path.point[2].target[0] = 0;
path.point[2].target[1] = 1000;

path.point[3].type = AdvMotion::PathIntplSegmentType::Linear;
path.point[3].profile.type = ProfileType::Trapezoidal;
path.point[3].profile.velocity = 1000;
path.point[3].profile.acc = 2000;
path.point[3].profile.dec = 2000;
path.point[3].target[0] = 0;
path.point[3].target[1] = 0;

wmxlib_AdvancedMotion->advMotion->AddPathIntplWithRotationCommand(0, &path);

//Execute path interpolation with rotation
wmxlib_AdvancedMotion->advMotion->StartPathIntplWithRotation(0, (unsigned int)2); //Move to point 2
wmxlib_CoreMotion->motion->Wait(0); //Wait for axis 0 to finish motion
Sleep(200); //Sleep for 200ms after motion finishes
wmxlib_AdvancedMotion->advMotion->StartPathIntplWithRotation(0); //Move to end of path
wmxlib_CoreMotion->motion->Wait(0); //Wait for axis 0 to finish motion
Sleep(200); //Sleep for 200ms after motion finishes
wmxlib_AdvancedMotion->advMotion->StartPathIntplWithRotation(0, (unsigned int)0); //Move to point 0 (start of path)

//Wait until the path interpolation with rotation is in Idle state
AdvMotion::PathIntplWithRotationStatus pathStatus;
wmxlib_AdvancedMotion->advMotion->GetPathIntplWithRotationStatus(0, &pathStatus);
while(pathStatus.state != AdvMotion::PathIntplWithRotationState::Idle) {
    Sleep(10);
    wmxlib_AdvancedMotion->advMotion->GetPathIntplWithRotationStatus(0, &pathStatus);
}

//Free the path interpolation with rotation buffer (normally, the buffer should only be freed at the end of the application)
wmxlib_AdvancedMotion->advMotion->FreePathIntplWithRotationBuffer(0);

The following plots show the two-dimensional trajectory of the X and Y axes, the positions of the X, Y, and rotational axes vs. time, and the velocities of the X, Y, and rotational axes vs. time. Both the case when the XY rotational motion is enabled and disabled (conf.disableXYRotationalMotion = 1; is added to the code) are plotted.

../_images/WMXDOC_FUNC_PTR_image15.png