ROB-300 · Lesson 8 of 12 · 37 min
Trajectory generation and time scaling
A controller tracks a reference; the quality of that reference largely decides how well the robot moves. If the reference jumps from one position to another, the controller sees a huge error, demands torques the motors cannot deliver, saturates, winds up and overshoots, as lesson 4 showed. If instead the reference moves smoothly, with velocity and acceleration the actuators can supply, the controller only has to correct small deviations, and model-based feedforward (lesson 9) can supply nearly all the torque in advance. Trajectory generation turns a list of goals, 'move joint 2 from 0.3 to 1.2 rad', 'pass through these via points', 'arrive at this pose with zero velocity', into time functions \( q_d(t), \dot{q}_d(t), \ddot{q}_d(t) \) that respect limits on velocity, acceleration, jerk and torque. This lesson covers polynomial trajectories, trapezoidal and jerk-limited velocity profiles, multi-joint synchronization, via points and time scaling.
Path and trajectory
A path is a geometric curve, the set of configurations the robot passes through, without timing. A trajectory is a path with a time law attached. Separating the two is useful: a path can be written as \( \mathbf{q}(s) \) for a path parameter s running from 0 to 1, and a time scaling s(t) then decides how fast the robot moves along it. For a straight line in joint space from \( \mathbf{q}_0 \) to \( \mathbf{q}_f \), \( \mathbf{q}(s) = \mathbf{q}_0 + s(\mathbf{q}_f - \mathbf{q}_0) \), and all joints start and stop together. Velocities and accelerations follow by the chain rule: \( \dot{\mathbf{q}} = \mathbf{q}'(s)\dot{s} \) and \( \ddot{\mathbf{q}} = \mathbf{q}'(s)\ddot{s} + \mathbf{q}''(s)\dot{s}^2 \). Choosing s(t) well is most of the work.
Cubic polynomial trajectories
The simplest smooth time scaling is a cubic polynomial, \( q(t) = a_0 + a_1t + a_2t^2 + a_3t^3 \), whose four coefficients can satisfy four boundary conditions: position and velocity at the start and at the end. For a rest-to-rest move from \( q_0 \) to \( q_f \) in time T, with \( \Delta = q_f - q_0 \):
Velocity is a parabola peaking at mid-move at \( 1.5\Delta/T \); acceleration falls linearly from \( 6\Delta/T^2 \) at the start to \( -6\Delta/T^2 \) at the end. The weakness is that acceleration jumps from zero to \( 6\Delta/T^2 \) at the start and from \( -6\Delta/T^2 \) to zero at the end. These jumps mean infinite jerk, which excites structural vibration, a problem for flexible joints and for robots carrying liquids or delicate parts.
Worked problem
Cubic move of a joint
A joint must move from 0.2 rad to 1.4 rad in 1.5 s, starting and ending at rest. Find the cubic coefficients, the peak velocity and the peak acceleration.
Show solution
- \( \Delta = 1.2 \) rad, T = 1.5 s.
- \( a_2 = 3\Delta/T^2 = 3.6/2.25 = 1.6 \); \( a_3 = -2\Delta/T^3 = -2.4/3.375 = -0.711 \).
- Peak velocity \( 1.5\Delta/T = 1.2 \) rad/s at t = 0.75 s.
- Peak acceleration \( 6\Delta/T^2 = 3.2 \) rad/s² at the start and end.
Answer: \( q(t) = 0.2 + 1.6t^2 - 0.711t^3 \), with peak velocity 1.2 rad/s and peak acceleration 3.2 rad/s² (jumping instantly from 0 to 3.2 rad/s² at the start).
Quintic polynomials
A fifth-order polynomial has six coefficients, enough to fix position, velocity and acceleration at both ends. For rest-to-rest motion with zero boundary accelerations, written with the normalized time \( \sigma = t/T \):
Acceleration now starts and ends at zero, so jerk is finite and the motion is much smoother. The price is higher peaks for the same duration: peak velocity \( 1.875\Delta/T \) and peak acceleration \( 10\Delta/(\sqrt{3}T^2) \approx 5.77\Delta/T^2 \), occurring at \( \sigma = 0.5 \mp 0.289 \). Quintic profiles are standard for smooth point-to-point moves, and in general form, with nonzero boundary velocities and accelerations, they join segments smoothly.
Worked problem
Quintic versus cubic
For the same 1.2 rad move in 1.5 s, find the quintic's peak velocity and acceleration and compare with the cubic.
Show solution
- Peak velocity: \( 1.875 \times 1.2/1.5 = 1.5 \) rad/s (cubic: 1.2).
- Peak acceleration: \( 5.77 \times 1.2/2.25 = 3.08 \) rad/s² (cubic: 3.2), reached at t = 0.317 s rather than t = 0.
- Boundary acceleration: 0 (cubic: ±3.2).
Answer: The quintic needs 25 % more peak velocity but slightly less peak acceleration, and it builds acceleration smoothly from zero. For a flexible arm the reduced vibration usually outweighs the higher velocity.
Trapezoidal velocity profiles
Industrial motion controllers mostly use trapezoidal velocity profiles: accelerate at a constant rate \( a_{\max} \), cruise at \( v_{\max} \), decelerate at \( a_{\max} \). Each phase uses the actuator fully, so for given velocity and acceleration limits the trapezoid gives the minimum time among profiles that respect those limits. The acceleration time is \( t_a = v_{\max}/a_{\max} \), and the distance covered while accelerating and decelerating together is \( v_{\max}^2/a_{\max} \). If the move is longer than this, the profile has a cruise phase and the total time is
If the move is shorter, the joint never reaches \( v_{\max} \); the profile becomes a triangle with peak velocity \( \sqrt{\Delta a_{\max}} \) and total time \( 2\sqrt{\Delta/a_{\max}} \).
Worked problem
Trapezoidal move time
A joint has limits \( v_{\max} \) = 2 rad/s and \( a_{\max} \) = 8 rad/s². Find the move time for Δ = 1.2 rad and for Δ = 0.3 rad.
Show solution
- Threshold distance: \( v_{\max}^2/a_{\max} = 4/8 = 0.5 \) rad.
- Δ = 1.2 rad > 0.5: trapezoid. \( T = 1.2/2 + 2/8 = 0.6 + 0.25 = 0.85 \) s, with 0.25 s accelerating, 0.35 s cruising, 0.25 s decelerating.
- Δ = 0.3 rad < 0.5: triangle. Peak velocity \( \sqrt{0.3 \times 8} = 1.55 \) rad/s; \( T = 2\sqrt{0.3/8} = 0.387 \) s.
Answer: 0.85 s for 1.2 rad and 0.39 s for 0.3 rad. For comparison, a cubic over 0.85 s would need peak velocity 2.12 rad/s, exceeding the limit, so the trapezoid achieves the minimum time within these limits.
Jerk-limited (S-curve) profiles
The trapezoid's acceleration jumps instantly between 0 and \( \pm a_{\max} \), with infinite jerk at four instants, which excites vibration much like the cubic's end jumps. Jerk-limited profiles, often called S-curves, ramp the acceleration up and down at a maximum jerk \( j_{\max} \), giving seven phases: jerk up, constant acceleration, jerk down, cruise, and the mirror image. Each acceleration ramp takes \( a_{\max}/j_{\max} \), and the total time increases by about that much over the trapezoid. A useful rule from vibration theory: if the acceleration ramp time equals the period of a structural mode, the profile excites that mode very little. Commercial motion controllers expose jerk as a parameter for this reason.
Worked problem
Cost of jerk limiting
The 1.2 rad trapezoidal move above is made jerk-limited with \( j_{\max} \) = 160 rad/s³. Estimate the extra time and relate it to a 40 Hz joint resonance.
Show solution
- Acceleration ramp time \( a_{\max}/j_{\max} = 8/160 = 0.05 \) s.
- For symmetric S-curves the move time grows by about one ramp time: T ≈ 0.85 + 0.05 = 0.90 s.
- The 40 Hz resonance has period 0.025 s; a ramp of 0.05 s is two periods, a multiple of the period, which strongly reduces residual vibration.
Answer: About 0.05 s longer (6 %), and because the ramp spans a whole number of resonance periods, the move excites the 40 Hz mode very little, so the arm settles faster at the end. The overall cycle can be quicker even though the motion itself is slower.
Synchronizing joints
For a multi-joint move, each joint could follow its own minimum-time profile, but then they finish at different times and the tool follows an odd curve. Usually all joints are synchronized: find the move time each joint would need on its own, take the longest, and slow the others to match. With a common normalized time scaling s(t), every joint follows \( q_i(t) = q_{0i} + \Delta_i s(t) \), so the robot moves in a straight line in joint space and all joints start and stop together. The slowest joint, the one with the longest individual time, is called the limiting or leading joint.
Worked problem
Synchronized three-joint move
Three joints with \( v_{\max} \) = 2 rad/s and \( a_{\max} \) = 8 rad/s² must move by 1.2, 0.3 and −0.8 rad. Find the synchronized trapezoidal move time and the peak velocity of each joint.
Show solution
- Individual times: joint 1 0.85 s; joint 2 0.387 s; joint 3: 0.8 > 0.5, so \( T = 0.4 + 0.25 = 0.65 \) s.
- Limiting joint: joint 1, T = 0.85 s. Use joint 1's profile shape for all: \( t_a \) = 0.25 s.
- Peak velocities scale with Δ: joint 1 2.0 rad/s; joint 2 \( 2 \times 0.3/1.2 = 0.5 \) rad/s; joint 3 \( -2 \times 0.8/1.2 = -1.33 \) rad/s.
Answer: All three joints take 0.85 s with peak speeds 2.0, 0.5 and −1.33 rad/s and peak accelerations 8, 2 and −5.33 rad/s². Only joint 1 reaches its limits; the others move gently, which helps both tracking accuracy and energy use.
Via points and splines
Many tasks need the robot to pass through intermediate points without stopping: around an obstacle, along a weld seam, through a sequence of camera viewpoints. Stopping at each via point wastes time and causes jerky motion. Instead, a spline joins polynomial segments so that position, velocity and acceleration are continuous at each via point. A natural cubic spline through N points has continuous acceleration and is found by solving a tridiagonal linear system for the velocities at the via points; quintic splines also make jerk continuous. Industrial controllers often use blending instead: each straight segment is followed until close to the via point, then a parabolic or polynomial blend rounds the corner, with a programmable blend radius that trades accuracy at the via point against speed.
Joint space versus Cartesian space
Everything above works in joint space, which is simple and naturally respects joint limits, but the tool path between endpoints is a curve that depends on the robot's geometry. Many tasks, such as inserting a peg, welding a seam or moving through a narrow gap, require the tool to follow a straight line or a specified curve in Cartesian space. Then the path is defined in task space, for example \( \mathbf{x}(s) = \mathbf{x}_0 + s(\mathbf{x}_f - \mathbf{x}_0) \) for position with spherical linear interpolation (slerp, ROB-210) for orientation, and inverse kinematics (ROB-210) converts each point to joint angles. Cartesian paths can pass near singularities, where joint velocities become very large for modest tool speed, so the time scaling must be slowed there or the path changed.
Time scaling under torque limits
Velocity and acceleration limits are proxies; the true limits are the motor torques, which depend on the dynamics of lessons 2 and 3. For a fixed path, the manipulator equation can be written in terms of s, and the torque required becomes \( \boldsymbol{\tau} = \mathbf{m}(s)\ddot{s} + \mathbf{c}(s)\dot{s}^2 + \mathbf{g}(s) \). Each joint's torque limit then bounds \( \ddot{s} \) as a function of s and \( \dot{s} \). Time-optimal path parameterization algorithms find the fastest s(t) that keeps every joint inside its torque limit at every point, giving bang-bang behavior where at least one joint is always at its limit. A simpler, widely used approach is uniform time scaling: plan a trajectory, check the torques with inverse dynamics, and if any exceed the limit, stretch the duration. Stretching time by a factor k divides velocities by k and accelerations by \( k^2 \), so inertial and velocity-product torques fall by \( k^2 \) while gravity is unchanged.
Worked problem
Stretching a trajectory to meet a torque limit
Inverse dynamics of a planned move shows a peak shoulder torque of 70 N·m, of which 14 N·m is gravity and 56 N·m inertial and velocity-product terms. The motor and gearbox can deliver 50 N·m. By what factor must the move be stretched?
Show solution
- After stretching by k: \( \tau = 14 + 56/k^2 \le 50 \).
- \( 56/k^2 \le 36 \), so \( k^2 \ge 1.556 \), k ≥ 1.247.
Answer: Stretch the move by about 25 %. Gravity does not scale with time, so a robot whose torque is dominated by gravity gains little from slowing down, and one whose torque is dominated by inertia gains a lot.
import numpy as np
def cubic(sig): return 3*sig**2 - 2*sig**3, 6*sig - 6*sig**2, 6 - 12*sig
def quintic(sig):
return (10*sig**3 - 15*sig**4 + 6*sig**5, 30*sig**2 - 60*sig**3 + 30*sig**4,
60*sig - 180*sig**2 + 120*sig**3)
D, T = 1.2, 1.5
sig = np.linspace(0, 1, 100001)
for name, f in (("cubic", cubic), ("quintic", quintic)):
p, v, a = f(sig)
print(f"{name:8s}: v_peak = {D/T*v.max():.3f} rad/s, a_peak = {D/T**2*abs(a).max():.3f} rad/s^2, "
f"a(0) = {D/T**2*a[0]:.2f}")
def trapezoid_time(D, vmax, amax):
D = abs(D)
return D/vmax + vmax/amax if D >= vmax**2/amax else 2*np.sqrt(D/amax)
times = [trapezoid_time(d, 2.0, 8.0) for d in (1.2, 0.3, -0.8)]
print("trapezoid times (s):", np.round(times, 3), "-> synchronized T =", round(max(times), 3))cubic : v_peak = 1.200 rad/s, a_peak = 3.200 rad/s^2, a(0) = 3.20 quintic : v_peak = 1.500 rad/s, a_peak = 3.079 rad/s^2, a(0) = 0.00 trapezoid times (s): [0.85 0.387 0.65 ] -> synchronized T = 0.85
The numbers confirm the formulas: the quintic peaks at 1.5 rad/s and about 3.08 rad/s² but starts with zero acceleration, while the cubic starts with a jump to 3.2 rad/s². The synchronized trapezoid time is set by the 1.2 rad joint.
Common mistakes
MistakeSending step changes in position as references
InsteadGenerate smooth trajectories so the controller does not saturate and overshoot.
MistakeUsing cubic profiles on flexible robots
InsteadTheir acceleration jumps excite vibration; use quintic or jerk-limited profiles.
MistakeAssuming a trapezoid always reaches maximum velocity
InsteadShort moves become triangular with peak velocity \( \sqrt{\Delta a_{\max}} \).
MistakeLetting joints finish at different times
InsteadSynchronize all joints to the slowest one for coordinated motion.
MistakeExpecting slowing down to cure a gravity-limited torque problem
InsteadTime scaling reduces inertial torques by \( k^2 \) but leaves gravity unchanged.
Summary and key terms
- A trajectory is a path plus a time law; separating path q(s) and time scaling s(t) simplifies planning.
- Cubic rest-to-rest moves peak at \( 1.5\Delta/T \) velocity but have acceleration jumps at the ends.
- Quintic moves have zero boundary acceleration, peaking at \( 1.875\Delta/T \) and \( 5.77\Delta/T^2 \).
- Trapezoidal profiles give minimum time under velocity and acceleration limits; short moves become triangles.
- Jerk-limited S-curves reduce vibration, especially when ramp time matches a multiple of a resonance period.
- Multi-joint moves are synchronized to the limiting joint; splines and blends pass through via points smoothly.
- Torque-limited time scaling stretches moves so inertial torques, which scale with \( 1/k^2 \), fit the actuators.
- Path
- A geometric curve of configurations without timing.
- Trajectory
- A path with an associated time law.
- Time scaling
- The function s(t) that sets progress along a path.
- Quintic polynomial
- A fifth-order polynomial fixing position, velocity and acceleration at both ends.
- Trapezoidal profile
- Accelerate, cruise and decelerate at constant rates.
- Jerk
- The rate of change of acceleration.
- S-curve profile
- A velocity profile with limited jerk.
- Limiting joint
- The joint that needs the longest time and sets a synchronized move's duration.
- Spline
- Polynomial segments joined with continuous derivatives through via points.
- Time-optimal path parameterization
- Finding the fastest time scaling along a path within torque limits.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Find the peak velocity of a cubic move of 2 rad in 4 s.
Show answer
\( 1.5 \times 2/4 = 0.75 \) rad/s.
Find the peak acceleration of a quintic move of 1 rad in 1 s.
Show answer
About 5.77 rad/s².
With \( v_{\max} \) = 1 and \( a_{\max} \) = 4, what is the trapezoid time for 2 rad?
Show answer
2/1 + 1/4 = 2.25 s.
Same limits, 0.16 rad. What shape and time?
Show answer
Triangle, \( 2\sqrt{0.04} = 0.4 \) s.
Write the quintic rest-to-rest position polynomial in σ.
Show answer
\( 10\sigma^3 - 15\sigma^4 + 6\sigma^5 \).
What is the jerk-limited ramp time with \( a_{\max} \) = 6 and \( j_{\max} \) = 120?
Show answer
0.05 s.
Stretching a trajectory by 2 changes peak acceleration by what factor?
Show answer
Divides it by 4.
Why synchronize joints?
Show answer
So all joints start and stop together and the motion is coordinated.
What risk do straight Cartesian paths carry?
Show answer
Passing near singularities where joint speeds become very large.
What is a blend radius?
Show answer
The distance from a via point within which a corner is rounded instead of stopping.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.