kevinferron.comKevin Ferron

Frames and transforms

Drag a robot, bend its arm and turn its tool through four frames, and watch each transform compose into where the tool sits in the world. Then switch on odometry drift and watch the robot’s idea of where it is slide away from the truth.

  • REP 103
  • REP 105
  • Transforms
  • Odometry
tool tip

Drag the big circle to move the base, the small ones to turn the base, swing the link and turn the tool. The sliders do the same from the keyboard. Axes: x red, y green. Metres on a grid of 1 m.

Switch drift on and drive the base: odometry will slide away from the truth.

Illustrative drift, not a measurement: 0.06 rad of heading error per metre driven, and every distance reads 3% long.

Transforms, each frame in its parent

base in world
x 2.20 m, y 1.70 m, 23°
link in base
x 0.35 m, y 0.00 m, 29°
tool in link
x 1.10 m, y 0.00 m, -34°
tool in world
x 3.21 m, y 2.70 m, 17°the product of the three above, in that order

The tool tip, 0.4 m along the tool's x axis, is at x 3.59 m, y 2.82 m in the world. Reverse the order of the product and it lands elsewhere.

Every point on a robot has coordinates only in some frame: the world, the base, a link, the tool. A transform says where one frame sits in another, and chaining them gives where the tool sits in the world. The diagram lets you move the base, bend the link and turn the tool, and prints each transform and their product.

Order matters. Moving then turning is not turning then moving, so composing world to base with base to link is not the same as the other way round. The product on screen is world to base, times base to link, times link to tool; the inverse of a transform takes you back, and a transform times its inverse is the identity.

ROS fixes the conventions so packages agree: right-handed axes, and for a body x forward, y left and z up, with east, north, up for geography. This page draws in the plane, x to the right and y up, so a heading of zero faces right.

A mobile robot keeps three frames in a chain: map, odom and base_link. The link from odom to base_link is continuous, with no jumps, but it drifts. The link from map to odom does not drift, but it can jump when a localisation fix arrives. Switch on drift and drive the base: the dashed robot is where the robot believes it is, and it slides away from the true one while map to odom stays the identity. A loop closure sets map to odom so the belief lands on the truth. The jump is in map to odom; odom to base_link is untouched.

The drift on this page is an illustration, not a measurement of any robot: each metre driven adds a fixed heading error, and every distance reads a fixed share too long. The point is the shape of the failure, not its size.

It is the first stage because a lot of a robot’s early bugs are frame bugs: a transform applied the wrong way round, or a point read in one frame and used in another.

Exercise

Write a tf2 static broadcaster and listener.

  1. Follow the tf2 introduction, which uses the turtlesim demo.
  2. Write a static broadcaster and a listener of your own.
  3. Then compute, by hand and in numpy, where a point your camera sees lands in the map frame, and compare it with what tf2 says.

Sources

  1. Modern Robotics Modern Robotics: Mechanics, Planning, and Control (K. M. Lynch, F. C. Park; Cambridge University Press). 2017; updated first edition Dec 2019; free preprint PDF, print paid; read 2026-10-22.

    • Chapters 2 and 3: configuration space and rigid-body motions
    • Chapter 3: homogeneous transforms, composition and inverses
  2. REP 103 Standard Units of Measure and Coordinate Conventions. ros-infrastructure/rep commit 11ca24a, read 2026-10-22.

    • Right-handed axes; x forward, y left, z up for bodies; ENU for geography
  3. REP 105 Coordinate Frames for Mobile Platforms. ros-infrastructure/rep commit 11ca24a, read 2026-10-22.

    • map, odom and base_link; odom is continuous but drifts; map does not drift but can jump
  4. ROS 2: tf2 Introducing tf2, tutorial (ROS 2 Lyrical documentation). lyrical branch df1973e, read from the docs repository; page opened in a browser 2026-10-22.

    • Introduction to tf2 and the turtlesim demo
  5. Articulated Robotics Articulated Robotics tutorials, including Coordinate Transforms for Robotics (J. Newans). free to read; read 2026-10-22.

    • Coordinate Transforms for Robotics series

Everything here is paraphrased from the sources, not quoted, and every figure is attributed to one. Prices are as of the date read and change. Anything illustrative is labelled as such. Where a source is silent, or could not be checked, the page leaves the fact out.