.. _isaac_sim_app_tutorial_ros_tf: =============================== Transform Trees and Odometry =============================== Learning Objectives ======================= In this example, we will learn to - TF publisher to publish the camera as part of the TF tree. - Publish an articulation tree on TF - Odometry Publisher **Prerequisite** - Completed the ROS :ref:`isaac_sim_app_tutorial_ros_camera` and :ref:`isaac_sim_app_tutorial_ros_turtlebot` tutorial. TF Tree Publisher ======================= TF Publisher ^^^^^^^^^^^^^^^^^^^^ Assuming you've already gone through the ROS 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 *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 both *Camera_1* and *Camera_2* to the *targetPrims* field. #. Examine the transform tree in a ROS-enabled terminal: ``rostopic 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. .. figure:: /content/images/isaac_sim_ros_tf_graph.png :align: center :width: 800 :alt: Turtlebot TF Graph 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 ``/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 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 ``+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 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*. Odometry Publisher ======================= To setup Odometry publisher, compose an Action Graph that matches the following image. .. figure:: /content/images/isaac_sim_ros_odom_graph.png :align: center :width: 800 :alt: Turtlebot Odom Graph 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 ``/base_link`` frame. 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, :ref:`isaac_sim_app_tutorial_ros_teleport`, to learn how to use the Teleport Service ROS Bridge.