Rosanswers logo


I have a question.

I have created a map using slam_gmapping package, then I save that map as map.yaml using rosrun map_server map_saver -f map.

Is it possible to use a laser and the map I have created with amcl for localization?

I appreciate your answer :)

Originally posted by acp on ROS Answers with karma: 556 on 2013-04-12

Post score: 0


1 Answer 1


Rosanswers logo

Short answer: yes.

Longer answer: Yes, it is possible. Use the map_server to publish your saved map, start amcl and use rviz to estimate the inital pose. Then move your robot around and see, if the localization is working. :)

Originally posted by Ben_S with karma: 2510 on 2013-04-12

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by acp on 2013-04-12:
well, I do the following: I use rosrun map_server map_server map.yaml then in another console I use rosrun amcl amcl scan. Then the only topic I see in rviz under Pose is /move_base_simple/goal. I supposed to see amcl_pose topic under Pose, right?

Comment by Ben_S on 2013-04-12:
According to the docs, amcl publishes the pose as geometry_msgs/PoseWithCovarianceStamped. But you can also add displays for the particlecloud (geometry_msgs/PoseArray) and tf. Through tf, amcl should publish the most likely transform between your map and odom.

Comment by acp on 2013-04-12:
well, i have 2 issues, 1.-how i can set the initial pose 2--why my map gets rotated after I have published it and visualized in rviz?

Comment by Ben_S on 2013-04-12:\

  1. In rviz you should have a "2d pose estimate" button. 2) Depending on your fixed frame, the visualized map can rotate if the best guess by amcl changes. Try setting the fixed frame to /map in rviz.

Comment by acp on 2013-04-14:
Well, it seems to be as it everything is working, the only issue now is how to see the estimated poses produced by amcl in rviz? in other words, how can I see that amcl is working?

Comment by Ben_S on 2013-04-14:
Add a display of type PoseArray to rviz, set the topic to /particlecloud and then drive around a little bit. You then should see all the pose-guesses of amcl as small arrows in rviz.

Comment by acp on 2013-04-15:
Well, it seems to be as PoseAarray is working under rviz, however, from the beginning the amcl algorithm spreads particles even outside the map. Is that normal? or is there a way to fix it?

Comment by acp on 2013-04-15:
Since amcl publishes the pose as geometry_msgs/PoseWithCovarianceStamped, how can I see the poses with covariance under rviz?

Comment by Ben_S on 2013-04-15:
Thats normal. You can use the "2d pose estimate" in rviz to give it a hint, where to start. (Click the button and drag the arrow on the map.) Regarding the visualization of PoseWithCovarianceStamped: I dont know if that is possible. (rviz does not seem to have a builtin display for that...)

Comment by acp on 2013-04-18:
Well, it seems to be as if the navigation is working properly. Just one issue 1.-when I set the '2d pose estimate' and then '2d nav goal' the robot goes to the goal with a lot of rotations, is there any way to make the robot goes a straight line?

Comment by FuerteNewbie on 2013-11-21:
I guess visualizing PoseWithCovarianceStamped is not available in rviz currently but you can 'rostopic echo amcl_pose' to see the message that feedback to you every time the filter update.


Your Answer

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