Publishing the TF Tree - UTRA-ART/Caffeine GitHub Wiki
Written by: Erick Mejia Uzeda
NOTE: This section assumes you have an existing URDF describing your robot.
To understand how the robot moves and the relationship between the various components, we must publish (broadcast) such data so that it can be appropriately converted from one coordinate frame to another. For some examples of why this is important, see the tf Robot Setup.
A default robot_setup.launch
file looks as follow:
<launch>
<arg name="model" default="$(find caffeine_description)/urdf/caffeine.urdf.xacro"/>
<!-- Parse and Condense URDF using xacro -->
<param name="robot_description" command="xacro --inorder '$(arg model)'"/>
<!-- Publish Joint States from URDF -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>
<!-- Publish Robot State from URDF -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
</launch>
NOTE: xacro.py is deprecated, use
xacro --inorder
instead
Python script that is used to parse and condense the urdf.xacro
file into XML for use within the .launch
file.
-
NOTE: we specify
robot_description
as a top level param such that is available to bothjoint_state_publisher
androbot_state_publisher
.
From Joint_State_Publisher wiki:
Reads the robot_description
(URDF) and parses it to find non-fixed joint and publishes all of them to onesensor_msgs/JointState
message.
As the name suggests, this node publishes the states of joints which is important for determining the kinematics of the robot.
From the Robot_State_Publisher wiki:
Reads the robot_description
(URDF) and subscribes to the joint_states
topic to calculate the forward kinematics of the robot and publish the results via tf.
In short, robot_state_publisher
publishes (broadcasts) the necessary transforms (coordinate frames) that need to be available for all your components while also taking into account your robot's joints.
Reference: