So far we computed where the robot is. Trajectory planning adds when: how the robot gets from A to B over time, with positions, velocities and accelerations that the motors can actually deliver.
Section 6.2 of the course book reads like an alien language the first time. Strip the notation away and it is mostly “find the slope and intercept of a line”, with a few rules about which line to pick. Building, evaluating and analysing these trajectories is important for the exam.
Basic vocabulary
Four inputs go into any planner:
| Input | Example |
|---|---|
| Path specification | start, end, waypoints, a line or an arc |
| Path conditions | obstacles, forbidden zones |
| Time specification | total duration, start/end speed and acceleration |
| Robot limits | max joint angle, speed, acceleration |
If you have used Unity’s Vector3.Lerp, you already think like this: where from, where to,
how fast, what not to crash into.
Joint space or Cartesian space?
- Joint space: interpolate each motor angle on its own. Fast, no IK needed, no
singularity trouble. The hand path in between is some curve you don’t control, which is
fine in open space. KUKA:
PTP {A1 10, A2 30, A3 0, A4 0, A5 10, A6 0}. - Cartesian space: plan the hand’s path itself (a line, an arc) and run IK along it. Use
it whenever the shape matters: welding a seam, gluing, cutting. Watch for
singularities on the way. KUKA:
LIN {X 0, Y 0, Z 0, A 20, B 0, C 10}.
KUKA’s A, B, C are yaw (about ), pitch (about ), roll (about ), the reverse of the order you say “roll-pitch-yaw” in.
Synchronous trajectory: all joints start and finish at the same time. It has nothing to do with matching a velocity, which was my first guess.
Polynomials: what “conditions” and "" mean
A condition (the book also says constraint) is a checkpoint the motion must hit exactly. Road-trip version: “leave Madrid at 8:00” and “arrive in Barcelona at 14:00” are two conditions. “Be doing exactly 120 km/h when you pass Zaragoza” would be a third.
is simply the highest power of in the polynomial:
| Polynomial | Unknowns | |
|---|---|---|
| 1 | 2 | |
| 2 | 3 | |
| 3 | 4 |
The golden rule: a polynomial of degree has coefficients and can satisfy exactly conditions. One unknown per rule. So you count the conditions and subtract one:
| Given | Conditions | Degree |
|---|---|---|
| start + end position | 2 | 1 (linear) |
| + start/end velocity | 4 | 3 (cubic) |
| + start/end acceleration | 6 | 5 (quintic) |
Limits are not conditions. “Speed must stay within /s” is an inequality, a fence you can’t cross, not a checkpoint you must hit. It does not raise the degree. It only decides how long the motion has to take.
What the coefficients mean
Plug into the polynomial and its derivatives and the first coefficients reveal themselves:
So is the start position, the start velocity, half the start acceleration. The higher ones have no single meaning: they bend the curve so it hits the end conditions.
Computing them (where Gauss comes in)
Every condition becomes one equation: write or at the given time and set it equal to the given value. The ones give , for free; whatever is left is a small linear system. For a cubic:
Start and stop at rest and it solves to , .
Worked example: two joints, one speed limit
Joint 1 goes from to , joint 2 from to .
Degree. Two conditions per joint (start and end position), so degree 1: .
With s. Remember just means “the joint angle at time ”, so is the target.
- Joint 1: , then , so .
- Joint 2: , then , so .
Now add a limit of /s and make it synchronous. For a line, the velocity is the slope . Keep as an unknown:
Synchronous means one common for both, and the slowest joint decides: s. Squeezing everything into 1 s would push joint 1 to /s and trip the limit. Instead the fast joint just takes its time. Redo both lines with :
Both speeds (/s and /s) are legal and both joints arrive together.
What is wrong with this profile
A linear trajectory has constant velocity and zero acceleration during the move. Sounds smooth. The problem is the edges: the robot usually starts from rest, so at the speed jumps from 0 to /s instantly. That is an infinite acceleration spike (huge jerk), which shakes the arm and wears out the actuators. Same at the stop.
It is only fine if the joint was already moving at exactly that speed before and keeps going after. In Unity terms: a linear Lerp has no ease-in or ease-out. The fix is a higher degree (cubic or quintic), which has enough coefficients to force the start and end velocities, and accelerations, to zero.
Straight lines in the workspace
Now we plan the hand path itself. A straight line from to is literally a Lerp:
is the start, the end, anything between is on the line. is pure geometry. To add time, make a function of with and . The simplest choice:
Linear means constant hand speed (with the same jerk problem as above). A smooth polynomial for eases in and out.
Controllers count in steps
A robot controller is a computer. It does not compute the trajectory continuously, it computes it every sample time :
Example: , , s gives and . With ms the controller computes 11 states (count both ends!):
| 0 | 1 | 2 | 3 | … | 9 | 10 | |
|---|---|---|---|---|---|---|---|
| [s] | 0.0 | 0.1 | 0.2 | 0.3 | … | 0.9 | 1.0 |
| 0 | 1 | 2 | 3 | … | 9 | 10 | |
| 10 | 10 | 10 | 10 | … | 10 | 10 |