Lite / Textbooks / Robotics From First Principles / Chapter 7
7. Motion and trajectories
Introduction
Knowing the start and the goal is not enough: a robot must get there without jerking, overshooting or tipping its payload. A trapezoidal profile ramps speed up, cruises, then ramps down, so the area under the speed graph equals the distance. For an arm, every joint follows its own profile, timed so they all finish together; and moving in joint space is not the same as moving in a straight line.
Figure 7.1. Speed up, cruise, slow down (described in words)
A trapezoidal velocity profile for a 1 m move with top speed 0.5 m/s and acceleration 1 m/s²: a 0.5 s ramp up, 1.5 s at constant speed and a 0.5 s ramp down, 2.5 s in total. The shaded area equals the 1 m distance.
Explanation
Built from 3 School lessons. Each part is the lesson's own explanation.
7.1 Motion profiles: getting there smoothly
The fastest way from A to B is 'full speed, then stop'. Why does no real lift, robot or train move like that?
Linear interpolation
The simplest trajectory: x(t) = x0 + (x1 − x0)·(t/T) for 0 ≤ t ≤ T. Constant speed |x1 − x0|/T the whole way. It's perfect for planning where to be in the middle of a move, but at t = 0 and t = T the speed jumps instantly, which would need infinite acceleration.
The trapezoid
Accelerate at the limit a until reaching the speed limit v, cruise, then decelerate at a to stop exactly at the target. The speed-time graph is a trapezoid; its area is the distance. Position during the first ramp is ½at²; during the cruise, v²/(2a) + v(t − ta); during the final ramp, D − ½a(T − t)².
Triangles and beyond
Short moves never reach v: the trapezoid collapses to a triangle. And the trapezoid still has instant jumps in acceleration (jerk), felt as a small jolt; lifts and precision machines use S-curves that also limit jerk, at the cost of a little more time. The Elevator Build's planner shows that next step.
Derivation: Duration of a trapezoidal move
Ramp up from rest at acceleration a to speed v: time ta = v/a, distance ½·a·ta² = v²/(2a).
Ramp down is the mirror image: another v/a seconds and v²/(2a) metres.
Cruise covers the rest, D − v²/a, at speed v, taking (D − v²/a)/v = D/v − v/a seconds. This needs D ≥ v²/a.
Total: T = 2·(v/a) + D/v − v/a = D/v + v/a. The extra v/a, compared with D/v, is the price of smoothness.
If D < v²/a there's no room to cruise: the profile is a triangle with peak speed √(D·a) and duration 2√(D/a).
Common mix-ups
Raising the speed limit always makes the move faster by the same proportion.
✓ T = D/v + v/a: for short moves the ramps dominate, and a higher v can barely help (or the move is a triangle anyway).A trapezoidal profile is perfectly smooth.
✓ Its speed is continuous, but its acceleration jumps; S-curves smooth that too.
Open the Lite lesson: Motion profiles: getting there smoothly
7.2 Joint-space trajectories: moving every joint together
A robot's shoulder must turn 90° and its elbow only 10°. If both run flat out, one finishes long before the other. Is that a problem?
Interpolate each joint
For a move from θ_start to θ_end over time T, each joint follows θᵢ(t) = θᵢ,start + (θᵢ,end − θᵢ,start)·s(t), where s(t) runs from 0 to 1. With s = t/T it's linear interpolation; with s from a trapezoid (normalised by D) every joint ramps smoothly, at once. All joints share one s(t), so they start and finish together.
The slowest joint sets the pace
Each joint has its own speed limit. With linear interpolation, joint i needs speed |Δθᵢ|/T ≤ vᵢ,max, so T ≥ max(|Δθᵢ|/vᵢ,max). Choose the largest of these times and slow the other joints to match. That's 'synchronised' motion: it looks deliberate and keeps the hand's path predictable.
Joint space vs task space
Joint-space moves are cheap and safe (no IK mid-move, no singular surprises), but the hand curves. Task-space moves interpolate the hand position in a straight line and solve IK at each step: needed for welding a seam or inserting a peg, but they can drive the arm into a singularity or a joint limit halfway. Controllers offer both.
Common mix-ups
Moving every joint in a straight line moves the hand in a straight line.
✓ FK is nonlinear; a straight line in joint space is usually a curve for the hand.Each joint should move at its own top speed.
✓ Synchronised moves slow the faster joints so all finish together; otherwise the path is unpredictable.
Open the Lite lesson: Joint-space trajectories: moving every joint together
7.3 Modelling rotating parts: x = L cos θ, y = L sin θ
A windscreen wiper, a crane jib and a robot's first link all trace the same shape. Which equation draws all three?
A link is a scaled unit circle
A link of length L at angle θ (from +x, anticlockwise) has its tip at x = L cos θ, y = L sin θ. It's the unit-circle point (cos θ, sin θ) stretched by L. If the pivot is not at the origin but at (px, py), add that offset: x = px + L cos θ, y = py + L sin θ.
Going back: angle from position
Given a tip position (x, y) relative to the pivot, the joint angle is θ = atan2(y, x) and the length is √(x² + y²). This is the seed of inverse kinematics: working backwards from where the tip is (or should be) to the angle that puts it there. atan2, not tan⁻¹, because joints swing through every quadrant.
How fast does the tip move?
If the joint turns at angular speed ω (rad/s), the tip moves along its circle at v = L·ω. Long links make fast tips: a 2 m crane jib turning at 0.5 rad/s moves its tip at 1 m/s. The tip's velocity points along the circle, perpendicular to the link: (−L ω sin θ, L ω cos θ).
Common mix-ups
x = L sin θ and y = L cos θ.
✓ With θ measured from the x axis, x uses cosine and y uses sine. (Swap them only if θ is measured from the y axis.)Every point on a rotating link moves at the same speed.
✓ Speed is L·ω: points further from the pivot move faster.
Open the Lite lesson: Modelling rotating parts: x = L cos θ, y = L sin θ
Worked examples
Motion profiles: getting there smoothly: example 1
D = 5.5 rad, a = 0.5 rad/s², v = 0.5 rad/s. Where is the joint at t = 6 s?
Solution
ta = 1 s, ramp distance 0.25 rad, T = 5.5/0.5 + 1 = 12 s. At t = 6 s it's cruising: 0.25 + 0.5 × (6 − 1) = 2.75 rad.
Joint-space trajectories: moving every joint together: example 1
A joint goes from 20° to 80° linearly over 3 s. Where is it at t = 1.2 s?
Solution
θ = 20 + 60 × (1.2/3) = 20 + 24 = 44°. Speed 20°/s throughout.
Modelling rotating parts: x = L cos θ, y = L sin θ: example 1
A crane jib 12 m long, pivoted 3 m above the ground, is raised to 40°. How high is its tip?
Solution
y = 3 + 12 sin 40° = 3 + 12 × 0.6428 ≈ 10.71 m. Its tip is 12 cos 40° ≈ 9.19 m out from the pivot.
Interactive figures, in words
Figure 7.2 from Motion profiles: getting there smoothly
Start with D = 2 m, v = 1 m/s, a = 1 m/s² and check the 3 s prediction. Then shrink D until the trapezoid becomes a triangle: at what distance does that happen? Finally raise a: what happens to the trapezoid's duration as a gets very large?
The profile comparer plots position against time (top) and speed against time (bottom) for a constant-velocity move (dashed orange: speed jumps instantly) and a trapezoidal move (solid blue: speed ramps up, cruises, ramps down). The readout gives both durations, the ramp and cruise times, and both positions at the chosen time.
Laboratory
These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.
- Simulation OS: Joint-space vs straight-line motion (Simulation OS experiment)
Move the arm between two points both ways and measure how far the joint-space path strays from the straight line.
Open on the full site - BUILD: Elevator, level 2 (BUILD level)
Plan the lift's motion profile so the cabin reaches the next floor smoothly in a set time.
Open on the full site
Practice
Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.
- A slider moves at constant speed from x = 10 cm to x = 50 cm in 4 s. Where is it at t = 1 s, in cm?
Answer it in “Motion profiles: getting there smoothly” - A joint follows a trapezoidal profile over 2.5 rad: it accelerates at 2 rad/s² up to 1 rad/s, cruises, then decelerates at 2 rad/s² to stop. How far has it moved at t = 1.1 s, in radians? (3 decimal places)
Answer it in “Motion profiles: getting there smoothly” - With v = 2 m/s and a = 1 m/s², which move is too short to reach full speed?
Answer it in “Motion profiles: getting there smoothly” - Why don't robot controllers use pure constant-velocity moves between points?
Answer it in “Motion profiles: getting there smoothly” - Joint 1 moves 120° with a limit of 60°/s; joint 2 moves 45° with a limit of 30°/s. For a synchronised linear move, what is the shortest duration, in seconds?
Answer it in “Joint-space trajectories: moving every joint together” - A welding robot must follow a straight seam. Which trajectory type is needed?
Answer it in “Joint-space trajectories: moving every joint together” - A 0.6 m link turns at 2 rad/s. How fast does its tip move, in m/s?
Answer it in “Modelling rotating parts: x = L cos θ, y = L sin θ”
Engineering applications
Lifts
A lift cabin follows a smoothed profile so passengers never feel a sudden lurch. Limiting acceleration, and how quickly acceleration changes, matters as much for comfort as the top speed.
Carrying liquids
A robot carrying a cup of coffee limits acceleration so the liquid does not slosh over the rim. The trip takes slightly longer, and nobody gets wet.
Watch (optional)
Streaming video uses a lot of data. Everything you need is in the text.
Summary
- Linear interpolation moves from start to goal at constant speed, with jerky starts and stops.
- A trapezoidal profile ramps up, cruises and ramps down; distance is the area under the speed graph.
- Short moves never reach top speed and become triangular profiles.
- Synchronising joints means timing every joint's profile to finish together.
Glossary
- Equations of uniform acceleration
- When acceleration is constant, displacement, initial velocity, final velocity, acceleration and time are linked by four short equations. Field Guide
- Linear interpolation
- Linear interpolation estimates a value between two known points by assuming a straight line between them. Field Guide
- Radians and degrees
- A radian is the angle at which the arc length equals the radius. A full turn is 2π radians, which is 360 degrees. Field Guide
Project: A gentle delivery
A robot must carry a tray 3 m across a room in under 8 seconds without exceeding an acceleration of 0.5 m/s². Design a trapezoidal profile that meets both limits, plot speed and position against time, and show the distance under the speed graph is 3 m.
Deliverables
- The profile parameters with working
- Plots of speed and position against time
- A check that every limit is met
Write it up on paper or in your own notes. Lite never stores what you write.
References
- Kevin M. Lynch and Frank C. Park (2017). Modern Robotics: Mechanics, Planning, and Control. Cambridge University Press.
- Mark W. Spong et al. (2006). Robot Modeling and Control. Wiley.
Further reading from the lessons
- Motion planning (Wikipedia)
The wider field of planning paths and trajectories. - Trajectory (Wikipedia)
The general idea of a path through time, from physics to robotics. - Polar coordinate system (Wikipedia)
The (r, θ) description and conversions in full.