Interpolation Without Stopping

Using the default settings, path interpolation with rotation will stop the motion along the path after executing each segment. This prevents sudden changes in the velocities of the linear and rotational axes that may occur at these points, and also allows angle correction motion to adjust the rotational axis to the starting angle of the next segment if necessary.

Path interpolation with rotation may operate without stopping after executing each segment. This may reduce the time required to traverse the path. To configure path interpolation with rotation to not stop the motion along the path after each segment, the following options should be set.

  1. Auto smoothing (enableAutoSmooth) should be enabled. This option will automatically replace parts of linear segments with circular segments to eliminate corners in the path. At the interface between two consecutive linear interpolations, a length of each of the two linear segments equal to the specified smoothing radius (autoSmoothRadius) will be replaced by a circular segment.

  2. Angle correction minimum angle (angleCorrectionMinimumAngle) should be increased from its default value of 0 to a small angle such as 0.01 degrees. If the angle at the interface between two segments along the path is greater than or equal to this value, the motion will momentarily stop at that interface. With the default value of 0 degrees, the motion will stop after every segment. By setting this parameter to a small but nonzero value, the motion will not stop at the points where circular segments have been inserted by auto smoothing. This is because the circular segments are inserted in such a way that the interface between it and the linear segments before and after it make 0 degree angles.

  3. Either:

    a. Set constant profile (enableConstProfile) to enabled. This option will use the same profile (the profile specified for the first segment) when executing consecutive segments without stops. If this option is set to the default value of 0, each segment will be executed using the profile defined for that segment.

    b. Set the end velocity of the profile of each segment equal to the velocity. This allows the next segment to continue executing without dropping to zero velocity.

Path interpolation with rotation can also be executed without stopping after each segment even if auto smoothing is disabled. In this case, the angle correction minimum angle should be set to a value higher than the largest change in angle between two segments. The rotational axis will suddenly turn by this angle, so this option should not be taken unless the largest change in angle between two segments is relatively small.

Interpolation Without Stopping Example

The following sample code executes a simple path with options configured as described above. A different smoothing radius is specified for each linear segment.

//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;

//Enable auto smoothing
conf.enableAutoSmooth = 1;

//Do not stop the motion along the path at very small angles between two segments
conf.angleCorrectionMinimumAngle = 0.01;

//Enable constant profile
conf.enableConstProfile = 1;

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

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

path.numPoints = 4;

//Only specify the profile for the first point as constant profile is enabled
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].type = AdvMotion::PathIntplSegmentType::Linear;
path.point[0].target[0] = 1000;
path.point[0].target[1] = 0;
path.point[0].autoSmoothRadius = 300; //Auto smoothing radius after first segment

path.point[1].type = AdvMotion::PathIntplSegmentType::Linear;
path.point[1].target[0] = 1000;
path.point[1].target[1] = 1000;
path.point[1].autoSmoothRadius = 200; //Auto smoothing radius after second segment

path.point[2].type = AdvMotion::PathIntplSegmentType::Linear;
path.point[2].target[0] = 0;
path.point[2].target[1] = 1000;
path.point[2].autoSmoothRadius = 100; //Auto smoothing radius after third segment

path.point[3].type = AdvMotion::PathIntplSegmentType::Linear;
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);

//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_image5.png

Interpolation with Stopping Example

Depending on the path and parameters, the X, Y, and rotational axes may suddenly accelerate or decelerate when not stopping after each segment.

The following code executes the same path, but stopping after each segment (including circular segments appended by auto smoothing).

//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;

//Enable auto smoothing
conf.enableAutoSmooth = 1;

//Do not stop the motion along the path at very small angles between two segments
conf.angleCorrectionMinimumAngle = 0.01;

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[0].autoSmoothRadius = 300; //Auto smoothing radius after first segment

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[1].autoSmoothRadius = 200; //Auto smoothing radius after second segment

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[2].autoSmoothRadius = 100; //Auto smoothing radius after third segment

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);

//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_image6.png