0
$\begingroup$

Rosanswers logo

Hi all, I used gmapping to obtain the map.Now i want to localize my robot in this map,so that i can apply my path planning algorithm(A*).someone please help me to do this.


Originally posted by David John on ROS Answers with karma: 19 on 2016-02-21

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Hi!

First, i think that the package gmapping already does the localization for you, since gmapping is design to work with SLAM (Simulataneos localization and mapping), you can check this in the wiki http://wiki.ros.org/gmapping. If your robot is not being localized maybe you should check your tf tree, and make sure that there is a transformation between the frame /odom (the one where gmapping "publish" the localization information), and the base frame of your robot (by default should be /base_link and it should be connected, at the same time, to the other parts of your robot).

Anyway if you are searching for packages in ROS to perform the localization, the amcl package http://wiki.ros.org/amcl, is one option.

Hope this helps!


Originally posted by donmrsir with karma: 363 on 2016-02-22

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by David John on 2016-02-25:
thank you...i went through this tutorials.i applied this to turtlebot rosrun amcl amcl but it is showing that request for map failed.

Comment by donmrsir on 2016-02-25:
If you are you using gmapping, try set the param "use_map_topic" to true, this way the amcl node will read the information from the topic /map published by gmapping. To do this adding the following line in your launch should be enough:

 <param name="use_map_topic " value="true" />

Comment by donmrsir on 2016-02-25:
Or if you want to do a rosrun directly this should work:

rosrun amcl amcl _use_map_topic:=true

Comment by David John on 2016-02-25:
I did rosrun amcl amcl _use_map_topic:=true. I got map also but how can i find the grid in which the robot resides so that i can apply my A* algorithm.

Comment by donmrsir on 2016-02-25:
As you can see in the wiki documentation, the map is published in the /map topic, in the type of message Occupancy grid, while the pose of the robots is published in the topics /amcl_pose.

Comment by donmrsir on 2016-02-25:
You should then, just subscribe/publish to that topics and use that information, for that the following tutorial could help you. Tutorial

Comment by David John on 2016-02-25:
thank you sir..But when i do the same i'm getting the x,y coordinates of the robot in its current position. I want to know the index of the grid in which the robot is situated in the map so that I can apply my A* algorithm. Could you please help me to solve this problem.?

Comment by donmrsir on 2016-02-25:
Hi! Right now i am not quite sure about how to exactly doing that. What i know is that gmapping publish a map in the format of a occupancygrid msg see the msg documentation.

Comment by donmrsir on 2016-02-25:
So i think you should find some way to transform the x,y coordinates you obtain from amcl, to the occupancy grid of the map, and get the cell you are every moment. If after give it you still have the problem, you can open another question related to it

$\endgroup$

Your Answer

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