Skip to the content
FixTheRobot Explore Robotics / Manipulator Basics / Theory / 10

Manipulator Basics · Theory · Module 10 of 14

10 — Trajectory Planning

A path says where the robot goes; a trajectory says when. Build cubic, quintic, trapezoidal and S-curve profiles, compare their peak velocity, acceleration and jerk, and see why a straight joint move is not a straight tool move.

  • Advanced
  • About 7 minutes to read
  • 1 linked lab

Commanding a joint to jump to a new angle asks for infinite acceleration. Trajectory planning turns "go from A to B" into smooth, timed set-points that respect the motors' speed, acceleration and jerk limits.

Learning objectives

After this module you should be able to:

  • Distinguish a path (geometry) from a trajectory (geometry plus timing).
  • Derive cubic and quintic polynomial trajectories from boundary conditions.
  • Build trapezoidal and S-curve profiles from velocity, acceleration and jerk limits, and compute their duration.
  • Choose between joint-space and Cartesian-space trajectories and recognise their failure modes.
  • Synchronise several joints so they start and stop together.

Conceptual explanation

A path is a geometric curve in joint or task space. A trajectory is a path with a time law: position, velocity and acceleration as functions of time. Separating the two is useful: a planner finds a collision-free path (Module 13), then time parameterisation makes it as fast as the limits allow.

Profiles for a single joint

Smoothness of common one-dimensional profiles.
ProfileMatches at the endsVelocityAccelerationJerk
Linearpositionjumps at the endsinfinite impulsesundefined
Cubicposition, velocitysmoothjumps at the endsimpulses at the ends
Quinticposition, velocity, accelerationsmoothsmoothfinite
Trapezoidalposition, velocityramp, cruise, ramppiecewise constant (jumps)impulses at the corners
S-curve (double S)position, velocity, accelerationsmoothpiecewise linearbounded, piecewise constant

Jerk matters because acceleration jumps excite vibrations in the arm, the gearbox and the payload. That is why industrial controllers use jerk-limited (S-curve) profiles, and why polynomial trajectories of degree five are popular in research.

Joint space or Cartesian space?

Joint-space trajectories interpolate each joint from start to goal. They are simple, smooth, avoid singularity problems and are easy to keep within joint limits, but the tool follows a curve that depends on the robot. Cartesian trajectories interpolate the tool pose (a straight line and a slerp of orientation) and solve IK along the way. The tool path is exactly what you asked for, but the motion can hit joint limits, pass near singularities (huge joint speeds) or switch IK branches. Robot languages offer both: "move joint" (PTP) and "move linear" (LIN).

Synchronising joints

For a multi-joint move, compute the minimum time each joint needs under its own limits, take the longest, and stretch the others to the same duration. Every joint then starts and stops together, which gives a predictable, reproducible tool path.

Mathematical formulation

Cubic: four coefficients fit four conditions q(0)=q0, q(T)=qf, q˙(0)=v0, q˙(T)=vfq(0) = q_0,\ q(T) = q_f,\ \dot q(0) = v_0,\ \dot q(T) = v_f:

Cubic polynomial
q(t)=a0+a1t+a2t2+a3t3,a2=3Δ−(2v0+vf)TT2,a3=−2Δ+(v0+vf)TT3,Δ=qf−q0q(t) = a_0 + a_1 t + a_2 t^2 + a_3 t^3, \quad a_2 = \frac{3\Delta - (2v_0 + v_f)T}{T^2}, \quad a_3 = \frac{-2\Delta + (v_0 + v_f)T}{T^3}, \quad \Delta = q_f - q_0

Quintic rest to rest (zero velocity and acceleration at both ends), with s=t/Ts = t/T:

Quintic polynomial
q(t)=q0+Δ (10s3−15s4+6s5),q˙max⁡=158ΔT,q¨max⁡=103ΔT2q(t) = q_0 + \Delta\,(10 s^3 - 15 s^4 + 6 s^5), \qquad \dot q_{\max} = \frac{15}{8}\frac{\Delta}{T}, \qquad \ddot q_{\max} = \frac{10}{\sqrt3}\frac{\Delta}{T^2}

Trapezoidal with limits vmax⁡,amax⁡v_{\max}, a_{\max}:

  1. tb=vmax⁡/amax⁡,T=Δvmax⁡+tbif Δ≥vmax⁡2/amax⁡t_b = v_{\max}/a_{\max}, \qquad T = \frac{\Delta}{v_{\max}} + t_b \quad \text{if } \Delta \ge v_{\max}^2/a_{\max}

    Accelerate for tb, cruise, decelerate for tb.

  2. T=2Δ/amax⁡otherwiseT = 2\sqrt{\Delta / a_{\max}} \quad \text{otherwise}

    Triangular profile: the cruise speed is never reached.

S-curve: seven phases of constant jerk ±jmax⁡\pm j_{\max} or zero, so acceleration ramps up and down linearly, limited by amax⁡a_{\max}, and velocity by vmax⁡v_{\max}.

Cartesian line for the tool position: p(t)=p0+s(t)(pf−p0)p(t) = p_0 + s(t)(p_f - p_0) with a smooth s(t)∈[0,1]s(t) \in [0, 1], and orientation by quaternion slerp, then q(t)=IK(p(t),R(t))q(t) = \mathrm{IK}(p(t), R(t)), seeded with q(t−Δt)q(t - \Delta t).

Diagrams

Velocity profiles of four trajectoriesJoint velocity over a 90° move in 2 s. The linear profile jumps to a constant speed at both ends; the cubic and quintic start and stop smoothly, the quintic also with zero acceleration; the trapezoid accelerates, cruises and decelerates.00.511.5200.40.81.21.6time (s)joint velocity (rad/s)LinearCubicQuinticTrapezoidal
The four profiles of the table below, sampled from the engine: same 90° move, same 2 s. Higher peaks mean more required motor speed; steeper slopes mean more acceleration and torque.

Worked examples

Example 1: four profiles for one move

Move one joint by 90° (1.5708 rad) in 2 s, starting and ending at rest:

Computed by the engine (sampled at 2,000 points).
ProfilePeak velocity (rad/s)Peak acceleration (rad/s²)End velocityStart acceleration
Linear0.785∞ (impulse at the ends)0.785 until the last instant∞
Cubic1.1782.3560.0002.356
Quintic1.4732.2670.0000.000
Trapezoidal (blend T/3)1.1781.7670.0001.767

The cubic needs a peak of 1.5Δ/T1.5\Delta/T, the quintic 1.875Δ/T1.875\Delta/T: smoother profiles need slightly higher peak speed for the same duration. The cubic starts with a non-zero acceleration (2.356 rad/s²), a jump from rest; the quintic starts at zero.

Example 2: the fastest move within limits

With vmax⁡=1v_{\max} = 1 rad/s, amax⁡=2a_{\max} = 2 rad/s² and (for the S-curve) jmax⁡=10j_{\max} = 10 rad/s³:

Minimum durations for a 90° move under the same limits.
ProfileMinimum duration (s)Peak velocity (rad/s)Peak acceleration (rad/s²)
Trapezoidal2.0711.0002.000
S-curve2.2711.0002.000
Cubic (scaled to the limits)2.3561.0001.698
Quintic (scaled to the limits)2.9451.0001.045

The trapezoid is the fastest because it runs at the limits most of the time: tb=0.50t_b = 0.50 s and T=1.571/1+0.50=2.071T = 1.571/1 + 0.50 = 2.071 s. The S-curve gives up 0.200 s in exchange for bounded jerk. The polynomials are slower still, because they touch their limits only at one instant.

Example 3: a joint move is not a straight line

For the 2R arm, go from (0.5, −0.2)(0.5,\ -0.2) m to (0.2, 0.5)(0.2,\ 0.5) m. Both points are at the same distance from the base, so in joint space only q1q_1 changes, from -55.1° to 34.9°. With a quintic joint trajectory the tool sweeps an arc that bulges up to 158 mm away from the straight line. A Cartesian line between the same points is feasible (no limit or singularity problems found by the engine).

Example 4: when a Cartesian line fails

A straight line from (0.6,0.1)(0.6, 0.1) m to (−0.6,0.1)(-0.6, 0.1) m passes 0.1 m from the base, the inner edge of the 2R workspace, where the elbow must fold almost completely. The engine finds that the line fails at t=0.96t = 0.96 s: q2 = 172.6 deg is outside [-170, 170] deg. A joint-space move between the same end points has no such problem. Try both in Lab 07.

Interactive experiment

Interactive trajectory profiles (needs JavaScript).

Choose a profile and the curve to plot (position, velocity or acceleration) for a 1.2 rad move: the duration, boundary values and peaks are shown. The S-curve is timed by its limits (1 rad/s, 1.5 rad/s², 6 rad/s³).

Real-world applications

  • Industrial robot languages offer PTP (joint) and LIN/CIRC (Cartesian) moves with jerk-limited profiles and blending between segments.
  • Welding, gluing and painting need Cartesian paths at constant tool speed.
  • Pick and place uses fast joint moves between approach poses and short Cartesian moves for the approach and the retreat (as in the capstone).
  • MoveIt 2 plans a path and then time-parameterises it (for example with time-optimal trajectory generation) under velocity and acceleration limits.

Common mistakes

Sending step set-points

A step demands infinite acceleration; the controller saturates and the arm overshoots or vibrates. Always interpolate.

Ignoring jerk

Trapezoidal profiles have acceleration jumps. On light, flexible arms or with liquids, use S-curves or quintics.

Assuming Cartesian lines are always possible

A line can leave the workspace, cross a singularity or need a joint beyond its limit. Check every interpolated point.

Timing each joint independently

Unsynchronised joints arrive at different times and the tool path changes with speed. Use a common duration.

Key takeaways

  1. Path = geometry; trajectory = geometry + timing.
  2. Cubic matches position and velocity; quintic also matches acceleration (finite jerk).
  3. Trapezoids are time-optimal under v and a limits; S-curves also limit jerk at a small cost in time.
  4. Joint trajectories are robust; Cartesian trajectories control the tool path but must be checked for limits and singularities.

Knowledge check

Write an answer to each question, then reveal the explanation. Your answers stay in your browser.

Question 1

Why does a cubic trajectory have an acceleration jump at the start, starting from rest?

Explanation

A cubic has only four coefficients, used for the two positions and two velocities; nothing forces the initial acceleration to be zero, so it jumps from 0 to 2a₂.

Question 2

A joint must move 1 rad with vmax = 1 rad/s and amax = 4 rad/s². Is the trapezoid triangular?

Explanation

No: vmax²/amax = 0.25 rad < 1 rad, so it reaches cruise speed. tb = 0.25 s and T = 1/1 + 0.25 = 1.25 s.

Question 3

Name two ways a Cartesian straight-line move can fail that a joint move would not.

Explanation

Any two of: an intermediate point is out of reach, a joint limit is exceeded along the way, it passes through a singularity (joint speeds explode), or the IK branch flips.

Question 4

What does an S-curve add to a trapezoid, and what does it cost?

Explanation

A jerk limit (smooth acceleration), so less vibration. It takes slightly longer to complete the same move.

Practise it in the labs

Then test yourself in practice exercises and challenge mode.

References and further reading

  • L. Biagiotti and C. Melchiorri, Trajectory Planning for Automatic Machines and Robots, Springer, 2008.
  • K. M. Lynch and F. C. Park, Modern Robotics, Cambridge, 2017, chapter 9.
  • T. Kunz and M. Stilman, "Time-optimal trajectory generation for path following with bounded acceleration and velocity", Robotics: Science and Systems, 2012.