Point Time Spline
In this spline type, the time at which each point is passed is specified using the PointTimeSplineCommand class.
The following sample code executes the sample spline but with the point time type. The time that the commanded axes pass through each point is specified for a point time type spline.
//Create the spline channel buffer
wmxlib_AdvancedMotion->advMotion->CreateSplineBuffer(0, 100);
//Set the spline command options
AdvMotion::PointTimeSplineCommand spl;
spl.dimensionCount = 2;
spl.axis[0] = 0;
spl.axis[1] = 1;
//Set the spline point data
AdvMotion::SplinePoint pt[9];
unsigned int time[9];
pt[0].pos[0] = 0;
pt[0].pos[1] = 0;
time[0] = 0;
pt[1].pos[0] = 1000;
pt[1].pos[1] = 0;
time[1] = 125;
pt[2].pos[0] = 500;
pt[2].pos[1] = 500;
time[2] = 250;
pt[3].pos[0] = 1000;
pt[3].pos[1] = 1000;
time[3] = 375;
pt[4].pos[0] = 1000;
pt[4].pos[1] = 1500;
time[4] = 500;
pt[5].pos[0] = 0;
pt[5].pos[1] = 1500;
time[5] = 625;
pt[6].pos[0] = 0;
pt[6].pos[1] = 1000;
time[6] = 750;
pt[7].pos[0] = 500;
pt[7].pos[1] = 500;
time[7] = 875;
pt[8].pos[0] = 0;
pt[8].pos[1] = 0;
time[8] = 1000;
//Execute the spline command
wmxlib_AdvancedMotion->advMotion->StartCSplinePos(0, &spl, 9, pt, time);
//Wait for the spline motion to complete
AxisSelection axes;
axes.axisCount = 2;
axes.axis[0] = 0;
axes.axis[1] = 1;
wmxlib_CoreMotion->motion->Wait(&axes);
//Free the spline buffer (normally, the buffer should only be freed at the end of the application)
wmxlib_AdvancedMotion->advMotion->FreeSplineBuffer(0);
The following plots show the two-dimensional trajectory and the position, velocity, and acceleration vs. time of each axis when the above sequence is executed from position (0, 0). The specified points are shown in the position plot using black dots.
