Ask Your Question

rosrun tf tf_echo /map /base_link VS. Coding implementation. [closed]

asked 2014-05-05 02:15:27 -0600

RB gravatar image

updated 2014-05-05 03:56:09 -0600


I want to calculate robot's current position with respect to the map. Following is my "rosrun tf view_frames"

tf tree

I have tried following commands which gives robot position with respect to /map frame.

rosrun tf tf_echo /map /base_link

Output is here:map to base_link.jpg

Now same thing, I tried to perform using the code here

But the output of rxconsole is shown below:: transform.jpg.

I am just wondering why the results of the code and that of "rosrun tf tf_echo /map /base_link" is not matching?

I am getting "Got a transform! x = 0.000000, y =0.000000", even after 1sec when I use the code. But "rosrun tf tf_echo /map /base_link", gives actual robot position with respect to the map as you can see the screen shot.

Question1: Is there any way to get the exact position of the robot while moving in the environment?

Question 2: I don’t know how the above command gives position of the robot with respect to the map, but the implementation of the SAME COMMAND gives some INVALID result?

Question 3: Is there any way to emulate the command "rosrun tf tf_echo /map /base_link" in coding?

Please help..........

Many Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Procópio
close date 2015-05-20 10:32:17.123823


Hi, is it possible that you share the code via another method? I have no access to and I didn't manage to overcome it. Thanks in advance!

nursima gravatar image nursima  ( 2020-01-14 02:09:59 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-05-05 05:28:06 -0600

RB gravatar image

I got the answer, forgot to add

listener.lookupTransform("/map","/base_link",ros::Time(0), transform);

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-05-05 02:15:27 -0600

Seen: 1,957 times

Last updated: May 05 '14