-
Notifications
You must be signed in to change notification settings - Fork 7
The ROS TF tree
The tf system in ROS keeps track of multiple coordinate frames and maintains the relationship between them in a tree structure.
-
Launch the visualisation of a RR arm:
ros2 launch week2 view_robot.launch.py
-
On rviz, add the TF object.
-
You should now see a schematic 3D representation of all your links and their reference frames (you can disable the robot model visualisation for ease of view):
Here, the x, y, and z axes of each frame are represented by red, green, and blue lines respectively. The parent-child relationship between the coordinate frames is shown through an arrow (purple pointer tip) pointing from the child to its parent frame.
From a terminal window, you can visualise the computed transformations between any two frames in the TF tree. The general command is in this form:
ros2 run tf2_ros tf2_echo <source_frame> <target_frame>
For example, let's visualise the transformation between the base of the robot and the final end effector frame:
ros2 run tf2_ros tf2_echo base_link tool_link
and you'll see something translation and rotation parameters, also represented as an homogeneous transformation matrix:
At time 1707135675.157117663
- Translation: [1.332, 0.200, 1.811]
- Rotation: in Quaternion [0.000, 0.934, 0.000, 0.357]
- Rotation: in RPY (radian) [3.142, 0.730, 3.142]
- Rotation: in RPY (degree) [180.000, 41.832, 180.000]
- Matrix:
-0.745 0.000 0.667 1.332
0.000 1.000 0.000 0.200
-0.667 0.000 -0.745 1.811
0.000 0.000 0.000 1.000
Try it yourself:
Check how translation and orientation changes when you move the robot's joints. Can you identify the elementary transformations you have seen in class?
Parts for the workshops are extracted, edited from and/or inspired by the following sources.
- Official ROS humble tutorials: https://docs.ros.org/en/humble/Tutorials.html
- Elephant Robotics docs: https://docs.elephantrobotics.com/docs/gitbook-en/