Motion profiles: getting there smoothly
The fastest way from A to B is 'full speed, then stop'. Why does no real lift, robot or train move like that?
About 35 min · 3 goals · Checked by automated tests
1.Why should I care?
Knowing where to go (IK) isn't enough; a robot must also decide how to get there over time. Motors have torque limits, payloads slosh, passengers feel jolts. A motion profile plans position, speed and acceleration together so the move is fast but feasible. The trapezoid is the workhorse of industry.
- ◇ Interpolate a position linearly between two points at constant velocity.
- ◇ Plan a trapezoidal profile with speed and acceleration limits and compute its duration.
- ◇ Recognise when a short move becomes a triangular profile.
2.Predict
A joint must move 2 rad with top speed 1 rad/s and acceleration limit 1 rad/s². How long does the trapezoidal move take?
Guess first. Being wrong here is how the surprise works.
3.Discover
Start with D = 2 m, v = 1 m/s, a = 1 m/s² and check the 3 s prediction. Then shrink D until the trapezoid becomes a triangle: at what distance does that happen? Finally raise a: what happens to the trapezoid's duration as a gets very large?
Loading the interactive…
Can't use the interactive? Read a description instead
The profile comparer plots position against time (top) and speed against time (bottom) for a constant-velocity move (dashed orange: speed jumps instantly) and a trapezoidal move (solid blue: speed ramps up, cruises, ramps down). The readout gives both durations, the ramp and cruise times, and both positions at the chosen time.
4.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1
A slider moves at constant speed from x = 10 cm to x = 50 cm in 4 s. Where is it at t = 1 s, in cm?
5.Understand
Linear interpolation
The simplest trajectory: x(t) = x0 + (x1 − x0)·(t/T) for 0 ≤ t ≤ T. Constant speed |x1 − x0|/T the whole way. It's perfect for planning where to be in the middle of a move, but at t = 0 and t = T the speed jumps instantly, which would need infinite acceleration.
The trapezoid
Accelerate at the limit a until reaching the speed limit v, cruise, then decelerate at a to stop exactly at the target. The speed-time graph is a trapezoid; its area is the distance. Position during the first ramp is ½at²; during the cruise, v²/(2a) + v(t − ta); during the final ramp, D − ½a(T − t)².
Triangles and beyond
Short moves never reach v: the trapezoid collapses to a triangle. And the trapezoid still has instant jumps in acceleration (jerk), felt as a small jolt; lifts and precision machines use S-curves that also limit jerk, at the cost of a little more time. The Elevator Build's planner shows that next step.
Explain it another way
Driving between traffic lights: you pull away smoothly, hold a steady speed, then brake smoothly to stop at the line. You'd never floor it and slam on the brakes with a cup of tea on the dashboard.
A trapezoidal profile is the time-optimal bang-coast-bang solution under symmetric acceleration and velocity bounds. Its acceleration is piecewise constant (+a, 0, −a); jerk is unbounded at the switching instants.
D = 6.5 rad, v = 1.5 rad/s, a = 0.5 rad/s²: ta = 3 s, ramp distance 2.25 rad each, cruise 2 rad (1.333 s). T = 6.5/1.5 + 1.5/0.5 = 4.333 + 3 = 7.333 s.
CNC machines, 3D printers and robot arm controllers all plan trapezoidal or S-curve profiles for every move; the 'acceleration' setting in a 3D printer's firmware is exactly the a in these equations.
Derivation: Duration of a trapezoidal move
Ramp up from rest at acceleration a to speed v: time ta = v/a, distance ½·a·ta² = v²/(2a).
Ramp down is the mirror image: another v/a seconds and v²/(2a) metres.
Cruise covers the rest, D − v²/a, at speed v, taking (D − v²/a)/v = D/v − v/a seconds. This needs D ≥ v²/a.
Total: T = 2·(v/a) + D/v − v/a = D/v + v/a. The extra v/a, compared with D/v, is the price of smoothness.
If D < v²/a there's no room to cruise: the profile is a triangle with peak speed √(D·a) and duration 2√(D/a).
Worked example 1
D = 5.5 rad, a = 0.5 rad/s², v = 0.5 rad/s. Where is the joint at t = 6 s?
ta = 1 s, ramp distance 0.25 rad, T = 5.5/0.5 + 1 = 12 s. At t = 6 s it's cruising: 0.25 + 0.5 × (6 − 1) = 2.75 rad.
Common mix-ups
- Raising the speed limit always makes the move faster by the same proportion.
✓ T = D/v + v/a: for short moves the ramps dominate, and a higher v can barely help (or the move is a triangle anyway). - A trapezoidal profile is perfectly smooth.
✓ Its speed is continuous, but its acceleration jumps; S-curves smooth that too.
6.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2 · a fresh version every time
A camera slider moves at constant speed from x = −40 cm to x = 20 cm in 4 s. Where is it at t = 1.6 s, in cm?
Practice 3 · a fresh version every time
A joint follows a trapezoidal profile over 2.5 rad: it accelerates at 2 rad/s² up to 1 rad/s, cruises, then decelerates at 2 rad/s² to stop. How far has it moved at t = 1.1 s, in radians? (3 decimal places)
Practice 4
With v = 2 m/s and a = 1 m/s², which move is too short to reach full speed?
Practice 5
Why don't robot controllers use pure constant-velocity moves between points?
7.Apply it
A camera slider must cross 1.2 m in under 3 s without the camera's acceleration exceeding 1 m/s². Choose a speed limit, plan the trapezoid and check it in the comparer. Then look at the Elevator Build's S-curve planner and compare the trip time.
8.Reflect
9.Go further
- Motion planning (Wikipedia) ↗The wider field of planning paths and trajectories.
Concepts: Motion profiles and trajectories