ROS amcl Path planning with live gmapping map

asked 2019-11-19 05:57:02 -0600

Luigi.giggi gravatar image


I'm new with ROS (melodic version) and I'm using the navigation stack in order to create a Turtlebot3 robot ables to autonomously navigate in an unkown environment. I'm using the gmapping package that, with the lidar sensor equipped on the the robot, allows me to visualize a live map in Rviz by using the '/map' topic.

I've read the offical documentation of amcl package used for performing path planning by using a "known map", I've seen that if you store the generated map from gmapping in a file and if you configure amcl to use this map image you can easly find a path to a goal pose specified by using the GUI in rviz.

I've two questions:

Is it possible to use amcl to use the runtime generated map? In other words, is it possible to make the amcl work with the data coming from the /map topic instead of a static map? If yes, how? If not, is there any way to do so?

Is it possible to specify the navigation goal by code? If i'm not wrong I could publish a navigation message on the /move_base topic,am I right? If yes can you please me provide an example or the format that I should use to send this message?

Thanks to anyone that will try to help me.

edit retag flag offensive close merge delete


Just to be sure and I will need the community help to correct me if I am mistaken:

AMCL is a probabilistic localization system that implements the adaptive (or KLD-sampling) Monte Carlo localization approach.

Gmapping package implements a solution for the SLAM problem in laser-based robots.

When you are using AMCL there is no reason to use Gmapping, and the other way around because you already have the localization problem solved and the map is generating in the process.

Theoretically, looking at the diagram proposed in the move base wiki page, the map is always served as static by the map_server, because solving the navigation problem is not only about dealing with short terms path but also long term paths looking ahead in the map frame what you are going to have in the next steps. Thus having a static map is compulsory to navigate properly.

Weasfas gravatar image Weasfas  ( 2019-11-19 07:05:35 -0600 )edit

As for the second question, yes, you can implement a service/node/action lib that gives a goal programmatically. This tutorial explains the how-to.

Weasfas gravatar image Weasfas  ( 2019-11-19 07:05:49 -0600 )edit

Hi @Weasfas, thanks for your reply. So could you give me with any kind of tutorial where gmapping is used in combination with move mave package to perform path planning?

Luigi.giggi gravatar image Luigi.giggi  ( 2019-11-19 07:19:45 -0600 )edit

Hi @Luigi.giggi,

I am not an expert in this kind of things and I am sure there are community members more experienced in this field.

This things I can tell you from my experience with SLAM and mapping is that, generally you want to cope with two different tasks: The mapping process and the approach you use in order to navigate and discover the environment (Exploration vs Exploitation)

Maybe this post are usefull for your goals:

Is it possible to navigate and build map at the same time? Simultaneous autonomous navigation and mapping Goals and Navigation in dynamic maps using GMapping

Weasfas gravatar image Weasfas  ( 2019-11-19 07:27:41 -0600 )edit

According to rep-105, you have world -> map -> odom -> base_link, you get odom -> base_link from amcl and map -> odom from gmapping, so you cannot get rid of amcl, unless you provide some other source of odometry like robot_localization. Or use some lidar or camera Odometry method. And move_base requires odom to work in expected manner. I don't think there is an easy way to get move_base to use map generated by gmapping (I might be wrong here) as move_base handles costmap generation on it's own and can take in laserscan/pointcloud to generate a costmap. Hope this clarifies things a bit.

Choco93 gravatar image Choco93  ( 2019-11-19 08:55:41 -0600 )edit