.

### S-Curve Jerk Algorithm

Algorithm

The move type, S_CURVE_JERK supports a jerk-specified S-Curve accel/decel profile. This algorithm is only available with custom firmware. For more information, see Controller Firmware. In the custom firmware, the Trapezoidal and S-Curve algorithm is replaced with the S-Curve Jerk algorithm. In the standard firmware, the S-Curve Jerk motion type is not supported and if specified, the MPI will return a "profile not supported" error. The S-Curve Jerk algorithm is ideal for making final adjustments to a move during the deceleration portion of the move and for making smoother transitions from one motion to the next. Also, the S-Curve Jerk algorithm makes it possible to exactly specify the maximum accel and decel and jerk values.

The standard S-Curve algorithm first calculates the trapezoidal profile move from the specified velocity, accel, and decel values. Then the algorithm re-calculates the profile, deriving the accel, decel, and jerk values from the specified jerk percent. Since the algorithm always uses an initial Accel = 0, the start profiles and the modify profiles are calculated the same. The algorithm achieves identical move times for the Trapezoidal and S-Curve profiles by increasing the maximum acceleration, depending on the specified jerk percent. This algorithm is very efficient and easy to understand.

The custom S-Curve Jerk algorithm calculates the move profile based on the specified velocity, accel, decel, and jerk values. It is a complex algorithm, which iteratively solves for the profile based on the initial and final conditions for velocity and acceleration. The resultant trajectory is limited by the specified velocity, acceleration, and jerk. The S-Curve Jerk algorithm does not support a specified jerk percent and is computationally intensive.

Note: If your application does not require modifying S-Curve move profiles during execution, use the standard Trapezoidal or S-Curve algorithm. If your application requires motion profile modifications during acceleration or deceleration, and the acceleration rates are high, contact MEI to discuss a custom S-Curve Jerk algorithm.

Below is a comparison of a modified motion with both algorithms.

S-Curve Algorithm: Notice the Modify calculations assume the initial acceleration
value is zero, which causes an abrupt change in the acceleration profile.

S-Curve Jerk Algorithm: Notice that the Modify calculations use the initial acceleration value, which causes a much smoother transition in the acceleration profile.

Parameters for jerk values should range from a minimum of amax* amax / vmax (amax is just reached when accelerating from 0 to vmax) and a maximum of amax / sample period (amax is reached in one sample period). In the S-Curve Jerk algorithm, changes to the jerk will also change the time needed to complete a motion. For example, a large value of jerk will have a shorter time, but increase the "jerkiness" of the motion (see fig 1). Conversely, a small value of jerk will have a longer time, but a much smoother motion (see fig 2).

The S-Curve Jerk parameters, accelerationJerk and decelerationJerk are located in the MPITrajectory{.} structure. When these are non-zero, the acceleration profile uses the specified jerk and acceleration to ramp an axis(es) to constant velocity and then decelerate to a stop. If accelerationJerk or decelerationJerk is zero, the MPI will return a "parameter invalid" error.

Custom S-Curve Jerk Limitations: The S-Curve Jerk algorithm has the following limitations:

 Multi-axis moves must use the coordination type START. Do not use FINISH. For MPI version 03.04.xx (and older), do not use SYNC_END. For moves that specify a non-zero Final Velocity, the Final Velocity must be < = Maximum Velocity. The ratio of distances traveled for multi-axis moves should not exceed 50,000. Multi-axis move modify should not be called within the first 2 samples of a move start.

MPI 03.04.xx (and older)

For the move type, MPIMotionTypeS_CURVE, the MPI calculates an appropriate jerk value based on the specified velocity, acceleration, and jerkPercent. The jerk value is computed according to the following formula:

If jerkPercent is zero, the jerk value is computed so that the maximum acceleration is reached in one sample period. With the S-Curve algorithm, the time for a move would not change as jerkPercent value was varied. This is also true for this S-Curve algorithm, as long as the move reaches maximum velocity. In short moves, where maximum velocity is not reached, setting jerkPercent to be small will result in a quicker move than if you were to set jerkPercent to be large.

WARNING! The same jerkPercent values may cause different profiles with the special S-Curve Jerk algorithm (implemented in firmware that supports the MPIMotionTypeS_CURVE_JERK move type) than with the standard S-Curve algorithm (implemented in firmware that does not support the MPIMotionTypeS_CURVE_JERK move type). This is because the special S-Curve Jerk algorithm treats the commanded acceleration as a maximum value, not to be exceeded.

Attributes

The new S_Curve algorithm behaves similarly to the previous algorithm, except for its attributes.

MPIMotionAttrMaskDELAY can now be used with any start motion, but never with motion modify.

MPIMotionAttrMaskAPPEND can be used with any motion, as long as it is not preceded by a motion that has a final velocity.

MEIMotionAttrMaskNO_REVERSAL returns a MPIMotionMessagePROFILE_ERROR if the given specifications would result in a move with a reversal, thereby preventing the move from being executed.

MPIMotionTypeTRAPEZOIDAL, MPIMotionTypeS_CURVE, and MPIMotionTypeS_CURVE_JERK

MPIMotionAttrMaskRELATIVE, when used with MPIMotionTypeTRAPEZOIDAL, MPIMotionTypeS_CURVE and MPIMotionTypeS_CURVE_JERK means that the final position is relative to the beginning position of the motion.

MEIMotionAttrMaskFINAL_VEL can be used with MPIMotionTypeTRAPEZOIDAL, MPIMotionTypeS_CURVE and MPIMotionTypeS_CURVE_JERK, but should be used with caution as it may not be possible for the controller to compute a trajectory to meet these criteria, which would cause a MPIMotionMessagePROFILE_ERROR to be returned, and the move to be ignored.

Multi-Axis Motion

If neither MPIMotionAttrMaskSYNC_START nor MPIMotionAttrMaskSYNC_END are specified, a single MPITrajectory{...} may be specified for the resultant motion of multiple axes on one motion supervisor. The motion of each axis will be synchronized with the others on the motion supervisor. The maximum velocity, acceleration, deceleration, and jerk values of the first MPITrajectory structure will be used for the global vector parameters. It will ignore any other values supplied. This cannot be used with MEIMotionAttrMaskFINAL_VEL.

If MPIMotionAttrMaskSYNC_START or MPIMotionAttrMaskSYNC_END (but not both) is specified, each axis will move as fast as possible and either start together, or stop together. If motion is point-to-point and more than one axis on the motion supervisor has a final velocity, MPIMotionAttrMaskSYNC_START or MPIMotionAttrMaskSYNC_END must be used. MPIMotionAttrMaskSYNC_END cannot be used with motion modify.

With MPIMotionAttrMaskSYNC_START and MPIMotionAttrMaskSYNC_END, the motion for each axis will be scaled so that the motion of all axes will end at approximately the same time. The time for this motion is based on the time for the longest motion, so that the limits are not exceeded. The axes will be scaled to start and stop together, but the scaling may not be exact. Both MPIMotionAttrMaskSYNC_START and MPIMotionAttrMaskSYNC_END cannot be used together with MEIMotionAttrMaskFINAL_VEL.

MPIMotionTypeVELOCITY

MPIMotionTypeVELOCITY moves allow a final velocity to be specified without a final point.