5. ROS2 Transform Trees and Odometry
5.1. Learning Objectives
In this example, we will learn to
Add a TF publisher to publish the camera positions as part of the TF tree.
Publish pose of objects relative to the camera
5.2. TF Tree Publisher
5.2.1. TF Publisher
Assuming you’ve already gone through the ROS2 camera tutorial and have two cameras on stage already, let’s add those cameras to a TF tree, so that we can track the camera’s position in the global frame.
In a new or existing Action Graph window, add a ROS2 Publish Transform Tree node, and connect it up with On Playback Tick and Isaac Read Simulation Time, like the image below.
In the Property tab for the ROS2 Publish Transform Tree node, add both Camera_1 and Camera_2 to the targetPrims field.
Examine the transform tree in a ROS2-enabled terminal:
ros2 topic echo /tf. You should find both cameras on the TF tree. Move the camera around inside the viewport and see how the camera’s pose changes.
5.2.2. Articulation Transforms
To get the transforms of each linkage on an articulated robot, add the robot’s articulation root to the targetPrims field. All the linkages subsequent to the articulation root will be published automatically. Add /World/turtlebot3_burger to the targetPrims field, and see that the transforms of all the links of the robot, fixed or articulated, will be published on the
If you find that the generated tf tree for an articulated robot chose the wrong link as the root link, use the following step to manually select the articulation root link. This is commonly seen when importing robots using the URDF Importer with “Merge Fixed Link” checked, as well as for mobile robots.
Select the robot’s root prim on the Stage Tree, in its “Raw USD Properties” tab, find the “Articulation Root” Section. Delete it by click on the “X” on the right upper corner inside the section.
Select the desired link on the Stage Tree, inside its “Raw USD Properties” Tab, click on the
+ADDbutton, and add Physics > Articulation Root.
5.2.3. Publish Relative Transforms
By default, the transforms are in reference to the world frame. You can check that the
/base_link transform of the Turtlebot is published relative to the
/World. If you wish to get the transforms relative to something else, such as a camera, make sure to indicate that in the parentPrim field. Add Camera_1 in the parentPrim field, Stop and Play the simulation between property changes, and you can see that the
/base_link transform is now relative to Camera_1.
5.3. Odometry Publisher
To setup Odometry publisher, compose an Action Graph that matches the following image.
In the Property tab for the Isaac Compute Odometry Node, add the Turtlebot to its Chassis Prim input field. This node calculates the position of the robot. Its output is fed into both a publisher for the
/odom Rostopic, and a TF publisher that publishes the singular transform from
/odom frame to
This tutorial covered
TF publisher to publish sensors and full articulation trees
Raw TF publisher to publish individual transforms
5.4.1. Next Steps
Continue on to the next tutorial in our ROS2 Tutorials series, ROS2 Navigation to learn to use ROS2 Nav2 with Omniverse Isaac Sim.