Auto Smooth Mode
In path interpolation, the motion profile is calculated for the path trajectory and not for the individual axes. Because of this, if there are sharp corners in the path, one or both axes may suddenly accelerate or decelerate. The auto smoothing option can smooth sharp corners and reduce acceleration and deceleration spikes.
If enableAutoSmooth is set to 1, an arc segment is inserted between every two consecutive linear segments that form an angle. For every two consecutive linear segments, the auto smoothing radius of the first linear segment determines the length of each segment to replace with an arc segment. If the auto smoothing radius is larger than the length of either of the linear segments, it will be reduced to equal the smaller of the linear segments. The auto smoothing radius is ignored for circular segments.
The following code executes a path interpolation with auto smoothing enabled. The path before smoothing consists of only linear interpolation segments. The auto smoothing radius is gradually increased for later linear interpolation segments.
AdvMotion::PathIntplCommand path;
path.axis[0] = 0;
path.axis[1] = 1;
//Use single motion profile for entire path
path.enableConstProfile = 1;
path.profile[0].type = ProfileType::Trapezoidal;
path.profile[0].velocity = 10000;
path.profile[0].acc = 10000;
path.profile[0].dec = 10000;
//Auto smoothing
path.enableAutoSmooth = 1;
//Define linear and circular segments
path.numPoints = 6;
path.type[0] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][0] = 4000;
path.target[1][0] = 10000;
path.autoSmoothRadius[0] = 1000;
path.type[1] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][1] = 8000;
path.target[1][1] = 0;
path.autoSmoothRadius[1] = 2000;
path.type[2] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][2] = 12000;
path.target[1][2] = 10000;
path.autoSmoothRadius[2] = 3000;
path.type[3] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][3] = 16000;
path.target[1][3] = 0;
path.autoSmoothRadius[3] = 4000;
path.type[4] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][4] = 20000;
path.target[1][4] = 10000;
path.autoSmoothRadius[4] = 5000;
path.type[5] = AdvMotion::PathIntplSegmentType::Linear;
path.target[0][5] = 24000;
path.target[1][5] = 0;
wmxlib_AdvancedMotion->advMotion->StartPathIntplPos(&path);
The following plots show the positions and velocities when the above code is executed.
