Ask Your Question

Is it possible to use amcl and slam gmapping at the same time?

asked 2021-10-05 00:29:38 -0600

troyelex gravatar image

I want to use static map by using amcl. Also want to build map using gmapping on another topic from the same robot at the same time. Is it possible?

edit retag flag offensive close merge delete


I think it's not possible, because both amcl node and slam_gmapping node subscribe or publish to some same topic like /map, /tf, etc. Using both nodes at the same time may results in inaccurate outputs. You can see the topics they interact with here amclgmapping.

Kevin1719 gravatar image Kevin1719  ( 2021-10-05 03:23:18 -0600 )edit

Or maybe you can try to push common topics into namespaces to seperate them for different uses.

Kevin1719 gravatar image Kevin1719  ( 2021-10-05 03:27:09 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-10-05 03:25:21 -0600

Per Edwardsson gravatar image

Even if both of them deal with maps, the function of them in ROS is to provide the map -> odom transform (see nav2 writeup for more information). Only one node should provide this transform, or you will have very jittery movement (in the map frame, which is typically the one you care about). It is likely that AMCL will provide disturbance for Gmapping as it tries to make a map. It is therefore not only unnecessary to use AMCL if you already use Gmapping, it is directly problematic.

The way you go about solving this can be done in a few ways, but the simplest is probably to have two different launch files. One for active mapping, and one for navigating in a previously mapped area. Personally, I don't think AMCL is very useful if you have another library doing SLAM, since it definitely needs to keep track of the map -> odom transform. Another, more involved, solution is to use a lifecycle manager to deactivate Gmapping once mapping is done, and instead activate AMCL for navigation.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-10-05 00:29:38 -0600

Seen: 44 times

Last updated: Oct 05 '21