Trajectory Planning in Joint Space

Published on 2026-11-04·v1.0

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 θi,min⁡≤θi≤θi,max⁡\theta_{i,\min}\le\theta_i\le\theta_{i,\max} 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 θ(s)\theta(s) with s∈[0,1]s\in[0,1] and a time scaling s(t)s(t) with t∈[0,T]t\in[0,T]. For the straight line in joint space,

q(t)=q0+s(t) D,q˙=s˙ D,q¨=s¨ D,D=qf−q0.q(t)=q_0+s(t)\,D,\qquad \dot q=\dot s\,D,\qquad \ddot q=\ddot s\,D,\qquad D=q_f-q_0.

If every joint uses the same s(t)s(t), the joints start and stop together and the configuration stays on the straight segment between q0q_0 and qfq_f.

Cubic polynomials

A cubic q(t)=c0+c1t+c2t2+c3t3q(t)=c_0+c_1t+c_2t^2+c_3t^3 has four coefficients, enough for position and velocity at both ends: q(0)=q0q(0)=q_0, q˙(0)=v0\dot q(0)=v_0, q(T)=qfq(T)=q_f, q˙(T)=vf\dot q(T)=v_f. Solving the four linear equations (done with SymPy):

c0=q0,c1=v0,c2=3D−(2v0+vf)TT2,c3=−2D+(v0+vf)TT3.c_0=q_0,\quad c_1=v_0,\quad c_2=\frac{3D-(2v_0+v_f)T}{T^2},\quad c_3=\frac{-2D+(v_0+v_f)T}{T^3}.

These match equations (9.26) to (9.29) of Modern Robotics. From rest to rest (v0=vf=0v_0=v_f=0) this is s(τ)=3τ2−2τ3s(\tau)=3\tau^2-2\tau^3 with τ=t/T\tau=t/T, and

q˙max⁡=3D2T at t=T2,q¨(0)=6DT2,q¨(T)=−6DT2,q...=−12DT3.\dot q_{\max}=\frac{3D}{2T}\ \text{at}\ t=\tfrac T2,\qquad \ddot q(0)=\frac{6D}{T^2},\qquad \ddot q(T)=-\frac{6D}{T^2},\qquad \dddot q=-\frac{12D}{T^3}.

The acceleration is largest at the ends, where the joint was at rest a moment before. It jumps from 00 to 6D/T26D/T^2, 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, q¨(0)=a0\ddot q(0)=a_0 and q¨(T)=af\ddot q(T)=a_f. The solution keeps c0=q0c_0=q_0, c1=v0c_1=v_0, c2=a0/2c_2=a_0/2 and

c3=20D−(8vf+12v0)T−(3a0−af)T22T3,c4=−30D+(14vf+16v0)T+(3a0−2af)T22T4,c5=12D−6(vf+v0)T−(a0−af)T22T5.\begin{aligned} c_3&=\frac{20D-(8v_f+12v_0)T-(3a_0-a_f)T^2}{2T^3},\\ c_4&=\frac{-30D+(14v_f+16v_0)T+(3a_0-2a_f)T^2}{2T^4},\\ c_5&=\frac{12D-6(v_f+v_0)T-(a_0-a_f)T^2}{2T^5}. \end{aligned}

From rest to rest with zero end accelerations, s(τ)=10τ3−15τ4+6τ5s(\tau)=10\tau^3-15\tau^4+6\tau^5, and

q˙max⁡=15D8T,∣q¨∣max⁡=10D3 T2 at τ=3∓36,q...(0)=60DT3.\dot q_{\max}=\frac{15D}{8T},\qquad \lvert\ddot q\rvert_{\max}=\frac{10D}{\sqrt3\,T^2}\ \text{at}\ \tau=\tfrac{3\mp\sqrt3}{6},\qquad \dddot q(0)=\frac{60D}{T^3}.

The acceleration now starts at zero, so it is continuous at the ends. The jerk still jumps there, from 00 to 60D/T360D/T^3, but it is finite. The cost is a peak velocity 25%25\% higher than the cubic's. Both closed forms agree with the CubicTimeScaling and QuinticTimeScaling functions of the Modern Robotics code library (s=0.216s=0.216 and 0.163080.16308 at t=0.6t=0.6, T=2T=2).

Trapezoidal velocity profiles

The trapezoid accelerates at a constant aa for a blend time tbt_b, cruises at v=a tbv=a\,t_b, and decelerates at −a-a for the last tbt_b. 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 v (T−tb)v\,(T-t_b), so for a given D>0D>0, TT and aa,

tb=T2−a2T2−4aD2a,v=a tb.t_b=\frac T2-\frac{\sqrt{a^2T^2-4aD}}{2a},\qquad v=a\,t_b.

Feasibility. The square root is real only if

a≥4DT2.a\ge\frac{4D}{T^2}.

At equality tb=T/2t_b=T/2, the cruise phase vanishes, and the profile is a triangle with peak velocity 2D/T2D/T. With less acceleration, no profile of this family covers DD in time TT. The cruise velocity is then always in the window D/T<v≤2D/TD/T<v\le2D/T. In the normalized form of Modern Robotics, with D=1D=1, these read aT2≥4aT^2\ge4 and 1<vT≤21<vT\le2.

Minimum time. Given limits vv and aa, the trapezoid reaches vv only if v2/a≤Dv^2/a\le D, and then

T=Dv+va.T=\frac Dv+\frac va.

Otherwise the profile is a triangle that never reaches vv, with T=2D/aT=2\sqrt{D/a}. Modern Robotics notes that, for constant velocity and acceleration limits, the trapezoid that uses the largest allowed vv and aa is the fastest straight-line motion. Its acceleration jumps four times, at 00, tbt_b, T−tbT-t_b and TT. The S-curve profile adds constant-jerk phases to remove those jumps.

Several joints

On a straight joint-space line, joint ii moves DiD_i with q˙i=s˙ Di\dot q_i=\dot s\,D_i and q¨i=s¨ Di\ddot q_i=\ddot s\,D_i. The limits on ss are therefore

s˙max⁡=min⁡ivi∣Di∣,s¨max⁡=min⁡iai∣Di∣,\dot s_{\max}=\min_i\frac{v_i}{\lvert D_i\rvert},\qquad \ddot s_{\max}=\min_i\frac{a_i}{\lvert D_i\rvert},

and the duration is that of a unit trapezoid with these limits. The joint that is slowest relative to its distance sets TT, 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 0∘0^\circ to 90∘90^\circ in T=2T=2 s. The cubic is q=67.5t2−22.5t3q=67.5t^2-22.5t^3, the quintic q=112.5t3−84.375t4+16.875t5q=112.5t^3-84.375t^4+16.875t^5, and the trapezoid uses a=180 ∘/s2a=180\ ^\circ/\text{s}^2, giving tb=0.2929t_b=0.2929 s and v=52.72 ∘/sv=52.72\ ^\circ/\text{s}. Sampled from the script, in degrees and seconds:

text
t | 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 67.5 ∘/s67.5\ ^\circ/\text{s} and 135 ∘/s2135\ ^\circ/\text{s}^2, the quintic at 84.375 ∘/s84.375\ ^\circ/\text{s} and 129.90 ∘/s2129.90\ ^\circ/\text{s}^2 (at t=0.423t=0.423 and 1.5771.577 s, between the grid rows above), and the trapezoid at 52.72 ∘/s52.72\ ^\circ/\text{s} and 180 ∘/s2180\ ^\circ/\text{s}^2. 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 −337.5-337.5 to 675 ∘/s3675\ ^\circ/\text{s}^3; the cubic's is −135-135 inside the motion, plus the jumps in acceleration at both ends.

Example 2: feasibility and minimum time

Same joint and distance, with assumed limits ∣q˙∣≤90 ∘/s\lvert\dot q\rvert\le90\ ^\circ/\text{s} and ∣q¨∣≤180 ∘/s2\lvert\ddot q\rvert\le180\ ^\circ/\text{s}^2.

For T=2T=2 s the trapezoid needs a≥4⋅90/22=90 ∘/s2a\ge4\cdot90/2^2=90\ ^\circ/\text{s}^2:

text
a (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 v=1.5 D/Tv=1.5\,D/T is the default of the Robotics Toolbox's trapezoidal_func; its documented example (1 to 2 in 5 s, tb=1.667t_b=1.667 s, acceleration 0.180.18) matches the formula.

The minimum duration of each profile, with the binding limit:

text
profile 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 v2/a=45≤90v^2/a=45\le90, so it cruises, with tb=0.5t_b=0.5 s. Without the velocity limit, the triangle would take 290/180=1.4142\sqrt{90/180}=1.414 s but would peak at 127.3 ∘/s127.3\ ^\circ/\text{s}. The cubic at T=1.5T=1.5 s would need 240 ∘/s2240\ ^\circ/\text{s}^2, beyond the limit.

Example 3: three joints, one duration

Joints move D=(90,−45,30)∘D=(90,-45,30)^\circ with assumed limits v=(90,60,120) ∘/sv=(90,60,120)\ ^\circ/\text{s} and a=(180,90,240) ∘/s2a=(180,90,240)\ ^\circ/\text{s}^2. Alone, each could finish in 1.51.5, 1.4171.417 and 0.7070.707 s (joint 3 as a triangle). Together, s˙max⁡=min⁡(1, 1.333, 4)=1 s−1\dot s_{\max}=\min(1,\,1.333,\,4)=1\ \text{s}^{-1} and s¨max⁡=min⁡(2, 2, 8)=2 s−2\ddot s_{\max}=\min(2,\,2,\,8)=2\ \text{s}^{-2}, so T=1+0.5=1.5T=1+0.5=1.5 s. The peaks are (90,−45,30) ∘/s(90,-45,30)\ ^\circ/\text{s} and (180,−90,60) ∘/s2(180,-90,60)\ ^\circ/\text{s}^2: 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 0,30,70,60∘0,30,70,60^\circ at t=0,1,2,3t=0,1,2,3 s, starting and ending at rest. The segment slopes are 3030, 4040 and −10 ∘/s-10\ ^\circ/\text{s}. 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 3535 at t=1t=1 and 00 at t=2t=2.

With these velocities, the first cubic segment is q=55t2−25t3q=55t^2-25t^3: at t=1t=1 it gives 30∘30^\circ, 35 ∘/s35\ ^\circ/\text{s}, and acceleration 110−150=−40 ∘/s2110-150=-40\ ^\circ/\text{s}^2, while the next segment starts at +100+100. The clamped spline has the pieces 40t2−10t340t^2-10t^3, 30+50t+10t2−20t330+50t+10t^2-20t^3 and 70+10t−50t2+30t370+10t-50t^2+30t^3, local time in each, and SciPy's CubicSpline with bc_type=((1, 0.0), (1, 0.0)) agrees with them to 3×10−143\times10^{-14}. 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 tb=0.2t_b=0.2 s centered on each via, so it starts at t=−0.2t=-0.2 and ends at t=3.2t=3.2.

text
method 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 t=2t=2 is +10 ∘/s+10\ ^\circ/\text{s}, so the joint keeps rising to 70.535∘70.535^\circ at t=2.111t=2.111 before returning, while A, with zero velocity at the reversal, never exceeds 70∘70^\circ. C buys continuous acceleration by forcing it to zero at every via, and pays with a peak jerk inside the segments of 1560 ∘/s31560\ ^\circ/\text{s}^3 against 660660 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 Δv tb/4\Delta v\,t_b/4, where Δv\Delta v is the change of slope: (40−30)(0.2)/4=0.5∘(40-30)(0.2)/4=0.5^\circ at t=1t=1 and (−10−40)(0.2)/4=−2.5∘(-10-40)(0.2)/4=-2.5^\circ at t=2t=2. Its lower peaks are not a fair win, because it takes 3.43.4 s instead of 33.

Example 5: a straight line in joint space is not straight in task space

A planar 2R arm with assumed link lengths L1=L2=1L_1=L_2=1 m and relative joint angles, as in forward-kinematics-of-serial-manipulators, has its tip at (cos⁡θ1+cos⁡(θ1+θ2), sin⁡θ1+sin⁡(θ1+θ2))(\cos\theta_1+\cos(\theta_1+\theta_2),\ \sin\theta_1+\sin(\theta_1+\theta_2)). Moving along the joint line from (0∘,90∘)(0^\circ,90^\circ) to (90∘,0∘)(90^\circ,0^\circ) takes the tip from (1,1)(1,1) to (0,2)(0,2):

text
s 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 0.2930.293 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 TT works for a trapezoid if the acceleration is high enough." The condition is a≥4D/T2a\ge4D/T^2; Example 2 shows a=60a=60 failing for T=2T=2.
  • "The quintic is gentler in every way." Its peak velocity is 25%25\% 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 0.535∘0.535^\circ 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, 1560 ∘/s31560\ ^\circ/\text{s}^3.
  • "A blended via point is passed exactly." The joint passes near it, here off by Δv tb/4\Delta v\,t_b/4.

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 1.5D/T1.5D/T and 6D/T26D/T^2, 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 15D/(8T)15D/(8T). The trapezoid exists only when a≥4D/T2a\ge4D/T^2, cruises at tb at_b\,a with tb=T/2−a2T2−4aD/(2a)t_b=T/2-\sqrt{a^2T^2-4aD}/(2a), and with the largest allowed vv and aa 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