Hector-SLAM Broken Maps in ROS

Authors: Gavin Bauknecht, William Jandak, and Daniel Rico-Aniles 

Problem Description

When the RPlidar node and the Hector-Slam mapping are not properly tuned, the robot loses position and the map breaks. An example of a broken map when running Hector-SLAM is shown in  Figure 1.  For this example Hector-SLAM was running on a Raspberry Pi 4 with 8GB or RAM and using a SLAMTEC A1 RPLidar sensor.

Figure 1 Broken map when running Hector-SLAM.

Solution

The solution that has worked best for the team was to modified 3 files, the first two to calibrate the RPLidar and  the  third to calibrate Hector-SLAM mapping. The modified files are listed below.

The calibration was performed empirically with trail and error. The specific values worked for our custom designed robot and might differ to other robotic platforms, but the steps for calibration should be, in essence, the same. 

RPLidar Calibration

STEP 1 - rplidar.launch Modification

The RPLidar Sensor has the capabilities to adjust the number of points that it generates on each scanning rotation. The higher the number of points better localization. On the other hand, less points offers a faster update time. The modes of operation of the RPLidar are:

In the case of our robot  Express is being used.


<param name="scan_mode"        type="string"    value="Operation_Mode"/>


The final rplidar.launch file looks as shown in Figure 2.

Figure 2 rplidar.launch file contents.

STEP 2 - RPLidar Node File  Modification

The RPLidar node was modified to send only 50 messages instead of 1000 (default). 


ros::Publisher    scan_pub = nh.advertise<sensor_msgs::LaserScan>("scan", 50);


The modified section of the node.cpp file is shown in Figure 3.

Figure 3 node.cpp modified section.

Hector-SLAM Mapping Calibration

STEP 3 - Hector-SLAM Mapping File  Modification

There are 2 important parameters in the Hector-SLAM mapping launch file that can help to avoid getting a map broken, map_update_distance_thresh and map_update_angle_thresh. These parameters determined how often the map is updated, the units are meters and radians for the distance and angle respectively.



The used parameter values are shown shown in Figure 4.

Figure 4 Map update parameter inside the Hector-SLAM mapping launch file.

Results

After doing the above stated modification it was possible to generate a correct map running Hector-SLAM and teleoperating the robot with a bluetooth controller. The generated map is shown in Figure 5.

IMPORTANT the parameters have to be tuned so that  the robot can  move in straight line or turn  at 100% the speed without breaking the map.

Figure 5 Successful map generation.