ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Question about /tf topic

asked 2020-05-31 21:08:06 -0500

Osman gravatar image

updated 2020-05-31 21:51:53 -0500

So in the recording the map tutorial, they use the command rosbag record -O mylaserdata /base_scan /tf. Now I understand that the /base_scan topic is being published by our laser nodes, but what about the /tf? I already looked at the stuff about tf on the ros wiki, but I don't quite understand how tf is used here? (should I write the node that publishes tf?)

Edit: when I run the minimal.launch launch file for my robot (turtlebot2), there is a /tf topic being publishes, do I have to modify anything there?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-06-05 07:28:59 -0500

Weasfas gravatar image

Hi @Osman,

The tf is a usefull way to compress all cordinate frames information from a robot. A normal robot contains generally a big set of frames or coordiante systems that allow to know a position of a point in a 3D space relative to the frame in question. When you launch a robot, you are launching also a node that converts the robot_description into a tf_tree that contains all robot coordinate systems and their connections.

So to answer the question about its usage I would say that they record the /tf topic, in which all information about the coordinate frames of the robot is stored, because of multiple things. The first one can be simply for visualization since rviz needs a fixed frame to properly render things and it would be better to have the full tf_tree to provide all the needed transformation between frames in order to know where are all points in the robot and how the are connected.

On the other hand, when you record a stamped message topic, you may notice that in its header it contains the frame_id the data is associated with. It is not the same having a pose associated with the base_link frame as to have it associated with the laser_link, because the position (relatives) depends on the coordinate system. So if you save the laser data, it is probably associated with the laser_link, thus you will need the tf_tree to know how the points provided by the laser in the laser_link frame are transformed to the robot base_link or any important frames in you environment.

Maybe when you use the recorded bag you want to transform the laser data from the laser_link to the base_link and perform some operation in that frame, but, if you do not save sufficient tf information in the bag, you will not able to know the trasnformation matrix you need to apply to convert all laser points from the laser_link frame to your base_link.

I am sure this explanation is not the best one and I am sure other members of the community will be glad to give more infor about this, but hope it helps you tyo understand the purpose of the tf.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-05-31 21:08:06 -0500

Seen: 1,450 times

Last updated: Jun 05 '20