slam-toolbox Mapping

slam-toolbox Mapping1. Course Content2. slam-toolbox Introduction2.1 Core Technical Principles2.1.1 Frontend Processing (Laser Scan Matching)2.1.2 Backend Optimization (Graph Optimization)3. Start the Agent4. Run the Example4.1 Synchronous Mapping Mode4.2 Save the Grid Map4.3 Asynchronous Mapping Mode4.4 Difference Between Synchronous and Asynchronous Mapping Modes5. Node Analysis5.1 Display Node Computation Graph5.2 TF Transformation6. Configuration Parameters

1. Course Content

Basic: Run the sample program to build and save a grid map using the slam-toolbox mapping algorithm.

Advanced: Understand the configuration parameters of slam-toolbox.

[!TIP]

The ROSMASTER-M3 has a built-in shortcut command for SLAM mapping. Simply enter slam in the terminal to start SLAM mapping. The shortcut command uses the synchronous mapping mode of slam_toolbox by default.

2. slam-toolbox Introduction

s-toolbox is an open-source 2D SLAM (Simultaneous Localization and Mapping) algorithm package based on ROS, primarily used for mapping and localization of mobile robots in unknown environments. It is based on a Graph Optimization framework, combining data from sensors like 2D LiDAR and IMU to build a 2D grid map of the environment and update the robot's pose in real-time.

2.1 Core Technical Principles

2.1.1 Frontend Processing (Laser Scan Matching)

2.1.2 Backend Optimization (Graph Optimization)

image-20251209092458001

 

3. Start the Agent

Note: If it is already running, you do not need to start it again.

Enter the command in the vehicle's terminal:

The terminal will print the following information, indicating a successful connection:

image-20251209092555070

 

4. Run the Example

4.1 Synchronous Mapping Mode

For Raspberry Pi 5 users, if the ROS container is not started, you need to start it first,

Open a terminal inside the container,

(ORIN board)

(RDK & PI5 boards) Run in separate steps, with visualization launched on the accompanying virtual machine Rosmaster-M3-Ubuntu22.04,

[!NOTE]

By default, the synchronous mapping mode of slam_toolbox is used.

image-20251209093555669

 

Click on the terminal window with the mouse and press z to reduce the speed appropriately.

image-20251209192635908

 

image-20251209093723637

 

4.2 Save the Grid Map

[!TIP]

Optional Parameters:

map_name: Specifies the name of the saved map, with the default value being map.

For example, to save a map named test.yaml, add the parameter: ros2 launch m3_bringup save_map.launch.py map_name:=test

 

The terminal prompt Map saved successfully indicates that the map was saved successfully.

image-20251209093855827

 

4.3 Asynchronous Mapping Mode

[!NOTE]

image-20251209094726852

4.4 Difference Between Synchronous and Asynchronous Mapping Modes

 

 

5. Node Analysis

5.1 Display Node Computation Graph

image-20251209095220726

5.2 TF Transformation

image-20251209095350618

 

 

6. Configuration Parameters