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

Revision history [back]

click to hide/show revision 1
initial version

Hi, so two things here:

"What algorithm I can use which will generate map and localize and at the same time?"

You have already used it, GMapping. GMapping is a Simulatenous Localization And Mapping (SLAM) algorithm which does exactly what you are asking for; creates a map while localizing within it.

"The problem is I've to provide AMCL with a generated map for it to localize"

I feel this is actually the problem you want to solve (heard of the XY problem?). It is not necessary to be mapping all the time and that won't be even a good solution for some situations (p.e. you want the robot to move to an area that is out of reach for the sensors).

A more appropiate solution for your problem would be map_server:

  1. Generate a map using GMapping
  2. Save the map using map_server: rosrun map_server map_saver -f mapname
  3. Stop Gmapping
  4. Load the map using map_server: rosrun map_server map_server mapname.yaml
  5. Load AMCL

After you have mapped for the first time and saved the map you only need to do steps 4. and 5.