Hi,
I want to calculate robot's current position with respect to the map.
**Following is my "rosrun tf view_frames"**
[tf tree](http://answers.ros.org/upfiles/13988714412451395.jpg)
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](/upfiles/1399291760642935.jpg)
**Now same thing, I tried to perform using the code** [here](http://pastebin.com/Z5pVWaTn)
But the output of rxconsole is shown below::
[transform.jpg](/upfiles/13992918927182973.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.
↧