Motion engineers can spend hours optimizing tuning parameters in servo-based systems, and still not get the performance they want. Their time may also be wasted if, at some point in the project, they are forced to switch to stepmotors, which have an entirely different physics than servos.

Rather than risk either situation, many engineers now focus on optimizing motion profiles (instead of tuning parameters) and letting the controller deal with the motor. Advanced profiling methods developed in the past ten years include asymmetric acceleration-deceleration, seven-segment s-curve profiling, change-on-the-fly, and electronic camming — all of which let machines work faster and better. This article discusses the mathematics of these techniques and provides insights into how to “tune” each profile for maximum performance.

### Getting there from here

While there are many different motion profiles in use today, a good starting place is the point-to-point move. For many applications, including scientific instrumentation, pointing systems, medical, and general automation, point-to-point moves are the most common, and optimizing them will have the greatest impact on system performance.

Point-to-point means that, from a stop, the load is accelerated to a constant velocity, after which it's decelerated such that acceleration and velocity simultaneously reach zero the moment the load arrives at the programmed destination.

Two profiles commonly used for point-to-point moves are the s-curve and its simpler cousin, the trapezoid. In the context of a point-to-point move, an s-curve consists of seven distinct phases of motion.

In phase I, the load starts moving (from rest) at a linearly increasing acceleration toward a maximum value. In phase II, the load accelerates steadily at this rate. Phase III begins a linear decline in acceleration that descends to zero, at which time load velocity reaches its maximum value. Velocity remains constant throughout phase IV, and then the load decelerates in a symmetric manner in phases V, VI, and VII.

Trapezoidal profiles, on the other hand, have just three phases. A subset of an s-curve, a trapezoid incorporates only the phases corresponding to phase II (constant acceleration), phase IV (constant velocity), and phase VI (constant deceleration).

The reduced number of phases underscores the difference between these two profiles. The additional phases present in s-curves smooth the transition between periods of acceleration and non-acceleration. In contrast, the transitions in trapezoidal profiles are instantaneous.

The motion characteristic associated with changes in acceleration is called “jerk.” It is defined as the rate of change of acceleration with time. In trapezoidal profiles, jerk is infinite at the phase transitions, which correlates to the load experiencing an unwelcome jolt. In s-curve profiles, jerk is a constant and the energy associated with the change in acceleration is spread out in time, eliminating the potentially powerful punch.

### Avoiding jerks

Changing acceleration gradually rather than abruptly has several advantages, one of which is less load oscillation.

For a given load, the more jerk, the greater the unwanted vibration energy and the broader its frequency spectrum. In other words, the more rapid the change in acceleration, the more powerful the vibrations will be, and the larger the number of vibration modes that will be excited. If vibration frequency matches resonances in the mechanical and control system, it is likely to increase settling time and reduce accuracy.

Conversely, the less jerk, the less vibration energy, corresponding to faster settling times and more accurate moves.

### Wanna go faster?

Because trapezoidal profiles run all out (at full acceleration or deceleration), they are, from the standpoint of profile execution, faster than s-curve profiles. However, if the all-on all-off approach causes an increase in settling time, the advantage may be lost. Fortunately, this can be remedied and throughput optimized by adding a small transition between periods of rest and acceleration.

In most applications, only a small amount of “s” — the transition between acceleration and no acceleration — can substantially reduce induced vibration. Thus, it is possible to optimize throughput by “tuning” the s-curve profile for the given load as well as the desired transfer speed.

On an application-by-application basis, the best form for the s-curve will depend on the mechanical nature of the system and desired performance specifications. For example, in medical applications involving liquid transfers that should not be jostled, it would be appropriate to choose a profile with no phase II and VI segments at all. The ideal profile here is one that spreads out the acceleration transitions as far as possible, thereby maximizing smoothness.

In high-speed pick-and-place applications, on the other hand, overall transfer speed is most important, so a good choice might be an s-curve with transition phases (phases I, III, V, and VII) that are 5% to 15% of phase II and VI. In this case, the s-curve profile will add a small amount of time to the overall transfer time, but because of reduced load oscillation at the end of the move, the total effective transfer time can be considerably decreased. Trial-and-error using a motion measurement system is generally the best way to determine the right amount of “s” because modeling the response to vibrations is still complicated and not always accurate.

### Make your point-to-point

The ultimate goal of any move profile is to match the motion system's characteristics to the desired application. Trapezoidal and s-curve profiles work well when the system's torque response curve is fairly flat; that is, when the output torque does not vary much over the anticipated velocity range. This is true for most servomotor systems, whether dc brush or brushless dc.

Stepmotors, however, do not have flat speed-torque curves. Torque output is nonlinear, sometimes having a large drop at a location called the “mid-range instability,” and if not there, then certainly at higher velocities.

Mid-range instability occurs at step frequencies where the motor's natural resonance matches the stepping rate. To address it, the most common strategy is to use a non-zero starting velocity. This means that the profile instantly “jumps” to a programmed velocity at the instant of acceleration and deceleration. Though crude, the technique sometimes provides better results than a smooth ramp for zero velocity, particularly for systems that do not use microstepping drives.

To address torque drop-off at higher velocities, a parabolic profile may be required. Here, acceleration is smallest when the velocity is highest. This is a good match for stepmotor systems because there is less torque available at higher speeds.

With parabolic profiles, however, starting and ending accelerations are very high and there is no “s” phase where the acceleration smoothly transitions to zero. Thus, if load oscillation is a problem, parabolic profiles may not work as well as s-curves, despite the fact that standard s-curves are not optimized for stepmotor speed-torque characteristics.

### Table for 65,536, please

The ultimate in point-to-point profile generation — as well as for other types of profiles including continuous path generation used in CNC machine tools — is to construct a custom profile that compensates for the specific load and motor characteristics. Such a profile would accelerate the motor, taking into account the available torque and mechanical resonances at each velocity point and the actuator or arm kinematics in the mechanism.

Since motor torque curves do not follow simple mathematical principles, and because the equations for kinematic compensation are complex, these calculations are generally made in advance and stored in a table of motion “vectors.” This table is generally set up as an array of position or time vectors, with a corresponding entry for velocity and acceleration at each point of the curve.

In this configuration, the motion engine is merely providing a generic capability to download and execute a list of vectors, and the responsibility of the calculations falls to the user. Despite this additional work, if special conditions exist, such as when motors or mechanisms are highly nonlinear, table-driven point-to-point profiles can provide a meaningful performance increase, and may be well worth the extra effort.

### Cam we talk?

Beyond point-to-point moves, there is a broad range of motion applications that require repetitive motion indexed by a master timer or encoder. Such applications fall under the category of electronic cams, which includes the related but simpler approach known as electronic gearing.

Cams, typically, also use downloadable tables. In this case, the tables define a target position for each location of the master encoder or each tick of the master clock. The user can download a trapezoidal profile, an s-curve profile, or more commonly, a custom profile that replicates the function of a specially-shaped mechanical cam.

There are a number of ways to specify the relationship between the master clock and the controlled axis. The most common is to define the number of encoder counts that make up a 360 degree rotation of the master encoder, and then allow one or more output points to be defined at each degree position of the table. When executing the table, the motion controller will “wrap” back (after reading the last location) and restart from the first. Because of this, the beginning and ending position targets must be the same, or very similar, to avoid a discontinuous jump in motion.

A variation on this approach is to treat each table entry as a relative distance to move rather than as an absolute desired axis location. Using this method, there is no requirement that the first and last entries in the table match up.

Electronic gearing is a simpler version of camming where the relationship between master and driven axes can be expressed as a fixed ratio. Gear ratios can be positive or negative, and can be greater or less than one, meaning that the driven axis can amplify, or reduce, the motion specified by the master encoder.

*For more information on optimizing motion profiles, contact Performance Motion Devices at (781) 674-9860 or visit* pmdcorp.com.

### Trapezoidal profile mathematics

The basic math required to execute trapezoidal profiles is straight- forward. There are two forms that can be used; the continuous form (from high school physics) and the discrete-time form found in most motion systems (systems using microprocessors or DSPs to generate new motion parameters with each tick of the motion clock).

### Continuous form:

*p _{t} = p_{o} + v_{o}t + ½at^{2}*

*v _{t} = v_{o} + at*

p_{decel} = v^{2}/2a

### Discrete-time form:

*p _{t} = p_{t} + v_{t} + ½a*

*v _{t} = v_{t} + a*

where *p _{o}* and

*v*are starting position and velocity,

_{o}*p _{t}* and

*v*are position and velocity at time

_{t}*t*,

and *a* is acceleration.

### S-curve mathematics

Point-to-point s-curves are more complicated than trapezoids. For one thing, they are third-order curves, not second order. They're also composed of seven motion segments, instead of three.

Because it's often difficult to calculate stopping distance for a given set of profile values, systems running s-curves typically avoid on-the-fly changes and asymmetric profiles. This ensures the system's information (on acceleration time and distance) is accurate when it's time to start decelerating.

### Continuous form:

*p _{t} = p_{o} + v_{o}t + ½a_{o}t^{2} + 1/6jt^{3}*

*v _{t} = v_{o} + a_{o}t + ½ jt^{2}*

*a _{t} = a_{o} + jt*

### Discrete-time form:

*p _{t} = p_{t} + v_{t} + ½a_{t} + 1/6j*

*v _{t} = v_{t} + a_{t} + ½jt*

*a _{t} = a_{t} + jt*

where *p _{o}, v_{o},* and

*a*are starting position, velocity, and acceleration,

_{o}*p _{t} , v_{t},* and

*a*are position, velocity, and acceleration at time

_{t}*t*,

and *j* is jerk (time rate of change of acceleration).

### Parabolic profile math

Parabolic profiles are closely related to s-curves being third-order moves. As with s-curve profiles, calculating the distance to deceleration is complicated, particularly if profiles are allowed to change on-the-fly.

### Continuous form:

*p _{t} = p_{o} + v_{o}t + ½a_{o}t^{2} - 1/6jt^{3}*

*v _{t} = v_{o} + a_{o}t - ½jt^{2}*

*a _{t} = a_{o} - jt*

### Discrete-time form:

*p _{t} = p_{t} + v_{t} + ½a_{t} - 1/6j*

*v _{t} = v_{t} + a_{t} - ½jt*

*a _{t} = a_{t} - jt*

where *p _{o}, v_{o},* and

*a*are starting position, velocity, and acceleration,

_{o}*p _{t}, v_{t},* and

*a*are position, velocity, and acceleration at time

_{t}*t*,

and *j* is jerk.