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

multirobot tf tree

asked 2011-07-29 05:13:31 -0500

joan gravatar image

I was reading the ROS Best Practices page for the REP 105 regarding the coordinate frames in order to start building a multi-robot ready tf tree.

I would like to be able to launch two robots within the same roscore environment. This would imply some modifications to the standard tf tree proposed, for the need to distinguish between the frames of one robot from the other.

For what I have seen, one of the common ways to build the robot tf tree is through the URDF files. In there all robot frames are named. From here it comes my first question. As my two robots have exactly the same configuration I wanted to use the same urdf file, but that would duplicate the frame names. Do I have to create a different urdf file for each robot?

Assuming two robots, r1 and r2, then the final tf tree would look something like this:

                  map
                 /       \
     odom_r1    odom_r2
              |             |
base_link_r1    base_link_r2
              |             |
  sensors_r1    sensors_r2

I do not specially like this solution, but as the frame names must be unique I can not see a better one.

As I read in several anwsers the odometry node is supposed to send the transforms from odom to base_link, while a localization node would send the transforms from map to odom to correct the odometry drifting over time. In this "new" tf scheme this solution is still valid, the nodes would just require a parameter remapping to work with "odom_r1" instead of just "odom".

I just wanted to be sure my assumptions are coherent with the ROS directions before starting the whole implementation.

edit retag flag offensive close merge delete

Comments

there is a multi_robot_test.launch file I played around with and mentioned in http://answers.ros.org/question/1826/how-to-import-two-pr2-on-gazebo-at-the-same-time
hsu gravatar image hsu  ( 2011-08-24 11:59:58 -0500 )edit

2 Answers

Sort by » oldest newest most voted
9

answered 2011-07-29 05:29:53 -0500

Eric Perko gravatar image

The tf_prefix is the recommended way of using multiple robots. This will allow you to use the same URDFs (or at least it should), since the prefix will turn things into r1/odom and r2/odom automatically depending on which robot you are on.

See Coordinate Frame Conventions: Naming, the TF FAQ and the mailing list archive for more info on tf_prefix. I've never used it personally, but it should help you split up things across robots without manually changing all of the frame names.

edit flag offensive delete link more

Comments

Thanks for your answer it was really useful. Please look at my answer below for additional doubts
joan gravatar image joan  ( 2011-08-24 01:34:15 -0500 )edit
0

answered 2011-08-24 01:35:00 -0500

joan gravatar image

I have added the tf_prefix to my robot state publisher node. All my frames have been pushed down accordingly.

My launch file is as follows:

<!-- robot urdf model -->
<param name="robot_description" command="cat $(find urdf_pkg)/urdf/my_robot.urdf" />

<!-- robot state publisher node -->
<node pkg="robot_state_publisher"
      type="state_publisher"
      name="robot_state_publisher">
  <param name="~tf_prefix" value="robot_name" type="str"/>
</node>

I have another node which publishes an odometry message. I have added as well the tf_prefix to its launch file. Common frames correctly match their names as I have seen in the resulting tf tree. However, the odometry message does not get updated with the tf_prefix. The msg.header.frame_id and msg.child_frame_id fields remain the same.

How can I push down frame ids from other topics than the tf::TransformBroadcaster, i.e. the odometry topic message?

edit flag offensive delete link more

Comments

You need to resolve the frame_id. For that you can use the TransformListener::resolve or tf::resolve methods.
dornhege gravatar image dornhege  ( 2011-08-24 02:14:09 -0500 )edit

@joan hi, im doing the same work as you mentioned above. I'm trying to spawning two erratic robots. tf_prefix is working fine in my case but I have problem in publishing multiple odom e.g. r1/odom. If u have solved that problem please post your solution

abdullah gravatar image abdullah  ( 2012-04-19 11:38:08 -0500 )edit

hi, I am very interested in simulate multiple robots and have the same troubles. How do you solve this? I try without ~ in the tf_prefix and works fine. Like this: <param name="tf_prefix" type="string" value="summit_one" />

pmarinplaza gravatar image pmarinplaza  ( 2012-08-02 00:24:40 -0500 )edit
2

This should really be a separate question and not an answer.

Asomerville gravatar image Asomerville  ( 2013-03-19 05:20:59 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2011-07-29 05:13:31 -0500

Seen: 3,151 times

Last updated: Aug 24 '11