What is an S-curve motion profile?
An S-curve motion profile describes how a motor, robot joint or machine axis moves from one state to another while respecting limits on velocity, acceleration and jerk, the rate at which acceleration changes. Because acceleration ramps up and down gradually instead of switching on and off, the velocity curve takes the shape of a stretched letter S.
Limiting jerk matters because sudden changes in acceleration act like a hammer blow on the mechanics. They excite vibrations, cause overshoot, wear out gears and belts, and can shake loose whatever the machine is carrying. S-curves trade a few milliseconds of move time for noticeably smoother, quieter and more precise motion.
S-curve vs. trapezoidal profile
The simpler trapezoidal profile limits only velocity and acceleration. Its velocity curve is a trapezoid: accelerate at full rate, cruise, then decelerate at full rate. At every corner of that trapezoid the acceleration jumps instantly, which means the jerk is theoretically infinite.
An S-curve rounds off those corners. Set max_jerk to a very large value in the calculator above
and you'll see the S-curve approach a trapezoidal profile; lower it and the transitions become smoother and the move gets longer.
The seven phases of an S-curve
A complete point-to-point S-curve move from rest to rest consists of up to seven phases:
- Acceleration increases at maximum jerk.
- Acceleration stays constant at its maximum.
- Acceleration decreases back to zero as velocity approaches its maximum.
- The axis cruises at constant velocity.
- Deceleration builds up at maximum jerk.
- Deceleration stays constant at its maximum.
- Deceleration eases off until the axis stops at the target.
Short moves never reach maximum velocity or acceleration, so some phases disappear. Try the "Short move" example above to see this.
Why general S-curve generation is hard
The textbook seven-phase profile assumes the axis starts and ends at rest. A robot reacting to a sensor needs to change its target while already moving, possibly while accelerating, and may need to arrive at the target with a specific velocity. Several axes often need to finish at exactly the same moment.
Handling arbitrary start and target states, including non-zero velocity and acceleration, while still finding the time-optimal solution means solving a set of non-linear equations with many special cases. Many implementations fall back to approximations, iterative optimization or restrictions on the input.
Ruckig: the first general S-curve generator
Ruckig's core is the first and nowadays fastest general S-curve trajectory generator on the market. It computes time-optimal, jerk-limited trajectories for arbitrary start and target states in 20 microseconds on a typical CPU, fast enough to recalculate every control cycle at 10 kHz and beyond. See the benchmark and methodology.
By "general" we mean that Ruckig:
- accepts any current position, velocity and acceleration, and any target position, velocity and acceleration;
- always returns the time-optimal solution within the given limits;
- synchronizes multiple degrees of freedom so they finish together;
- runs in real time with a deterministic calculation time, so it can react instantly to new sensor input.