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

What is the difference between tf_broadcaster and tf_listener?

asked 2016-07-22 05:53:39 -0500

Oper gravatar image

I'm trying to code tf configuration in navigation stack, i'm having some problem in understanding if i need to code one tf_broadcaster and one tf_listener for each sensor or just one tf_broadcaster per sensor.

For example:
My robot has 4 sonar sensor, i'm publishing they'r values as 4 Range messages and 1 LaserScan message.
In the same node where values of sensor are taken i coded 4 tf_broadcaster per 4 Range messages, and 1 tf_broadcaster per LaserScan message.
Should i code even the tf_listener? What is the right configuration for my case? Can u help me? Thank u!

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2016-07-22 10:39:48 -0500

2ROS0 gravatar image

updated 2016-07-22 10:42:45 -0500

ROS developers generally use the tf2 library to represent different coordinate frames of the robot. tf2 represents data in a tree data structure.

Use of tf_broadcaster: For each new sensor you add you might need one or more coordinate frames (physical location of sensor, origin of sensor data etc.) to be added into the tree. The transform broadcaster class API lets you do that. So you will need a transform broadcaster in each of your sensor nodes. Use that to add transforms for your four range messages, one laser scan messages and any other supplementary coordinate frame you might need.

Use of tf_listener: Once you have your tree with all required transforms, other nodes that need transformations between coordinate frames can directly access these to perform whatever function they're intended to. So in those nodes, you will need a transform listener that gets you the transforms between any two frames.

Hope this helps!

edit flag offensive delete link more
0

answered 2016-07-22 09:29:45 -0500

emchenk gravatar image

You can use the tf_broadcaster to specify where the coordinate systems of your sensors are. The broadcaster will send these transforms to the tf tree so other nodes can use it. The tf_listener is used to query the tf tree. You can use a tf_listener if you want to know the transformation between two frames in the tf tree. But for your application, it doesn't seem like you need it.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-07-22 05:53:39 -0500

Seen: 649 times

Last updated: Jul 22 '16