0
$\begingroup$

Rosanswers logo

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!


Originally posted by Oper on ROS Answers with karma: 67 on 2016-07-22

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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!


Originally posted by 2ROS0 with karma: 1133 on 2016-07-22

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.