The Shape of the Move
The Shape of the Move: Trapezoidal vs S-Curve Trajectory Planning
Your arm arrives on time and then shakes for two seconds. The move was never the problem, the shape of the move was. Trapezoidal is faster on paper; S-curve is faster on the machine, and here is the arithmetic that proves it.
Example Labs is a made-up company we use for worked examples.
Picture the Example Labs bench arm at the end of a pick-and-place move. The shoulder joint has swung 60 degrees, exactly as commanded, and the gripper is over the tray. The commanded move took 0.86 seconds. The arm then spends another 2.2 seconds shaking, the gripper oscillating a fraction of a degree each way, the vial in its fingers sloshing, the vision camera waiting for the image to stop moving before it can confirm the place.
The operator's instinct is to slow the arm down. The cycle time is already too long, so slowing down feels like giving up. The right instinct is different: the move was never the problem. The shape of the move was.
A trajectory is not a destination. It is a schedule, a plan that says where the arm should be at every instant between here and there, how fast it should be going, how hard it should be accelerating, and how quickly that acceleration should change. Two schedules can start at the same place, end at the same place, respect the same speed and acceleration limits, and still behave completely differently when the metal meets them. One of them arrives and shakes. The other arrives and stops.
This article is about the two schedules every motion engineer meets first, the trapezoidal profile and the S-curve, and about the third derivative that decides between them: jerk. It builds on the pieces that came before it: the PID article, which built the loop that has to track whatever profile you give it; the motor article, which set the torque and speed limits the profile has to respect; and the arm article, which built the two-link bench arm whose shoulder joint this article times.
Path is not trajectory
The first distinction to get right is the one most people blur. A path is geometry: the curve the gripper follows through space, from where it is to where it needs to be. It has no time in it. A trajectory is the path plus time: it says when the gripper is at each point on the path, and how fast it is moving there.
The usual way to write it, for a single joint moving from q0 to q1, is:
q(t) = q0 + s(t) · (q1 − q0)
Here q(t) is the joint angle at time t, and s(t) is a number that runs from 0 at the start to 1 at the end. The path is the straight line from q0 to q1. The trajectory is the choice of s(t), the time scaling, and everything in this article is about choosing s(t) well.
At any instant, the trajectory tells the controller four things, each one the derivative of the one before it:
- Position q, where the joint should be.
- Velocity v = dq/dt, how fast it should be moving.
- Acceleration a = dv/dt, how fast the velocity should be changing.
- Jerk j = da/dt, how fast the acceleration should be changing. The third derivative of position.
Velocity makes the robot fast. Acceleration makes it reach speed quickly. Jerk determines whether the motion feels smooth or harsh, and whether the machine shakes when the motion ends. Most engineers plan the first three and ignore the fourth. The fourth is the one that costs them the cycle time.
Think of it like driving. Position is where you are on the road. Velocity is your speed. Acceleration is pressing the pedal. Jerk is how fast you press the pedal. Stomp the pedal to the floor and lift it instantly, and the passengers feel a jolt, even though the speed never exceeded the limit and the acceleration never exceeded what the engine can do. The jolt is the jerk. A robot arm is a passenger that cannot complain, so it shakes instead.
The trapezoidal profile: three phases, four jolts
The trapezoidal profile is the classic starting point, and it is the right place to start because it is the simplest profile that respects the motor's limits. It has three phases:
- Accelerate at +a_max, the most the motor can give, until the joint reaches v_max.
- Cruise at v_max, the fastest the joint is allowed to go, until it is time to slow down.
- Decelerate at −a_max until velocity and acceleration both reach zero at the destination.
Plot velocity against time and the shape is a trapezoid, hence the name. Three numbers define it: the distance d, the top speed v_max, and the acceleration a_max. The timing is simple arithmetic: each ramp takes v_max / a_max seconds and covers v_max² / (2·a_max) of distance, the cruise covers the rest, and the whole move takes v_max / a_max + d / v_max seconds.
For a 100 mm move at 100 mm/s with an acceleration of 500 mm/s², each ramp takes 0.2 seconds and covers 10 mm, leaving 80 mm of cruise, for a total of 1.2 seconds. That worked example is from Robotics Project Hub, and it is worth remembering because the S-curve version of the same move is exactly one jerk time longer, a fact this article comes back to.
If the distance is too short to reach v_max, the profile has no cruise phase at all and becomes triangular: accelerate to some peak velocity below v_max, then decelerate immediately. The peak velocity for a triangular move is v_max = √(a_max · |Δq|). For the bench arm's 60-degree shoulder swing, that number is 2.51 rad/s, above the 2.0 rad/s limit, so the arm's move does have a cruise phase, but only just.
Short moves on real machines are triangular far more often than the textbook suggests, because the distance between two pick points is rarely long enough to reach full speed.
The trapezoidal profile fixed velocity. Look one derivative down and the problem has simply moved. At t = 0, acceleration jumps from 0 to a_max instantly. At the top of the ramp it drops back to 0 instantly. It jumps again at the start and end of the deceleration. Each of those is a step in acceleration, and the rate of change of acceleration is jerk, so a step in acceleration is an infinite jerk impulse in pure mathematics.
Infinite is not a number a machine can produce. What it produces instead is the energy that the step was supposed to carry, delivered all at once: an audible knock at the start and end of every ramp, belts stretching, couplings winding up, and the structure, which always has some compliance, oscillating afterwards. The profile only changes what the controller is following. The mechanics still have to absorb the jolt.
Jerk: why a step in acceleration shakes the machine
Jerk is strongly related to vibration, noise, tracking error, mechanical wear, and surface quality, in welding, painting, grinding, dispensing, and high-speed pick-and-place. The mechanism is straightforward, and it is worth stating plainly because it is the whole argument of this article.
A sudden change in acceleration is a sudden change in force. Force is what moves the load, and the load is connected to the motor through things that bend: belts, harmonic drive flexsplines, gear teeth, the arm structure itself. A sudden force change excites those flexible elements the way plucking a string excites it, and they ring at their own natural frequency until friction damps them out.
The more jerk, the greater the unwanted vibration energy, and the broader its frequency spectrum. A step in acceleration contains energy at every frequency, including the frequency of the machine's dominant vibration mode. If the vibration frequency matches a resonance 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. That is the finding of the classic PMD paper on motion control profiles, "Mathematics of Motion Control Profiles", and it is the sentence the rest of this article is built on.
There is a number that makes it concrete. The bench arm's shoulder, with its harmonic drive and a 5 kg payload at 0.85 m, has a dominant vibration mode around 5 Hz, a period of 200 milliseconds. During the trapezoidal acceleration phase at 6 rad/s², the flexible joint lags behind the command by a/ω², which is 6.08 milliradians, or 0.35 degrees.
That lag is stored energy. When the acceleration steps to zero at the end of the ramp, the stored energy has nowhere to go except into oscillation. The arm does not shake because the profile was wrong about position.
It shakes because the profile demanded a force change the mechanics could not deliver smoothly.
The S-curve: seven phases, one extra constraint
The S-curve adds exactly one constraint to the trapezoidal profile: acceleration is not allowed to change instantly. It must ramp from 0 to a_max at a constant jerk, hold, then ramp back to zero, and the same on the way down. The velocity curve gains rounded corners, hence the name, and acceleration becomes a trapezoid of its own.
A full S-curve move has seven phases:
- Jerk up, acceleration rises linearly from 0 to a_max.
- Constant acceleration, acceleration holds at a_max.
- Jerk down, acceleration falls linearly back to 0, and velocity reaches v_max.
- Cruise, constant velocity.
- Jerk up (deceleration), deceleration rises linearly from 0 to a_max.
- Constant deceleration, deceleration holds at a_max.
- Jerk down, deceleration falls linearly back to 0, and the move ends at rest.
The trapezoidal profile is a subset of the S-curve: it has only phases 2, 4, and 6. The S-curve's extra phases are the transitions, the ramps into and out of acceleration that the trapezoid skips. In the S-curve, jerk is a constant, bounded number, and the energy associated with the change in acceleration is spread out in time instead of delivered as a punch.
The cost of the extra phases is exactly one jerk time. When both profiles reach the same v_max and the same a_max, the S-curve move takes longer by t_j = a_max / j_max, one jerk time, not two, and regardless of how far the move is. The reason it is one and not two is that the S-curve's acceleration segment is longer, so it covers more distance, and the cruise phase shortens to compensate.
On the Robotics Project Hub worked example, 100 mm at 100 mm/s, 500 mm/s², the trapezoidal move takes 1.2 seconds and the S-curve takes 1.3 seconds. An 8% penalty on that move, and a smaller percentage on longer ones, in exchange for bounded jerk.
That single fact reframes the whole trade. The question is never "is the S-curve slower". It is slower, by exactly one jerk time. The question is whether the time you lose in the move is less than the time you lose waiting for the shaking to stop. On the bench arm, it is not close.
Tuning
An S-curve has three limits to choose, v_max, a_max, and j_max, and each one comes from a different part of the machine. Choosing them from a table is how you get a profile that is smooth on paper and slow on the machine.
v_max comes from the motor and the encoder. The motor article showed that a BLDC motor's torque falls with speed, and the encoder article showed that the feedback has a maximum frequency it can track. The top speed is the lower of the two: the speed at which the motor can still deliver the torque the move needs, and the speed at which the encoder still reports position accurately. For the bench arm shoulder, 2.0 rad/s is inside both.
a_max comes from the torque. The motor article's rule was τ_motor = τ_load ÷ (N · η), with a safety factor of 1.5–2×. The shoulder needs 126.8 N·m with margin, from the motor article's own calculation. The acceleration limit is the acceleration at which the required torque, the load's inertia times the acceleration, plus gravity and friction, stays inside the motor's continuous rating with the safety factor intact. Set a_max from the torque, not from a guess, and the profile will never ask the motor for something it cannot give.
j_max comes from the vibration mode. The jerk time t_j = a_max / j_max should be long enough that the acceleration ramp does not excite the dominant mode. The pipeline's guidance is that jerk time should be at least 2–3× the period of the system's dominant vibration mode, for the bench arm, with a 200 ms mode period, that would be 400–600 ms. The demo in this article uses a jerk time of 200 ms, which is 1.0× the mode period, and still cuts the residual oscillation by a factor of nineteen. A longer jerk time would cut it further, at the cost of more commanded time. The guideline is conservative; the demo shows the mechanism works even at its low end, and the right jerk time for a given machine is the one that makes the residual smaller than the tolerance, not the one that satisfies a rule of thumb.
Short moves collapse the phases. If the distance is too short, the profile never reaches v_max, and the cruise phase disappears. If the jerk time is long relative to the move, the constant-acceleration phase disappears too, the acceleration ramps up and immediately back down, and the profile has six phases instead of seven, with a peak acceleration below a_max. The profile generator has to handle all of these cases, because a pick-and-place machine spends most of its life on short moves. A library that only handles the full seven-phase case will fail on the moves that matter most.
When to use which
The choice is not a matter of taste. It is a matter of what the move is for, and the answer is different in different industries for reasons that are easy to state.
A packaging line takes trapezoidal for speed. The load is a box, the tolerance is millimetres, and the line's bottleneck is the move time itself. The shake at the end of the move does not matter, because the box does not care and the next operation does not need the arm to be still to a tenth of a degree. The trapezoidal profile's commanded time is the whole story, and it is shorter.
A pharmaceutical filling line takes S-curve to avoid spilling liquid. The load is an open vial, the tolerance is the surface of the liquid, and a jolt at the end of the move spills product, contaminates the line, and fails the batch. The commanded move is longer, but the total time, move plus settling plus cleaning up the spill, is shorter, and the yield is higher.
Semiconductor manufacturing takes S-curve because even a tiny vibration can ruin a wafer. The tolerance is nanometres at the tool tip, the mode is lightly damped, and the cost of a ruined wafer dwarfs the cost of a tenth of a second of move time. The profile is chosen for the settling, not for the move.
A high-speed pick-and-place machine takes S-curve with short jerk times, the acceleration-smoothing phases are 5–15% of the time spent accelerating or decelerating. That is the tuning that trades a little smoothness for transfer speed, and it is the tuning the demo below uses: a jerk time of 200 ms against an acceleration phase of 533 ms, which is the same order. While the S-curve slightly increases the commanded move time compared with a trapezoidal profile, by lowering end-of-move oscillation it reduces the total effective transfer time.
That sentence, from the Engineer News Network's guide to motion profiles, is the whole article in one line.
The libraries: don't roll your own
In 2026, writing your own seven-phase profile generator by hand is a solved problem you should not re-solve. Two production libraries cover the two cases, and they cover them differently.
Ruckig is the library for online generation, when the target can change while the arm is already moving. It generates trajectories on the fly, starting from any initial state (position, velocity, and acceleration) and ending at any target state, limited by velocity, acceleration, and jerk constraints. For state-to-state motions it guarantees a time-optimal solution, and it synchronises multiple degrees of freedom so they arrive together. It was published by Lars Berscheid and Torsten Kröger as "Jerk-limited Real-time Trajectory Generation with Arbitrary Target States" at Robotics: Science and Systems in 2021, and evaluated on more than a billion random trajectories plus real-world applications. It is available as a C++ library, a ROS package, and a Python module from PyPI. The case for Ruckig is a robot that has to react to sensor input, a vision system that moves the target, a force sensor that changes the plan mid-move, a human stepping into the cell. If the trajectory is generated once and then executed, Ruckig is more than you need. If the trajectory has to change while it is running, Ruckig is the tool.
TOPP-RA is the library for offline time-optimal re-timing, when the geometric path is already fixed and the question is how fast the machine can traverse it. TOPP, time-optimal path parameterisation, takes a path q(s) and a list of constraints (joint velocity, joint acceleration, torque, Cartesian velocity) and returns the fastest time parameterisation s(t) that satisfies them. TOPP-RA, the reachability-analysis variant, was published by Hung Pham and Pham Quang Cuong in IEEE Transactions on Robotics in 2018 ("A New Approach to Time-Optimal Path Parameterization Based on Reachability Analysis"), and is available as the toppra Python package. MATLAB's Robotics System Toolbox ships it as contopptraj. The case for TOPP-RA is a path that does not change, a welding seam, a dispensing route, a CNC toolpath, where the optimisation is done once, offline, and the machine executes the result. The third-order variants add jerk limits, so acceleration ramps instead of jumping, the same smoothness the S-curve gives, but computed as the optimum for that particular path rather than as a fixed seven-phase shape.
The rule is the same as the secure-boot article's rule about MCUboot: use the library. A hand-rolled profile generator has the same failure modes as a hand-rolled image validator, it works on the moves you tested and fails on the move you did not test, which is the short move with no cruise phase, the move that starts with non-zero velocity, or the move whose jerk time is longer than its acceleration time.
The same move twice: the bench arm shoulder, 0° to 60°
The demo is a real Python simulation, run before writing, not a sketch. The move is the bench arm's shoulder joint, from 0° to 60° (1.047 radians), with the same limits for both profiles: v_max 2.0 rad/s, a_max 6.0 rad/s², and for the S-curve j_max 30 rad/s³, giving a jerk time t_j of 0.200 seconds. The plant is a second-order flexible-joint model with the arm's dominant vibration mode at 5 Hz and a damping ratio of 0.03, a lightly damped bench arm with a harmonic drive and a 5 kg payload at 0.85 m, the same arm the motor and gearbox articles sized.
The simulation runs at a 0.5 ms step, and the profile lands within 0.02° of the target from integration alone, well inside the 0.1° settling tolerance.
Step 1, the commanded move. The trapezoidal profile takes 0.857 seconds: 0.333 seconds accelerating, 0.190 seconds cruising, 0.333 seconds decelerating. The S-curve takes 1.058 seconds: two 0.529-second halves with no cruise phase at all, because the move is just short of needing one, the two acceleration halves cover the whole 60 degrees. The penalty is 0.201 seconds, 23.5%, exactly one jerk time, as the theory says. The pipeline's "25–50% longer in pure motion time" is the range for short moves with long jerk times, not a universal figure: on the 100 mm worked example the penalty is 8%, on this move it is 23.5%, and the exact statement is always one jerk time.
Step 2, what happens after the commanded move ends. The trapezoidal profile's residual oscillation peaks at 0.734 degrees, more than seven times the 0.1° settling tolerance, and the arm does not settle inside 0.1° until 3.042 seconds, which is 2.19 seconds of ringing after the move was supposed to be over. The S-curve's residual peaks at 0.038 degrees, inside the tolerance from the moment the commanded move ends, and it settles at 1.058 seconds, the instant the move ends. The residual is 19.2 times smaller.
Step 3, the total effective time. Trapezoidal: 3.042 seconds from the start of the move to a settled arm. S-curve: 1.058 seconds. The S-curve is 65.2% faster overall, despite being 23.5% slower in commanded time. The move that looks slower on paper is nearly three times faster on the machine, because the machine was never waiting for the move. It was waiting for the shaking to stop.
Step 4, what that means for throughput. Add 0.5 seconds of grip and release work per cycle, the time the gripper needs to close, confirm, and open. The trapezoidal cycle is 3.542 seconds, or 1,017 cycles an hour, 8,132 in an eight-hour shift. The S-curve cycle is 1.558 seconds, or 2,310 cycles an hour, 18,483 in a shift. The same arm, the same motor, the same payload. The only change is the shape of the move, and the shift produces 10,351 more cycles.
The pipeline's "properly tuned S-curves reduce total settling time by 25% or more" is the same shape of claim as the demo's result, and the demo's measured reduction, 65% of effective time, is larger. The 25% figure itself was not verified as a published number in this round, so the article uses the demo's measured number and states the 25% as the pipeline's claim, not as a verified benchmark.
The decision test: five questions
A team that is wondering whether its moves have a trajectory problem can answer five questions in an afternoon. If it cannot answer three of them, it has one.
- How long does the arm take to settle after the commanded move ends, and how long is the commanded move? If the settling time is longer than the move time, the profile is the problem, not the motor.
- What is the dominant vibration mode of the arm, and what is its period? If nobody knows, measure it: command a step, record the ring, and read the frequency off the trace. The jerk time is chosen against this number.
- Does the profile bound jerk, or only velocity and acceleration? If the controller only limits velocity and acceleration, the profile is trapezoidal, whatever the brochure says.
- What happens on a short move, does the profile still work when there is no cruise phase, and when there is no constant-acceleration phase? If the generator only handles the full seven-phase case, it will fail on the moves the machine makes most.
- What is the peak residual oscillation at the end of a move, in degrees, against the tolerance the next operation needs? If the residual is larger than the tolerance, the cycle time is the settling time, not the move time, and every quote that used the move time is wrong.
Objections
"The S-curve is slower." It is slower by exactly one jerk time in commanded move time, and faster by as much as two-thirds in effective time on a lightly damped machine. The question is which time the customer pays for. They pay for the cycle, not the move.
"Our controller already smooths the command." A controller that filters the command after the profile is generated is not the same as a profile that bounds jerk. Filtering adds lag, and the lag has to be compensated somewhere, usually by a slower move. The profile is the place to bound jerk, because the profile is the only place that knows where the move ends.
"We don't have vibration. Our machine is rigid." No machine is rigid. The bench arm's harmonic drive winds up 10.8 mm under the shoulder load, from the gearbox article's own calculation, and that wind-up is a spring. A spring with a mass on it has a mode. The mode may be at 50 Hz instead of 5 Hz, and the residual may be 0.01 degrees instead of 0.7, but it is there, and the tolerance of the next operation decides whether it matters, not the stiffness of the machine.
"We'll just slow the trapezoid down." Slowing the trapezoid down reduces the acceleration, which reduces the step size, which reduces the excitation, but it also lengthens the move, and it does nothing about the shape. The S-curve at full acceleration is faster in effective time than a slowed trapezoid, because the S-curve removes the excitation rather than shrinking it. The demo's S-curve runs at the same a_max and v_max as the trapezoid, and still finishes first.
"Our moves are all long, so the jerk time doesn't matter." The jerk penalty is one jerk time regardless of how far the move is, so on a long move it is a smaller percentage, and the settling time it saves is the same absolute number. Long moves are where the S-curve costs the least and saves the most.
Sources
- PMD Corp, "Mathematics of Motion Control Profiles" (Machine Design / Endeavor Business Media)
What we used
The seven-phase S-curve, the three-phase trapezoid as its subset, infinite jerk at trapezoidal transitions, more jerk means more vibration energy and a broader frequency spectrum, less jerk means faster settling and more accurate moves
- Robotics Project Hub, "Motion Profiles: Trapezoidal and S-Curve Acceleration"
What we used
The 100 mm worked example (1.2 s trapezoidal, 1.3 s S-curve), the exact penalty of one jerk time t_j = a_max / j_max, the audible knock and the ringing from a step in acceleration
- Engineer News Network, "Mastering motion profiles to boost precision and throughput"
What we used
S-curve smoothing phases of 5–15% of accel/decel time in high-speed pick-and-place; the S-curve slightly increases commanded move time but reduces total effective transfer time by lowering end-of-move oscillation
- Ruckig, Berscheid & Kröger, "Jerk-limited Real-time Trajectory Generation with Arbitrary Target States"
What we used
Robotics: Science and Systems 2021; PyPI `ruckig`; ROS package; online generation from any initial state to any target state, time-optimal for state-to-state motions, evaluated on more than 1,000,000,000 random trajectories
- TOPP-RA, Pham & Pham, "A New Approach to Time-Optimal Path Parameterization Based on Reachability Analysis"
What we used
IEEE Transactions on Robotics 34(3), 2018; `toppra` on PyPI; MATLAB Robotics System Toolbox `contopptraj`
- Example Labs bench-arm figures from the cluster: shoulder requirement 126.8 N·m with margin
What we used
Link 1 0.425 m / 4 kg, Link 2 0.425 m / 3 kg, payload 5 kg at 0.85 m (#20); harmonic wind-up 10.8 mm under the shoulder load (#21); the 48 V bench pack and the 2 MB flash hub are not used in this article