Transform Trees and Odometry#
Learning Objectives#
In this example, you learn to:
TF publisher to publish the camera as part of the TF tree.
Publish an articulation tree on TF.
Odometry Publisher.
Getting Started#
Prerequisite
Completed the ROS Cameras and URDF Import: Turtlebot tutorial.
ROS bridge is enabled and
roscore
is running.
TF Tree Publisher#
TF Publisher#
Assuming you’ve already gone through the ROS camera tutorial and have two cameras on stage already, add those cameras to a TF tree, so that they can track the camera’s position in the global frame.
In a new or existing Action Graph window, add a ROS1 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 ROS1 Publish Transform Tree node, add the camera and Lidar sensor prims to the targetPrims field: /World/Camera_1, /World/Camera_2 and /World/turtlebot3_burger/base_scan/Lidar.
Examine the transform tree in a ROS-enabled terminal:
rostopic echo /tf
. Verify that both cameras are in the TF tree. Move the camera or Lidar around inside the viewport and see how the camera’s pose changes.
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 are published automatically. Add /World/turtlebot3_burger to the targetPrims field. Verify that the transforms of all the links of the robot, fixed or articulated, are published on the /tf
topic.
Important
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 clicking 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 +ADD button, and add Physics > Articulation Root.
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 want to get the transforms relative to something else, such as a camera, make sure to indicate that in the parentPrim field.
For this scene, make all prims in the TurtleBot the child frames of the base_link
frame. To do so, add /World/turtlebot3_burger/base_link in the parentPrim field. Stop and Play the simulation between property changes, to verify that the /base_link
is the parent frame for all other robot frames and camera frames.
Odometry Publisher#
To setup the 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
topic, and a Raw TF publisher that publishes the singular transform from /odom
frame to /base_link
frame.
Run rosrun rqt_tf_tree rqt_tf_tree
to get a graph of the constructed TF tree.
Testing the TurtleBot#
You are done setting up the TurtleBot! You can drive it around to see all the sensors and frames being visualized in RViz.
Open the turtlebot_config RViz file using this command: rviz -d /noetic_ws/src/isaac_tutorials/rviz/turtlebot_config.rviz
Summary#
This tutorial covered:
TF publisher to publish sensors and full articulation trees
Raw TF publisher to publish individual transforms
Odometry Publisher
Next Steps#
Continue on to the next tutorial in our ROS Tutorials series, Teleport Service, to learn how to use the Teleport Service ROS Bridge.