Robotics StackExchange | Archived questions

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

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?

Asked by troyelex on 2021-10-05 00:29:38 UTC

Comments

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 amcl gmapping.

Asked by Kevin1719 on 2021-10-05 03:23:18 UTC

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

Asked by Kevin1719 on 2021-10-05 03:27:09 UTC

Answers

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.

Asked by Per Edwardsson on 2021-10-05 03:25:21 UTC

Comments