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

Why is tf_broadcaster a subscriber and tf_listener a publisher?

asked 2018-10-01 09:07:23 -0500

arta gravatar image

Dear all, I am rather new to ROS and I do not understand the tf library very well. I am going through tutorials, in particular those on http://wiki.ros.org/tf/Tutorials/ . I do not understand the tf_listener and the tf_broadcaster tutorial. If i understand correctly, the tf_broadcaster builds or updates the transformation tree representing the robot. On the other hand, the tf_listener makes queries on that tree.

In this sense, why is the tf_broadcaster associated with ropsy.Subscriber? Should the tree not be published instead? And on the other hand, why is tf_listener not associated with rospy.Subscriber, but rather with ropsy.Listener?

I feel that I am understanding something very wrongly. If someone could light my lanter, I'd appreciate! Have a nice day!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-10-01 09:48:21 -0500

gvdhoorn gravatar image

updated 2018-10-01 09:52:55 -0500

You don't make it very explicit, but I believe you are referring to the way the Writing a tf broadcaster (Python) and Writing a tf listener (Python) tutorials are setup.

In those tutorials, the broadcaster example creates a Subscriber, and the listener example creates a Publisher.

However, the publisher and subscriber are in there for a different reason. There is no requirement for them to be there, nor are they needed for either broadcaster or listener to work.

In both tutorials the publisher and subscriber are created to do 'something useful'.

In the case of Writing a tf broadcaster the subscribers callback takes in turtlesim/Pose messages (on the /<name_of_your_turtlebot>/pose topic) and broadcasts them as TF frames.

In the case of Writing a tf listener a listener is created to -- at 10 Hz -- lookup the current relative poses of the two simulated turtles. The result of that lookup is then converted into a geometry_msgs/Twist and the publisher is used to publish the conversion result on the topic turtle2/cmd_vel.

The publisher and subscriber are thus not part of the TF infrastructure (in this example), but used to either publish the result attained by listening to TF or to drive a conversion process and then broadcast something to TF.

Summarising:

Why is tf_broadcaster a subscriber and tf_listener a publisher?

They aren't. Neither is tf_broadcaster a subscriber nor is tf_listener a publisher.

edit flag offensive delete link more

Comments

Yes I did not make it very explicit, but you understood me well. Thank you for the explanations. So the listener is listening to the tf tree, but then the corresponding lookups are published.

arta gravatar image arta  ( 2018-10-02 06:45:10 -0500 )edit

Question Tools

Stats

Asked: 2018-10-01 09:07:23 -0500

Seen: 1,121 times

Last updated: Oct 01 '18