3D Path Interpolation

Path interpolation for three dimensions can be executed using the PathIntpl3DCommand class and the StartPathIntpl3DPos or StartPathIntpl3DMov function. Path interpolation for three dimensions has the same specifications as path interpolation for two dimensions except for the following differences:

  • Circular segments are specified by an intermediate target position (circleIntermediateTarget) instead of the center point and direction.

3D Path Interpolation Example

The following code executes an example 3D path interpolation.

AdvMotion::PathIntpl3DCommand path;

path.axis[0] = 0;
path.axis[1] = 1;
path.axis[2] = 2;

//Use single motion profile for entire path
path.enableConstProfile = 1;
path.profile[0].type = ProfileType::Trapezoidal;
path.profile[0].velocity = 50000;
path.profile[0].acc = 50000;
path.profile[0].dec = 50000;

//Define linear and circular segments
path.numPoints = 21;

path.type[0] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][0] = 9000;
path.target[1][0] = 0;
path.target[2][0] = 0;

path.type[1] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][1] = 10000;
path.target[1][1] = 1000;
path.target[2][1] = 0;
path.circleIntermediateTarget[0][1] = 9707.1;
path.circleIntermediateTarget[1][1] = 1000-707.1;
path.circleIntermediateTarget[2][1] = 0;

path.type[2] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][2] = 10000;
path.target[1][2] = 9000;
path.target[2][2] = 0;

path.type[3] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][3] = 9000;
path.target[1][3] = 10000;
path.target[2][3] = 0;
path.circleIntermediateTarget[0][3] = 9707.1;
path.circleIntermediateTarget[1][3] = 9707.1;
path.circleIntermediateTarget[2][3] = 0;

path.type[4] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][4] = 1000;
path.target[1][4] = 10000;
path.target[2][4] = 0;

path.type[5] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][5] = 0;
path.target[1][5] = 9000;
path.target[2][5] = 0;
path.circleIntermediateTarget[0][5] = 1000-707.1;
path.circleIntermediateTarget[1][5] = 9707.1;
path.circleIntermediateTarget[2][5] = 0;

path.type[6] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][6] = 0;
path.target[1][6] = 0;
path.target[2][6] = 0;

path.type[7] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][7] = 9000;
path.target[1][7] = 0;
path.target[2][7] = 0;

path.type[8] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][8] = 10000;
path.target[1][8] = 0;
path.target[2][8] = -1000;
path.circleIntermediateTarget[0][8] = 9707.1;
path.circleIntermediateTarget[1][8] = 0;
path.circleIntermediateTarget[2][8] = -(1000-707.1);

path.type[9] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][9] = 10000;
path.target[1][9] = 0;
path.target[2][9] = -9000;

path.type[10] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][10] = 9000;
path.target[1][10] = 0;
path.target[2][10] = -10000;
path.circleIntermediateTarget[0][10] = 9707.1;
path.circleIntermediateTarget[1][10] = 0;
path.circleIntermediateTarget[2][10] = -9707.1;

path.type[11] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][11] = 1000;
path.target[1][11] = 0;
path.target[2][11] = -10000;

path.type[12] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][12] = 0;
path.target[1][12] = 0;
path.target[2][12] = -9000;
path.circleIntermediateTarget[0][12] = 1000-707.1;
path.circleIntermediateTarget[1][12] = 0;
path.circleIntermediateTarget[2][12] = -9707.1;

path.type[13] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][13] = 0;
path.target[1][13] = 0;
path.target[2][13] = 0;

path.type[14] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][14] = 0;
path.target[1][14] = 9000;
path.target[2][14] = 0;

path.type[15] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][15] = 0;
path.target[1][15] = 10000;
path.target[2][15] = -1000;
path.circleIntermediateTarget[0][15] = 0;
path.circleIntermediateTarget[1][15] = 9707.1;
path.circleIntermediateTarget[2][15] = -(1000-707.1);

path.type[16] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][16] = 0;
path.target[1][16] = 10000;
path.target[2][16] = -9000;

path.type[17] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][17] = 0;
path.target[1][17] = 9000;
path.target[2][17] = -10000;
path.circleIntermediateTarget[0][17] = 0;
path.circleIntermediateTarget[1][17] = 9707.1;
path.circleIntermediateTarget[2][17] = -9707.1;

path.type[18] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][18] = 0;
path.target[1][18] = 1000;
path.target[2][18] = -10000;

path.type[19] = AdvMotion::PathIntplSegmentType::Circular;
path.target[0][19] = 0;
path.target[1][19] = 0;
path.target[2][19] = -9000;
path.circleIntermediateTarget[0][19] = 0;
path.circleIntermediateTarget[1][19] = 1000-707.1;
path.circleIntermediateTarget[2][19] = -9707.1;

path.type[20] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][20] = 0;
path.target[1][20] = 0;
path.target[2][20] = 0;

wmxlib_AdvancedMotion->advMotion->StartPathIntpl3DPos(&path);

The following plots show the positions and velocities when the above code is executed.

../_images/WMXDOC_FUNC_PTH_image20.png

../_images/WMXDOC_FUNC_PTH_image21.png