TF and rqt Frame Editor

Goal: get an intuitive understanding of coordinate frames and parent-child relationships, by placing frames by hand and watching them in RViz.

Tool: the rqt Frame Editor (package frame_editor, branch feature/urdf-preview).

Slides: Coordinate transforms (TF2).

1. Build the Frame Editor

In the src/ folder of your workspace:

git clone -b feature/urdf-preview https://github.com/ROS-Industrial-Session-Common/rqt_frame_editor_plugin.git
cd ..
source /opt/ros/jazzy/setup.bash
rosdep install --from-paths src/rqt_frame_editor_plugin --ignore-src -y
colcon build --symlink-install --packages-select frame_editor
source install/setup.bash

2. Add frames

  1. Open rqt in a terminal where the workspace is sourced (--force-discover finds the new plugin):

    rqt --force-discover
    

    rqt window

  2. Open the Frame Editor: Plugins → Frame Editor Plugin.

  3. Start a blank edition with the New button.

    Frame Editor: New button

  4. Add a frame with Add New: name it object_1, with world as parent.

    Frame Editor: Add New frame

  5. Open RViz in another terminal, and set the fixed frame to world:

    rviz2
    

    RViz: set fixed frame to world

  6. Add the TF display: Add → TF → OK.

    RViz: Add display

    RViz: TF display

  7. Experiment: add frames, change the marker size and the visibility, move the frames with the Frame Editor and watch them in RViz.

3. Parent and child

  1. Add a child frame: Add New, name it object_2, with object_1 as parent.

  2. Move the parent: move object_1 and watch object_2 follow. The child stores its pose relative to its parent.

  3. Check the transform in a third terminal:

    ros2 run tf2_ros tf2_echo world object_2
    

    Move object_1 again: the printed transform changes, although you only moved the parent.

  4. Change a parent: set the parent of object_2 to world, once with Parent (keep relative) and once with Parent (keep absolute). What is the difference? Then set it back to object_1.

Keep object_1 and object_2, the Frame Editor and RViz running: the next exercise, TF and Python, uses them.

Questions

  • Why can tf2_echo world object_2 print a transform, although nobody publishes world → object_2 directly?

  • Which topic do the editor’s frames use, /tf or /tf_static? Check with ros2 topic info /tf_static --verbose.