Robotics core · topic B1 · 15 hours
Coordinate transforms & the tf tree
The shared spatial consensus of the whole robot system. Design the tf tree wrong and every perception and control module downstream fights every other one.
What to learn
- Parent-child relations in a tree of coordinate frames; the difference between static and dynamic transforms
- Timestamps and interpolation: why a tf query must name a moment, never «now»
- Drawing the tf tree for a «base + arm + camera + lidar» robot and marking which edges are static
- Anti-patterns: everything under base_link, the world frame used as a hub, a child updating slower than its parent
The lesson · plain words
Every part on a robot lives in its own coordinate frame: the camera says «the cup is 0.8 m ahead of me», the lidar says «the obstacle is to my left», the base says «I am at world (3.2, 1.4)». The tf tree is the dictionary that translates between all of them.
This page teaches no math; it teaches engineering discipline: one tree, every frame has exactly one parent, every edge carries a timestamp. Get it wrong and nothing throws an error — you just get a persistent 3 cm offset and bugs nobody can trace.
One edge = one 4×4 matrix + one timestamp
A static transform is «bolted on and never moves»: the camera fixed to the tip — publish once at startup, done. A dynamic transform is wheels turning and joints moving, re-published at rate by drivers or odometry. Mathematically identical; the only difference is whether the timestamp keeps updating.
Each edge describes only «child relative to parent». To get base→camera, multiply base→arm→tip→camera down the chain; to go back, invert the whole chain in one shot — transpose plus a flipped translation, no re-derivation needed.
Why every query must name «at what time»
A tf query is never about «now»; it is about «at time t». Because the robot moves: the camera at 0.600 s and the lidar at 0.633 s saw the scene from two different places.
The figure below is the classic crash scene: two sensor streams each take their nearest frame and stitch them — 33 ms apart, several centimeters of position error. Calibration never fixes it; this is the root cause.
Interactive figure · drag it and see
A tree, never a cycle
Every frame has exactly one parent. Two parents make a cycle; tf refuses to publish and spams errors — or worse, some wrappers silently drop the edge, and the symptom you see is «some frame never resolves», not «the tree is wrong».
Common anti-patterns: hanging everything under base_link — looks simple, but throws away chained derivation; a child publishing slower than its parent — interpolation turns into extrapolation and the error doubles; intermediate frames with no physical meaning, added only to shorten names.
Four rules for designing a tf tree
① If an edge can be static, never republish it dynamically. ② Mount each sensor under the link it is physically bolted to — a camera on the tip hangs under the tip, not under base. ③ Intermediate frames must carry physical meaning — base_footprint is the ground projection, not a naming convenience. ④ Publish rates decrease bottom-up; the higher frames are the stable ones.
Acceptance is one command: check that the tree is really a tree, then check whether any node publishes noticeably slower than its parent. A rate inversion means every interpolation downstream is inventing data.
Three questions — do you really get it?
1. The camera sees a target ahead of it. To get the target's position in the base frame, which transform do you multiply?
- AThe camera→base transform
- BThe base→camera transform
- CJust add the translations
Show answer
A. Reading the point «from the camera ledger into the base ledger» means multiplying by camera→base. Reversing the direction is the number-one beginner bug; the symptom is the target showing up at the mirror-symmetric position.
2. base→arm publishes at 100 Hz, arm→camera only at 10 Hz. What happens to a base→camera query?
- ANothing wrong
- BThe system automatically drops both edges to 10 Hz
- CThe slow edge gets interpolated — extrapolated once it lags, error amplified
Show answer
C. tf interpolates in its buffer at query time. Once the slow edge lags behind the query time it extrapolates — extrapolation has no basis, and the error grows linearly.
3. Two sensors are stitched together with a 20 ms timestamp gap. The most typical consequence?
- ATargets sit centimeters off; calibration chases its tail
- BThe program crashes
- CThe data rate drops
Show answer
A. At 1 m/s, 20 ms is 2 cm. This kind of error never throws; it sits there stably, so it always gets misdiagnosed as «bad calibration».
Keep going deeper
Links without a marker stay on this site; the rest point to the Chinese edition until its translation batch lands.
How it fails in the field
- Stitching two sensors whose timestamps differ by 20 ms; calibration never converges and gets the blame
- A frame with two parents (a cycle): compiles fine, crashes at runtime
You have learned enough when
The Chinese edition carries the full topic page for Coordinate transforms & the tf tree, including the complete outline, depth requirements per career track, and further derivations: robotguide.dev/k/B1/.