Interpolation with XY Rotational Motion

To rotate the X and Y axes around the center of rotation as the rotational axis moves, disableXYRotationalMotion should be set to 0 (the default state).

The following sample code is the same as the sample code in Interpolation without XY Rotational Motion, except disableXYRotationalMotion is not changed from the default value.

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

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

../_images/WMXDOC_FUNC_PTR_image4.png

When the X and Y axes are rotated around the center of rotation with the movement of the rotational axis, the sequence is executed as follows.

  1. The X and Y axes move along the first linear segment.

  2. The rotational axis rotates to point in the direction of the second linear segment. The X and Y axes are rotated around the center of rotation by the same amount (90 degrees), and follows a curve from position (1000, 0) to (0, 0).

  3. The X and Y axes move along the second linear segment. (This segment has been rotated 90 degrees with the rotation of the rotational axis.)

  4. The rotational axis rotates to point in the direction of the third linear segment. The X and Y axes are rotated around the center of rotation by the same amount (90 degrees), and follows an identical curve from position (1000, 0) to (0, 0).

  5. The X and Y axes move along the third linear segment. (This segment has been rotated 90+90 degrees with the rotation of the rotational axis.)

  6. The rotational axis rotates to point in the direction of the fourth linear segment. The X and Y axes are rotated around the center of rotation by the same amount (90 degrees), and follows an identical curve from position (1000, 0) to (0, 0).

  7. The X and Y axes move along the fourth linear segment. (This segment has been rotated 90+90+90 degrees with the rotation of the rotational axis.)