explainer
Trajectory time scaling: choose when a robot follows its path
Separate a robot’s geometric path from its timing. Compare cubic and quintic profiles, derive joint speed and acceleration through the chain rule, and choose a duration that meets explicit limits.
What you will learn
- Separate a joint path from the clock used to follow it.
- Apply the chain rule to joint velocity and acceleration.
- Compare cubic and quintic terminal conditions and analytic peaks.
- Calculate a feasible duration within a fixed polynomial family.
- Distinguish timing limits from collision and physical tracking checks.
Before you start
A robot can follow the same path slowly or quickly. The route stays fixed, while its required joint speeds and accelerations change. Time scaling lets you choose that schedule and check its demands before execution.
We will schedule one two-joint path with cubic and quintic polynomials. Both start and finish at rest. Their peak demands and endpoint accelerations differ, so each family needs its own duration calculation.
Separate the path from the clock
A path q(s) lists configurations as a dimensionless progress variable s moves from 0 to 1. A time scaling s(t) tells us which configuration to request at time t. Their composition q(s(t)) is a trajectory.
Modern Robotics introduces this path-and-time separation. Changing the clock can preserve the geometric route while changing how fast the robot moves along it.
Use the fixed-base planar arm with links of 2 m and 1 m. Shoulder angle θ₁ is absolute; elbow angle θ₂ is relative to link 1. World x points right, world y points up, and positive angles turn counterclockwise.
Choose a straight joint path from q_start = (0, π/2) to q_end = (π/2, 0):
Δq = (π/2, −π/2)
q(s) = q_start + sΔq
q(s) = (πs/2, π(1 − s)/2)
Both angles always sum to π/2, so the second link stays vertical. The tool follows p(s) = (2 cos(πs/2), 1 + 2 sin(πs/2)) m. This is a quarter circle centered at (0, 1), with radius 2 m.
At s = 1/2, the tool is at (√2, 1 + √2). The midpoint of the straight Cartesian segment between (2, 1) and (0, 3) would be (1, 2). A straight joint path therefore produces a curved tool path in this example.
Differentiate the timed path
Use primes for derivatives with respect to s, and dots for derivatives with respect to seconds. The chain rule gives:
q̇ = q′(s)ṡ
q̈ = q″(s)ṡ² + q′(s)s̈
Acceleration has two terms. One comes from curvature of the path in joint coordinates. The other comes from changing the rate of progress along that path.
Our straight joint path has q′ = Δq and q″ = 0. Thus q̇ = Δq ṡ and q̈ = Δq s̈. A curved joint path generally needs both terms, even if its timing has constant ṡ.
For a move of duration T, define normalized time u = t/T and write s = f(u). Then ṡ = f′(u)/T and s̈ = f″(u)/T². Here f's primes refer to u; s is dimensionless, ṡ uses 1/s, and s̈ uses 1/s².
Doubling T at a fixed u halves joint velocity and quarters joint acceleration. It preserves s and the arm configuration at that same fraction of elapsed time.
Compare cubic and quintic timing
The cubic profile uses four endpoint conditions: f(0) = 0, f(1) = 1, and zero velocity at both ends. Solving for its four polynomial coefficients gives:
f₃(u) = 3u² − 2u³
f₃′(u) = 6u(1 − u)
f₃″(u) = 6 − 12u
Cubic timing starts and ends with zero velocity, but its one-sided endpoint accelerations are 6/T² and −6/T² in path coordinates. Joining this segment to stationary holds creates acceleration jumps.
The quintic profile has six coefficients. Adding zero acceleration at both ends gives:
f₅(u) = 10u³ − 15u⁴ + 6u⁵
f₅′(u) = 30u²(1 − u)²
f₅″(u) = 60u(1 − u)(1 − 2u)
Modern Robotics compares these terminal conditions with other timing profiles. Both polynomials move forward monotonically on the unit interval because their first derivatives are nonnegative there.
Quintic timing also has limits. Jerk is the time derivative of acceleration, and f₅‴ equals 60 at both endpoints. The path jerk therefore jumps between 0 during a hold and 60/T³ at the segment boundary; zero endpoint acceleration alone does not impose a jerk limit or global jerk continuity.
Find the peaks over the whole motion
A value at one selected time cannot certify the whole trajectory. Both profiles have zero endpoint speed, including when their mid-motion speed exceeds a limit. We need the maximum demands across the complete interval.
For either profile, f′ reaches its maximum at u = 1/2. The cubic's acceleration magnitude peaks at its endpoints. For the quintic, solve f₅‴(u) = 60(1 − 6u + 6u²) = 0, giving u = (3 ± √3)/6.
| Profile | max f′ | max ‖f″‖ |
|---|---|---|
| Cubic | 3/2 = 1.5 | 6 |
| Quintic | 15/8 = 1.875 | 10√3/3 ≈ 5.773503 |
These are dimensionless derivative coefficients. Divide them by T and T² to obtain peak path rate and acceleration magnitude. Multiply by each joint's absolute travel |Δq_i| to obtain that joint's peaks for this straight path.
At equal duration, the quintic has a 25% larger peak speed than the cubic. It also has a slightly smaller peak acceleration magnitude. Alessandro De Luca's polynomial-trajectory exercise solutions, exercise 3, derive these peak locations and duration constraints.
Convert limits into a duration
Let c_v and c_a denote the selected profile's two peak coefficients. For joint i, require speed magnitude at most V_i and acceleration magnitude at most A_i. Along the straight joint path:
T ≥ |Δqᵢ|c_v / Vᵢ
T ≥ √(|Δqᵢ|c_a / Aᵢ)
T_min = maxᵢ of both bounds
Set each speed limit to 1 rad/s and each acceleration limit to 2 rad/s². Both joints travel π/2 rad in magnitude. The cubic needs at least 2.356194 s from speed and 2.170804 s from acceleration, so speed sets its minimum.
The quintic needs at least 2.945243 s from speed and 2.129436 s from acceleration. Its zero endpoint acceleration does not make it faster under these particular limits.
These are minimum durations within the chosen polynomial family on this fixed path. They do not compare every possible time scaling. Different profile families, extra constraints or a different path create different optimization problems.
The trapezoidal velocity profiles lesson derives a fastest rest-to-rest move for one ideal joint under speed and acceleration bounds. Its triangular short-move case shows why a joint may finish before reaching its speed limit.
Calculate one instant and its duration bound
Choose cubic timing with T = 3 s and u = 1/4, corresponding to t = 0.75 s. Substitution gives:
- Path progress: s = 5/32 = 0.15625.
- Path rate: ṡ = (9/8)/3 = 0.375 per second.
- Path acceleration: s̈ = 3/9 = 1/3 per second squared.
The joint angles are (14.0625°, 75.9375°). Multiply the scalar derivatives by Δq = (π/2, −π/2) to obtain q̇ = (3π/16, −3π/16) rad/s and q̈ = (π/6, −π/6) rad/s².
Forward kinematics gives the tool position (1.940063, 1.485960) m, to six decimals. Across the full three-second move, each joint's peak speed is 0.785398 rad/s and its peak acceleration magnitude is 1.047198 rad/s². Both stay below the stated limits.
Change only the profile to quintic at the same u and T. Now s = 0.103515625, so the arm has progressed less far at t = 0.75 s. Both profiles still reach s = 1/2 halfway through the motion and s = 1 at the finish.
Change timing while keeping the path
Move the normalized-time slider to inspect the start, midpoint and finish. Compare endpoint accelerations between the two profiles. The cubic readout at an endpoint shows the derivative from inside its moving segment; a stationary hold on the other side has zero acceleration.
Set T to 0.5 s, then return the time slider to zero. The instantaneous speed is zero, but the peak-based check still reports violations. Raising T lowers the demands everywhere without replacing the geometric path.
The feasible-duration button rounds the analytic minimum upward to the next hundredth of a second. It selects 2.36 s for cubic and 2.95 s for quintic. The readout preserves the six-decimal analytic threshold so the rounding is visible.
The upper graph uses normalized time, so changing T leaves both curves in place. The lower graph shows the arm at the selected instant on its fixed tool path. No animation or numerical integration is needed to evaluate these polynomial formulas.
State what the timing check covers
The experiment checks joint speed and acceleration magnitudes for the prescribed polynomial segment. It does not model actuator torque, jerk bounds, contact, collision clearance or tracking error. The synthetic limits serve the calculation and do not specify a real robot's operating envelope.
Timing also cannot repair a path that passes through a static obstacle. A* search can first choose a route through a graph of valid configurations and connections. A learned model may propose useful waypoints, but the resulting geometric path still needs validation. Then a controller must follow the timed reference with its own sensing and actuation constraints.
Modern Robotics' time-optimal scaling chapter considers dynamics and joint torque limits. That broader problem can make the allowed acceleration depend on both path position and path speed.
Inverse dynamics calculates the actuator torques required by one specified position, velocity, and acceleration. Apply that calculation along a timed path to check torque demands. Slowing the motion reduces acceleration and velocity-coupling terms, while gravity still depends on the arm's posture.
Collision-checked shortcutting can shorten a geometric route before assigning its timing. The resulting polyline still has corners, so reducing its length alone does not make its velocity continuous.
For a curved joint path, retain q″(s)ṡ² when checking acceleration. For sampled execution, distinguish exact reference values from the approximation made by a numerical integrator. A timing formula specifies desired motion; it does not guarantee physical tracking.
Reproduce both profiles in Python
This Python 3 example uses only the standard library. It computes one instant at T = 3 s, finds the analytic peaks, and calculates each family's minimum duration. The tool position uses the quarter-circle formula derived above.
from math import pi, sqrt, sin, cos, ceil
delta = pi / 2
T, u = 3.0, 0.25
speed_limit, acceleration_limit = 1.0, 2.0
def profile(name, u):
if name == "cubic":
return (3*u*u - 2*u**3, 6*u*(1-u), 6-12*u, 1.5, 6.0)
return (10*u**3 - 15*u**4 + 6*u**5,
30*u*u*(1-u)**2, 60*u*(1-u)*(1-2*u),
15/8, 10*sqrt(3)/3)
def pair(values):
return "(" + ", ".join(f"{x:.6f}" for x in values) + ")"
for name in ("cubic", "quintic"):
s, first, second, cv, ca = profile(name, u)
rate, acceleration = first/T, second/T**2
q_degrees = (90*s, 90*(1-s))
qdot = (delta*rate, -delta*rate)
qddot = (delta*acceleration, -delta*acceleration)
peak_speed, peak_acceleration = delta*cv/T, delta*ca/T**2
minimum = max(delta*cv/speed_limit,
sqrt(delta*ca/acceleration_limit))
rounded = ceil(minimum*100)/100
tool = (2*cos(delta*s), 1+2*sin(delta*s))
print(f"{name}: s={s:.6f}; t={u*T:.6f} s")
print(" joint degrees:", pair(q_degrees))
print(" joint rad/s: ", pair(qdot))
print(" joint rad/s^2:", pair(qddot))
print(f" peaks: {peak_speed:.6f} rad/s; {peak_acceleration:.6f} rad/s^2")
print(f" minimum: {minimum:.6f} s; rounded up: {rounded:.2f} s")
print(" tool metres: ", pair(tool))
Expected output:
cubic: s=0.156250; t=0.750000 s
joint degrees: (14.062500, 75.937500)
joint rad/s: (0.589049, -0.589049)
joint rad/s^2: (0.523599, -0.523599)
peaks: 0.785398 rad/s; 1.047198 rad/s^2
minimum: 2.356194 s; rounded up: 2.36 s
tool metres: (1.940063, 1.485960)
quintic: s=0.103516; t=0.750000 s
joint degrees: (9.316406, 80.683594)
joint rad/s: (0.552233, -0.552233)
joint rad/s^2: (0.981748, -0.981748)
peaks: 0.981748 rad/s; 1.007666 rad/s^2
minimum: 2.945243 s; rounded up: 2.95 s
tool metres: (1.973619, 1.323773)
Try it yourself
1. Slow the clock. Keep the cubic profile at u = 1/4 and increase T from 3 s to 4.5 s. What happens to the arm position, joint velocity and joint acceleration at that same normalized time? Do both whole-trajectory limits still hold?
Show the duration-scaling solution
Path progress stays at 5/32, so the arm position stays the same. The instant now occurs at t = 1.125 s. Joint velocity scales by 3/4.5 = 2/3, giving (π/8, −π/8) rad/s.
Joint acceleration scales by (3/4.5)² = 4/9, giving (2π/27, −2π/27) rad/s². The full-motion peak speed becomes π/6 ≈ 0.523599 rad/s, and peak acceleration becomes 4π/27 ≈ 0.465421 rad/s². Both satisfy the limits.
2. Keep the curvature term. For a different joint path q(s) = (s², s³) rad, evaluate q̇ and q̈ when s = 1/2, ṡ = 2 per second, and s̈ = −1 per second squared. Can you use q̈ = Δq s̈ for this path?
Show the curved-path solution
At s = 1/2, q′ = (1, 3/4) rad and q″ = (2, 3) rad. The velocity is q′ ṡ = (2, 3/2) rad/s.
The acceleration is (2, 3) times 4 plus (1, 3/4) times −1, giving (7, 45/4) = (7, 11.25) rad/s². This path has a nonzero second derivative, so the curvature term contributes even though the clock is decelerating. The constant-Δq formula applies to a straight joint path.
Sources and further study
- Lynch and Park, Modern Robotics: Point-to-Point Trajectories, Part 1. Defines paths and time scalings and derives their velocity and acceleration composition.
- Modern Robotics: Point-to-Point Trajectories, Part 2. Compares polynomial terminal conditions with trapezoidal and S-curve timing.
- Alessandro De Luca, Robotics I exam and solutions, July 11, 2017. Exercise 3 derives peak speeds, peak accelerations and profile-specific duration bounds.
- Modern Robotics: Time-Optimal Time Scaling, Part 1. Introduces the broader problem of timing a path under robot dynamics and actuator limits.