Trajectory Planning in Joint Space
Learning Objectives
- Split a trajectory into a path and a time scaling, and say what a straight line in joint space does and does not give in task space.
- Solve the cubic and quintic polynomials for their boundary conditions, and compute their peak velocity, acceleration and jerk.
- Build a trapezoidal velocity profile, state its feasibility condition, and find the minimum time under velocity and acceleration limits.
- Synchronize several joints so that the slowest one sets the duration.
- Compare via-point methods by the continuity they give, and spot a missed via or an overshoot.
Context & Motivation
Inverse kinematics gives configurations, not motion. A controller needs a target at every sample, and Modern Robotics (Lynch and Park, Chapter 9) opens with exactly this: during motion the controller is fed a steady stream of goal positions and velocities to track. A trajectory is that stream, and its speed sets the torques. the-manipulator-equation-inertia-coriolis-gravity showed that halving the duration of a motion multiplied the inertia and velocity torques by 4 while leaving gravity unchanged.
This lesson works in joint space: each joint gets a function of time, and a joint controller such as the one in independent-joint-control-and-pid tracks it. Modern Robotics contrasts this with straight lines in task space. In joint space, limits of the form form a convex set, so a straight line between two allowed configurations stays allowed. A straight line in task space can pass near a kinematic singularity, where the joint velocities may become very large, and can leave the reachable workspace between two reachable endpoints. The price of joint space is that the tool does not move along a straight line, which Example 5 measures.
All numbers below are for an assumed joint with assumed limits. Angles are in degrees and time in seconds.
Core Theory
Path and time scaling
Modern Robotics writes a trajectory as a path with and a time scaling with . For the straight line in joint space,
If every joint uses the same , the joints start and stop together and the configuration stays on the straight segment between and .
Cubic polynomials
A cubic has four coefficients, enough for position and velocity at both ends: , , , . Solving the four linear equations (done with SymPy):
These match equations (9.26) to (9.29) of Modern Robotics. From rest to rest () this is with , and
The acceleration is largest at the ends, where the joint was at rest a moment before. It jumps from to , so the jerk is infinite there, which Modern Robotics notes may cause vibration.
Quintic polynomials
Six coefficients allow the accelerations at both ends to be set as well, and . The solution keeps , , and
From rest to rest with zero end accelerations, , and
The acceleration now starts at zero, so it is continuous at the ends. The jerk still jumps there, from to , but it is finite. The cost is a peak velocity higher than the cubic's. Both closed forms agree with the CubicTimeScaling and QuinticTimeScaling functions of the Modern Robotics code library ( and at , ).
Trapezoidal velocity profiles
The trapezoid accelerates at a constant for a blend time , cruises at , and decelerates at for the last . Position is a parabola, a line and a parabola, which is why the older name is "linear segment with parabolic blends" (LSPB). The distance covered is , so for a given , and ,
Feasibility. The square root is real only if
At equality , the cruise phase vanishes, and the profile is a triangle with peak velocity . With less acceleration, no profile of this family covers in time . The cruise velocity is then always in the window . In the normalized form of Modern Robotics, with , these read and .
Minimum time. Given limits and , the trapezoid reaches only if , and then
Otherwise the profile is a triangle that never reaches , with . Modern Robotics notes that, for constant velocity and acceleration limits, the trapezoid that uses the largest allowed and is the fastest straight-line motion. Its acceleration jumps four times, at , , and . The S-curve profile adds constant-jerk phases to remove those jumps.
Several joints
On a straight joint-space line, joint moves with and . The limits on are therefore
and the duration is that of a unit trapezoid with these limits. The joint that is slowest relative to its distance sets , and the others are slowed to arrive with it.
Via points
A task often specifies intermediate configurations at given times. The common methods differ in what is continuous where the segments meet:
| Method | Passes the vias | Continuous at the vias | At start and end from rest |
|---|---|---|---|
| Cubic segments with chosen via velocities | yes | velocity | acceleration jumps |
| Cubic spline (velocities solved for) | yes | acceleration | acceleration jumps |
| Quintic segments with chosen velocities and accelerations | yes | acceleration | acceleration can be 0 |
| Stop at every via | yes | velocity, which is 0 | acceleration jumps |
| Linear segments with parabolic blends | no, passes near | velocity | acceleration jumps |
Modern Robotics states the first row and its generalization to quintics, and notes that a via velocity left unspecified can be chosen by a heuristic from the neighboring vias. The spline row is the clamped spline of splines: with the end velocities fixed at zero, the whole curve comes out of one tridiagonal system, and in exchange the end accelerations are whatever that system gives. In the blend row the parabola replaces the corner, so the joint never reaches the via; the Robotics Toolbox documents this for its mstraj function, which says that with a blend "the via point is not actually reached".
Book vs today. The Robotics Toolbox for Python now calls the trapezoid trapezoidal and marks the older lspb as deprecated. In ROS 2, the ros2_control joint trajectory controller (documentation for the Lyrical distribution, 2026) chooses the interpolation from what each waypoint carries: linear if only positions are given (continuous position, discouraged), cubic if velocities are given (continuous velocity), quintic if accelerations are given too (continuous acceleration).
Worked Examples
Example 1: one joint, three profiles
A joint moves from to in s. The cubic is , the quintic , and the trapezoid uses , giving s and . Sampled from the script, in degrees and seconds:
textt | cubic: q qd qdd | quintic: q qd qdd | trapezoid: q qd qdd 0.00 | 0.00 0.00 135.00 | 0.00 0.00 0.00 | 0.00 0.00 180.00 0.25 | 3.87 29.53 101.25 | 1.44 16.15 110.74 | 5.62 45.00 180.00 0.50 | 14.06 50.62 67.50 | 9.32 47.46 126.56 | 18.64 52.72 0.00 0.75 | 28.48 63.28 33.75 | 24.77 74.16 79.10 | 31.82 52.72 0.00 1.00 | 45.00 67.50 0.00 | 45.00 84.38 0.00 | 45.00 52.72 0.00 1.25 | 61.52 63.28 -33.75 | 65.23 74.16 -79.10 | 58.18 52.72 0.00 1.50 | 75.94 50.62 -67.50 | 80.68 47.46 -126.56 | 71.36 52.72 0.00 1.75 | 86.13 29.53 -101.25 | 88.56 16.15 -110.74 | 84.38 45.00 -180.00 2.00 | 90.00 0.00 -135.00 | 90.00 0.00 0.00 | 90.00 0.00 -180.00
On a grid of 200001 points, the cubic peaks at and , the quintic at and (at and s, between the grid rows above), and the trapezoid at and . Each trades one peak against another: the trapezoid has the lowest velocity and the highest acceleration, the quintic the opposite. The quintic's jerk runs from to ; the cubic's is inside the motion, plus the jumps in acceleration at both ends.
Example 2: feasibility and minimum time
Same joint and distance, with assumed limits and .
For s the trapezoid needs :
texta (deg/s^2) t_b (s) v (deg/s) note 60 - - infeasible: 60 < 90 90 1.0000 90.00 triangle, v = 2D/T 101.25 0.6667 67.50 v = 1.5 D/T 180 0.2929 52.72 360 0.1340 48.23 v tends to D/T = 45
The row is the default of the Robotics Toolbox's trapezoidal_func; its documented example (1 to 2 in 5 s, s, acceleration ) matches the formula.
The minimum duration of each profile, with the binding limit:
textprofile T_min (s) binding limit peak qd peak |qdd| cubic 1.7321 acceleration 77.94 180.00 quintic 1.8750 velocity 90.00 147.80 trapezoid 1.5000 both 90.00 180.00
The trapezoid needs , so it cruises, with s. Without the velocity limit, the triangle would take s but would peak at . The cubic at s would need , beyond the limit.
Example 3: three joints, one duration
Joints move with assumed limits and . Alone, each could finish in , and s (joint 3 as a triangle). Together, and , so s. The peaks are and : joint 1 is at both its limits, joint 2 at its acceleration limit, joint 3 far below both.
Example 4: four via points, six methods
One joint passes at s, starting and ending at rest. The segment slopes are , and . The via-velocity rule used here (one simple heuristic, not the only one) takes the average of the two neighboring slopes when they have the same sign and zero when the joint reverses, which gives at and at .
With these velocities, the first cubic segment is : at it gives , , and acceleration , while the next segment starts at . The clamped spline has the pieces , and , local time in each, and SciPy's CubicSpline with bc_type=((1, 0.0), (1, 0.0)) agrees with them to . Methods C and D are quintic segments; D takes its via velocities and accelerations from the spline and sets the end accelerations to 0. Method F uses straight segments with parabolic blends of half-width s centered on each via, so it starts at and ends at .
textmethod q at t=1,2 qd at t=1,2 qdd jump at t=1 qdd jump at t=2 qdd at start peak |qd| peak |qdd| A cubic, rule velocities 30, 70 35, 0 -40 -> 100 -170 -> -60 110 53.5 170.0 B clamped cubic spline 30, 70 50, 10 none (20) none (-100) 80 51.7 100.0 C quintic, rule velocities, qdd 0 30, 70 35, 0 none (0) none (0) 0 61.7 166.4 D quintic, spline values 30, 70 50, 10 none (20) none (-100) 0 51.7 101.0 E cubic, stop at every via 30, 70 0, 0 -180 -> 240 -240 -> -60 180 60.0 240.0 F lines with parabolic blends 30.5, 67.5 35, 15 blend: 25 blend: -125 75 40.0 125.0
The spline (B) is smooth inside but goes past the data: its velocity at is , so the joint keeps rising to at before returning, while A, with zero velocity at the reversal, never exceeds . C buys continuous acceleration by forcing it to zero at every via, and pays with a peak jerk inside the segments of against for D. Only C and D start and stop without an acceleration step. Stopping at every via (E) is the simplest and needs the largest acceleration. F misses each interior via by , where is the change of slope: at and at . Its lower peaks are not a fair win, because it takes s instead of .
Example 5: a straight line in joint space is not straight in task space
A planar 2R arm with assumed link lengths m and relative joint angles, as in forward-kinematics-of-serial-manipulators, has its tip at . Moving along the joint line from to takes the tip from to :
texts theta (deg) tip (m) distance from the straight tip segment (m) 0.00 (0.0, 90.0) (1.0000, 1.0000) 0.0000 0.25 (22.5, 67.5) (0.9239, 1.3827) 0.2168 0.50 (45.0, 45.0) (0.7071, 1.7071) 0.2929 0.75 (67.5, 22.5) (0.3827, 1.9239) 0.2168 1.00 (90.0, 0.0) (0.0000, 2.0000) 0.0000
The tip bulges m away from the straight line, the largest deviation on a fine grid. A different time scaling would change when the tip is at each point, not where the points are.
Common Misconceptions & Pitfalls
- "Any works for a trapezoid if the acceleration is high enough." The condition is ; Example 2 shows failing for .
- "The quintic is gentler in every way." Its peak velocity is higher than the cubic's (Example 1), so a velocity-limited joint takes longer with it (Example 2).
- "A cubic spline is the smoothest choice, so it is the best." It overshot the data by in Example 4, and with zero end velocities it still starts with an acceleration step.
- "Continuous acceleration means low jerk." Method C is continuous in acceleration and had the largest jerk inside the segments, .
- "A blended via point is passed exactly." The joint passes near it, here off by .
Summary
A joint-space trajectory is a straight path in configuration space plus a time scaling. The cubic fits position and velocity at both ends, peaks at and , and starts with an acceleration step. The quintic also fixes the end accelerations, which removes that step at the price of a peak velocity of . The trapezoid exists only when , cruises at with , and with the largest allowed and it is, as Modern Robotics notes, the fastest straight-line motion. With several joints, the most constrained one sets the duration. Through via points, cubic segments give continuous velocity, splines and quintic segments continuous acceleration, and parabolic blends give continuous velocity but miss the via.
Documentation Links
- Lynch and Park (2017, preprint 2019): Modern Robotics, Chapter 9 Trajectory Generation
- Lynch and Park: Modern Robotics book resources, 9.3 Polynomial via point trajectories
- NxRLab: Modern Robotics code library
- Corke: Robotics Toolbox for Python, Trajectories
- ros2_control: joint trajectory controller, trajectory representation (Lyrical)
- SciPy: scipy.interpolate.CubicSpline