7.ROS2_Gmapping mapping algorithm

 

wiki:http://wiki.ros.org/gmapping/

ros2 gmapping:https://github.com/Project-MANAS/slam_gmapping

 

1 Introduction

Advantages:Gmapping can construct indoor maps in real time. The amount of calculation required to construct small scene maps is small and the accuracy is high.

Disadvantages: As the scene grows, the number of particles required increases because each particle carries a map, so the amount of memory and computation required when building a large map increases. Therefore it is not suitable for building large scene maps. And there is no loop detection, so the map may be misaligned when the loop is closed. Although increasing the number of particles can close the map, it comes at the expense of increased calculations and memory.

 

2. Use

2.1. Configuration before use

Note: Since the Muto series robots are equipped with multiple lidar devices, the factory system has been configured with routines for multiple devices. However, since the product cannot be automatically recognized, the radar model needs to be manually set.

After entering the container: Make the following modifications according to the lidar type:

After the modification is completed, save and exit vim, and then execute:

You can see the current modified lidar type.

 

2.2. Specific use

Note: When building a map, the slower the speed, the better the effect (note that the rotation speed should be slower). If the speed is too fast, the effect will be poor.

First, the port binding operation needs to be done in the host [Muto]. The two devices of lidar and serial port are mainly used here;

Then check whether the lidar and serial device are in port binding state: Run the following command on the host machine [Muto] to check. Successful binding is as follows:

image-20230421151543423

If it shows that the lidar or serial device is not bound, you can plug and unplug the USB cable to check again.

 

Enter the docker container and execute the following launch file in a terminal:

  1. Start mapping
  1. Start rviz to display the map. It is recommended to perform this step in [Virtual Machine]. Multi-machine communication needs to be configured in the virtual machine.

image-20230420160916499

 

  1. Start the keyboard control node. It is recommended to perform this step in a virtual machine. Multi-machine communication needs to be configured in the virtual machine.

Or use the remote control [slowly moving car] to start mapping until a complete map is created

image-20230420160249189

 

 

  1. Save the map with the following path:

Save path is as follows:

image-20230420161956140

A pgm picture, a yaml file yahboomcar.yaml

Parameter analysis:

 

 

3. Node analysis

 

3.1. Display calculation graph

gmapping

 

 

3.2. gmapping node details

image-20230811174557434

image-20230811173536898

 

3.3. TF transformation

image-20230811173436568