Trajectories: how a path differs from a trajectory
Atlasbot · 17/8/2026 · 11 min read
The words "path" and "trajectory" are often used interchangeably, but in robotics they have distinctly different meanings — and that difference is really important, not just a play on words.
Key concepts
Path (path) is just a series of (x, y) positions one after another in space — answering the question "which points the robot needs to go through to reach the destination", saying nothing about when which point the robot is at. This is the result of planner_server in Nav2 — published on topic /plan.
path = [(0,0), (1,0), (2,0.5), (3,1), (4,1)] # only position, no time
Trajectory (trajectory) is path plus information about when the robot will be at each point:
trajectory = [(0,0,t=0), (1,0,t=1.2s), (2,0.5,t=2.8s), (3,1,t=4.1s), (4,1,t=5.5s)]
In short: Path answers "where to go", Trajectory answers "to go through where and when". A single path can generate an infinite number of different trajectories — going slowly or fast along the exact same path is still the same path, but two different trajectories.
How it works
A static path is not enough to avoid a moving obstacle (crossing pedestrian) — it is necessary to know when the robot is at a point to compare with predicting the pedestrian's position at that exact moment. Modern controllers like MPPI work directly on trajectory — predicting multiple possible trajectories over the next few seconds, scoring each trajectory based on its likelihood of colliding with dynamic obstacles, not just on a static path.
planner_server → path (static score string, counted once when there is a new goal)
controller_server → trajectory (real-time velocity, recalculated every cycle)
Follow the path, respect acceleration limits, avoid moving obstacles that arise
planner_server calculate path once; controller_server continuously recalculates the trajectory in real time to stick to that path.
Technical details
Formulas
Implied velocity between 2 consecutive points on the trajectory calculated directly from distance and time difference — used to check whether the trajectory is kinematics feasible or not:
v = distance(point_i, point_i+1) / (t_i+1 − t_i)
For example: from (1,0,t=1.2s) to (2,0.5,t=2.8s) in the trajectory example above
distance = √((2−1)² + (0.5−0)²) ≈ 1.118m
Δt = 2.8 − 1.2 = 1.6s
v ≈ 1.118 / 1.6 ≈ 0.70 m/s
Calculate the same for every pair of consecutive points, then compare the velocity difference between segments with the acceleration limit a_max (previous article) to confirm the trajectory is "feasible" — does not require the robot to accelerate/decelerate faster than physics allows.
Parameters
The MPPI controller (Model Predictive Path Integral, used in modern Nav2) generates and scores a series of candidate trajectories each cycle:
| MPPI parameters | Typical value |
|---|---|
| Number of candidate trajectories per cycle | Several hundred to several thousand |
| Prediction time (horizon) | 1 – 3 seconds |
| Frequency recalculated | Same frequency controller_server, usually 10-30Hz |
Practical applications
MPPI scores each candidate trajectory based on a combination of multiple criteria at the same time: remaining distance to the goal (the closer the better), the risk of collision with a static/dynamic obstacle at the expected time on that trajectory (the lower the better), and the smoothness of the movement (avoiding sudden changes in direction/speed, respecting the acceleration limits learned in the previous lesson) — the trajectory with the best composite score is chosen to execute in that cycle, then the whole process repeats in the next cycle with Latest sensor data. This is why a robot running Nav2/MPPI can avoid a pedestrian moving across the street — it not only sees that person's current location, but pre-estimates many possible future locations for each of the robot's own candidate trajectories.
Practical example
import math
trajectory = [(0,0,0), (1,0,1.2), (2,0.5,2.8), (3,1,4.1), (4,1,5.5)]
a_max = 1.0 # m/s^2, gioi han da hoc bai truoc
velocities = []
for i in range(len(trajectory)-1):
x1,y1,t1 = trajectory[i]
x2,y2,t2 = trajectory[i+1]
dist = math.sqrt((x2-x1)**2 + (y2-y1)**2)
v = dist / (t2 - t1)
velocities.append(v)
print(f"Doan {i}: v={v:.2f} m/s")
for i in range(len(velocities)-1):
dv = abs(velocities[i+1] - velocities[i])
dt = trajectory[i+2][2] - trajectory[i][2]
a_thuc_te = dv / dt
trang_thai = "OK" if a_thuc_te <= a_max else "VUOT GIOI HAN"
print(f"Gia toc doan {i}->{i+1}: {a_thuc_te:.2f} m/s^2 [{trang_thai}]")
Output:
Doan 0: v=0.83 m/s
Doan 1: v=0.70 m/s
Doan 2: v=0.77 m/s
Doan 3: v=0.71 m/s
Gia toc doan 0->1: 0.09 m/s^2 [OK]
Gia toc doan 1->2: 0.02 m/s^2 [OK]
Gia toc doan 2->3: 0.02 m/s^2 [OK]
All sample trajectories are within the acceleration limit 1.0 m/s² — if any segment exceeds the threshold, that trajectory not feasible In terms of kinematics, the robot cannot really follow the plan no matter how reasonable the geometric path is.
Common mistakes
- Generating a trajectory that violates acceleration/velocity constraints — as illustrated in the example above, a geometrically "reasonable" trajectory may still require acceleration beyond the actual capabilities of the robot — always check kinematics feasibility before trusting execution.
- The trajectory recalculation frequency is too slow compared to the rate of environmental change — if the moving obstacle moves much faster than the trajectory recalculation frequency
controller_server, the robot reacts late to the change, similar to the reaction distance problem learned in the Sense-Think-Act lesson. - Confusion between replan path frequency and trajectory calculation frequency — 2 different layers: path (slow, recalculates only when needed) and trajectory (fast, recalculates continuously) — confusion of these 2 concepts when configuring Nav2 causes false expectations about the actual reaction speed.
- Timeline error when interpolating between waypoints — if the code itself interpolates the position between two trajectory points over time and incorrectly calculates the linear interpolation formula according to
t, the robot may "think" it is in a different position than the actual expected trajectory position at that time.
Conclusion
Distinguishing clearly between path (pure space) and trajectory (space + time) is key to understanding why modern robots avoid moving obstacles — static paths alone are not informative enough to know "when" to avoid. Always check that the trajectory is kinematically feasible (respecting acceleration limits) before executing. The next article in the column, and the last, is about Closed-loop Control — the general principle behind PID, velocity control, and all the feedback mechanisms learned throughout this column.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.