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

How to build a map using slam_gmapping & amcl

asked 2015-09-07 04:28:20 -0600

rosRabbit gravatar image

updated 2015-09-07 04:29:22 -0600


I want to build a map using slam_gmapping algorithm with rplidar data. Now I could generate a good map with high quality when the rplidar is static, which I mean the map with clear boundary. However, when I move the rplidar with my hand, the boundary is not that smooth. I think the reason for this is the bad result of scan register when moving the rplidar. Since AMCL could estimate the location of rplidar, I want to use this information with slam_gmapping to generate a map with good quality. Is it possible to get it? If yes, how?Thanks very much! :)

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2015-09-07 08:09:38 -0600

allenh1 gravatar image

While amcl is a part of ROS, I might suggest you look at HectorSLAM instead. This requires no odometry for SLAM. But, keep in mind, there is no such thing as a perfect map in this field.

edit flag offensive delete link more


Hi, Thanks for replying. I know that Hector_slam could generate a map without odometry information. However, I still want to use slam_gmapping for its performance. Do you know how to combine AMCL with slam_gmapping? Thanks!

rosRabbit gravatar image rosRabbit  ( 2015-09-08 00:29:09 -0600 )edit

@rosRabbit as far as I know, you can only use amcl after your map is built, not while you are building it. As gmapping relies on the odometry of your base and you do not have it, you should use HectorSlam, as suggested by @allenh1, which can build fairly accurate maps only with laser scans.

Procópio gravatar image Procópio  ( 2015-09-08 02:33:49 -0600 )edit

answered 2015-09-08 02:51:59 -0600

osmancns gravatar image

You need to first save your map after mapping with gmapping. And next you can use AMCL for robot pose estimation. example for save your map :

after that process, you can use amcl launch file as add your map (with your map name) in launch file.

BUT you need to laser_scan_matcher again with amcl for good odometry

<node name="map_server" pkg="map_server" type="map_server" args="$(find rover_map)/launch/amcl_map.yaml" />
<node pkg="amcl" type="amcl" name="amcl" output="screen">

  <arg name="use_map_topic"   default="true"/>
  <arg name="initial_pose_x"  default="0.0"/>
  <arg name="initial_pose_y"  default="0.0"/>
  <arg name="initial_pose_a"  default="0.0"/>

<param name="odom_frame_id" value="odom_combined"/>
<param name="base_frame_id" value="base_footprint"/>
<param name="global_frame_id" value="map"/>
<param name="odom_model_type" value="diff"/>

<param name="transform_tolerance" value="0.5" />
<param name="gui_publish_rate" value="10.0"/> <!-- 5 -->
<param name="laser_max_beams" value="80"/>  <!-- 30 -->
<param name="min_particles" value="100"/>
<param name="max_particles" value="4000"/>
<param name="kld_err" value="0.05"/>
<param name="kld_z" value="0.99"/>
<param name="odom_alpha1" value="0.02"/> <!-- 0.2 -->
<param name="odom_alpha2" value="0.07"/> <!-- 0.2 -->
<!-- translation std dev, m -->
<param name="odom_alpha3" value="0.08"/> <!-- 0.8 -->
<param name="odom_alpha4" value="0.02"/> <!-- 0.2 -->
<param name="laser_max_range" value="5.6"/>
<param name="laser_z_hit" value="0.95"/>
<param name="laser_z_short" value="0.1"/>
<param name="laser_z_max" value="0.05"/>
<param name="laser_z_rand" value="0.05"/>
<param name="laser_sigma_hit" value="0.2"/>
<param name="laser_lambda_short" value="0.1"/>
<param name="laser_lambda_short" value="0.1"/>
<param name="laser_model_type" value="likelihood_field"/>
<!-- <param name="laser_model_type" value="beam"/> -->
<param name="laser_likelihood_max_dist" value="2.0"/>
<param name="update_min_d" value="0.08"/>  <!-- 0.2 **0.15-->
<param name="update_min_a" value="0.18"/>  <!-- 0.5 **0.12-->

<param name="resample_interval" value="1"/>
<param name="transform_tolerance" value="0.1"/> <!-- 0.1 -->
<param name="recovery_alpha_slow" value="0.0"/>
<param name="recovery_alpha_fast" value="0.0"/>

<param name="initial_pose_x" value="$(arg initial_pose_x)"/>
<param name="initial_pose_y" value="$(arg initial_pose_y)"/>
<param name="initial_pose_a" value="$(arg initial_pose_a)"/>
<param name="use_map_topic" value="$(arg use_map_topic)"/>

edit flag offensive delete link more

answered 2015-11-30 20:09:31 -0600

quentin gravatar image


So AMCL is going to provide a pose? Can I use hector_slam to provide AMCL with the odometry information instead of laser_scan_matcher? Therefore it would have two separated occupancyGrid topics, one with the known map, used by AMCL and one with the map created by hector_slam. The main advance of that as compared to hector_slam alone is that my path planning algorithm can leverage on the awareness of the map for more efficiency. Thanks for your help!

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-09-07 04:28:20 -0600

Seen: 2,445 times

Last updated: Nov 30 '15