Profile Spline
In this spline type, the profile along the spline is specified using the ProfileSplineCommand class.
The following sample code executes the same spline but with a profile type. The profile along the spline path is specified for a profile type spline.
//Create the spline channel buffer
wmxlib_AdvancedMotion->advMotion->CreateSplineBuffer(0, 100);
//Set the spline command options
AdvMotion::ProfileSplineCommand spl;
spl.dimensionCount = 2;
spl.axis[0] = 0;
spl.axis[1] = 1;
spl.profile.type = ProfileType::Trapezoidal;
spl.profile.velocity = 10000;
spl.profile.acc = 20000;
spl.profile.dec = 20000;
//Set the spline point data
AdvMotion::SplinePoint pt[9];
pt[0].pos[0] = 0;
pt[0].pos[1] = 0;
pt[1].pos[0] = 1000;
pt[1].pos[1] = 0;
pt[2].pos[0] = 500;
pt[2].pos[1] = 500;
pt[3].pos[0] = 1000;
pt[3].pos[1] = 1000;
pt[4].pos[0] = 1000;
pt[4].pos[1] = 1500;
pt[5].pos[0] = 0;
pt[5].pos[1] = 1500;
pt[6].pos[0] = 0;
pt[6].pos[1] = 1000;
pt[7].pos[0] = 500;
pt[7].pos[1] = 500;
pt[8].pos[0] = 0;
pt[8].pos[1] = 0;
//Execute the spline command
wmxlib_AdvancedMotion->advMotion->StartCSplinePos(0, &spl, 9, pt);
//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 velocity and acceleration of each axis and along the combined spline trajectory when the above sequence is executed from position (0, 0). The specified points are shown in the position plot as black dots.

The combined velocity and acceleration in the above plots show that the specified profile parameters are not closely followed. This occurs because the number of samples taken to calculate the profile is only 1 per point. By increasing the sampleMultiplier, more samples will be taken and the profile will be more closely followed. However, it will increase the required spline channel buffer size by the same factor.
The following sample code executes the same profile type spline but with a sampleMultiplier of 20.
//Create the spline channel buffer
wmxlib_AdvancedMotion->advMotion->CreateSplineBuffer(0, 200);
//Set the spline command options
AdvMotion::ProfileSplineCommand spl;
spl.dimensionCount = 2;
spl.axis[0] = 0;
spl.axis[1] = 1;
spl.profile.type = ProfileType::Trapezoidal;
spl.profile.velocity = 10000;
spl.profile.acc = 20000;
spl.profile.dec = 20000;
spl.sampleMultiplier = 20;
//Set the spline point data
AdvMotion::SplinePoint pt[9];
pt[0].pos[0] = 0;
pt[0].pos[1] = 0;
pt[1].pos[0] = 1000;
pt[1].pos[1] = 0;
pt[2].pos[0] = 500;
pt[2].pos[1] = 500;
pt[3].pos[0] = 1000;
pt[3].pos[1] = 1000;
pt[4].pos[0] = 1000;
pt[4].pos[1] = 1500;
pt[5].pos[0] = 0;
pt[5].pos[1] = 1500;
pt[6].pos[0] = 0;
pt[6].pos[1] = 1000;
pt[7].pos[0] = 500;
pt[7].pos[1] = 500;
pt[8].pos[0] = 0;
pt[8].pos[1] = 0;
//Execute the spline command
wmxlib_AdvancedMotion->advMotion->StartCSplinePos(0, &spl, 9, pt);
//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 velocity and acceleration of each axis and along the combined spline trajectory when the above sequence is executed from position (0, 0). The specified points are shown in the position plot as black dots.

Compared to the previous plots, the specified profile parameters are more closely followed by the combined velocity and acceleration followed. n the above plots. However, the acceleration of each individual axis is much higher, because the velocity and acceleration along the spline trajectory is more closely followed, even at sharp corners. The profile type spline is suitable for point data that do not produce sharp corners in the spline trajectory (such as dense point data in which each point is spaced close to each other).