# The tf transform between base_footprint of robot1 and base_footprint of robot1 have little errors on multi-robot systems?

Hello,everyone!Right now I'm doing some some simulations about multi-robot systems on Gazebo and what I have achieved are:

(1)I can launch multiple robots(for instance,2 robots) on Gazebo

(2)I can use the gazebo_ros_p3d plugin to get the ground truth coordinates of every robot and then use them to publish the corresponding /tf topics

(3)now I can build a tf tree like the following:

                                                                map
/     \
/       \
robot1_tf/base_footprint    robot2_tf/base_footprint


because of the limitation, I can only draw part of my tf tree. When I use the following command "rosrun tf tf_echo map robot1_tf/base_footprint ", and I get the data like:

• Translation: [1.545, 0.349, -0.000]

• Rotation: in Quaternion [0.007, -0.002, 0.965, 0.262]

in RPY (radian) [0.001, -0.014, 2.611]

in RPY (degree) [0.043, -0.827, 149.576]

Similarly, I use the use the following command "rosrun tf tf_echo map robot2_tf/base_footprint ", and I get the data like:

• Translation: [2.637, -0.130, -0.000]

• Rotation: in Quaternion [0.007, -0.001, 0.972, 0.233]

in RPY (radian) [0.001, -0.014, 2.671]

in RPY (degree) [0.043, -0.827, 153.057]

For the above two sets of data, I am very sure they are the ground truth data because I have echoed the the corresponding ground truth topics. However, when I used the command"rosrun tf tf_echo robot1_tf/base_footprint robot2_tf/base_footprint", I got the following data:

• Translation: [-1.184, -0.140, 0.017]
• Rotation: in Quaternion [0.000, 0.000, 0.030, 1.000]

in RPY (radian) [0.001, 0.000, 0.060]

in RPY (degree) [0.050, 0.001, 3.461]

and I also got a message like following when running this command:

Failure at 3656.843000000 Exception thrown:Could not find a connection between 'robot1_tf/base_footprint' and 'robot2_tf/base_footprint' because they are not part of the same tree.Tf has two or more unconnected trees.

(However, when I use the rosrun tf view_frames, I can get a whole tf tree which looks like normal instead of two or more unconnected trees)

As you can see, in terms of the Translation data, the translation data of robot1 add the translation data of robot2 do not equal to the translation data which was obtained by tf command.

Do you guys know why there would be some errors on the tf translation?Any answers, advice or suggestions are welcome! Thanks

edit retag close merge delete

Sort by » oldest newest most voted

The output of rosrun tf tf_echo robot1_tf/base_footprint robot2_tf/base_footprint seems totally fine to me. When you echo the transform between robot1_tf/base_footprint and map you get the distance and orientation of the frame base_frontprint FROM the frame map, same with robot2_tf/base_footprint. So if we look at the different data you gave (with rough approximation) :

• rosrun tf tf_echo map robot1_tf/base_footprint tells you that the base_footprint frame of robot_1 is at a distance of 1.5 meters on the x-axis and is rotated by 150° around the z-axis (in relation to the map frame orientation).

• rosrun tf tf_echo map robot2_tf/base_footprint tells you that the base_footprint frame of robot_2 is at a distance of 2.6 meters on the x-axis and is rotated by 150° around the z-axis (in relation to the map frame orientation).

So given that you can estimate that robot1/base_footprint and robot2/base_footprint are at a distance of 1.1 meter to each other and have almsot the same orientation which is exactly what rosrun tf tf_echo robot1_tf/base_footprint robot2_tf/base_footprint tells you. This command tells you the distance and orientation of the frame robot2_tf/base_frontprint FROM the frame robot1_tf/base_frontprint.

About your error message is there a typo ? There is the frame robot4_tf/base_footprint but you are talking about 2 robots since the beginning so you might not have given all the informations.

more

Thank you for answering! As for the error message, the frame "robot4_tf/base_footprint" is a typo, and I have already corrected it. It should be the "robot2_tf/base_footprint".

rosrun tf tf_echo map robot1_tf/base_footprint tells me that the base_footprint frame of robot_1 is at a distance of 1.545 meters on the x-axis. Similarly,rosrun tf tf_echo map robot2_tf/base_footprint tells me that the base_footprint frame of robot_2 is at a distance of 2.637 meters on the x-axis. So, we can calculate that the distance between robot1 and robot2 is equal to 2.637-1.545=1.092 meters, which is not equal to 1.184 meters that I obtained from rosrun tf tf_echo robot1_tf/base_footprint robot2_tf/base_footprint. I want to know why are they not equal.

By the way, I am sure this is not caused by the rounding of the data, as I have echoed the ground truth ...(more)

( 2019-10-31 14:39:19 -0500 )edit

hey,I guess I have found the reason why these distances are not equal. Because the data from the rosrun tf tf_echo map robot1_tf/base_footprint and rosrun tf tf_echo map robot2_tf/base_footprint are based on the map frame. However,the data from rosrun tf tf_echo robot1_tf/base_footprint robot2_tf/base_footprint is based on robot1_tf/base_footprint frame. Since the reference coordinates of the two sets of data are different, the data will be different. There are two ways to check：

1. length=sqrt（x^2+y^2+z^2） of these two ways is equal
2. According to the quaternions, we can get the related rotation matrix, and by using rotation matrix, actually these two coordinates are equal.
( 2019-11-06 15:28:27 -0500 )edit