KevsRobots Learning Platform
By , Minute
tf2 is the ROS2 transform library, which lets the user keep track of multiple coordinate frames over time. tf2 maintains the relationship between coordinate frames in a tree structure buffered in time and lets the user transform points, vectors, etc. between any two coordinate frames at any desired point in time.
Transformations allow us to convert (or translate) one set of coordinates to another. Our robot, and the coordinates of the parts of the robot can be considered to be local to the robot.



The robot exists in the real world (or virtual world) in a world coordinate space.
We need to transform the data from the Lidar, known as the laser_frame (which is in the robots local coordinates), to the world coordinate space.
Local Coordinate start at the objects originWorld Coordinates have a different originTransformations translate coordinates between the local and real world
We will use TF2 to create the transform from the laser_frame to the world.
ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 laser_frame world
The six numbers are the position (x, y, z) and rotation (yaw, pitch, roll) between the two frames. All zeros means the laser is at the centre of our world, facing forwards. Newer ROS 2 releases prefer named arguments, which do the same thing:
ros2 run tf2_ros static_transform_publisher --frame-id laser_frame --child-frame-id world
You can use the arrows ← → on your keyboard to navigate between lessons.
Comments