The robot state publisher package helps to publish the state of the robot to tf. This package subscribes to joint states of the robot and publishes the 3D pose of each link using the kinematic representation from the URDF model. We can implement the robot state publisher node using the following line inside the launch file:
<!-- Starting robot state publish which will publish tf --> <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
In the preceding launch file, view_arm.launch, we started this node to publish the tf of the arm. We can visualize the transformation of the robot by clicking the tf option on RViz, shown as follows: