๐บ๏ธ Mapping#
Mapping refers to the process of creating a symbolic representation of the environment using the robotโs sensors. Having a map of the environment enables the robot to efficiently plan paths to reach a goal location, avoid obstacles, and improve localization accuracy by correcting odometry errors.
There are different types of maps that can be created depending on the sensors available on the robot, the environment in which it operates and the application requirements.
The process of creating an accurate map of the environment while localizing the robot is called SLAM which stands for Simultaneous Localization and Mapping. As it is a very common problem in robotics, there are many algorithms and techniques to solve it, such as:
EKF SLAM
Particle Filter SLAM
Graph SLAM
Occupancy Grid Mapping#
Warning
Your robot can create a 2D OccupancyGrid only if it is equipped with a 2D Laser Sensor.
An OccupancyGrid is a 2D symbolic representation of the environment that expresses the world as a grid of cells, where each cell can be either occupied (100), free (0) or unknown (-1).
For the creation of a 2D Occupancy Grid, PAL Robots use the SLAM toolbox package which implements a Graph-based SLAM algorithm.
As the robot moves in the environment, either teleoperated or autonomously, the SLAM algorithm processes the odometry information, the laser scans and creates a Graph representative of the robot poses and the landmarks in the environment. This Graph is then optimized to correct odometry and measurement errors and create an accurate and consistent map of the environment.
Configuration#
In addition to the available PAL configurations for the slam_toolbox node, you can create new configurations
for your robot. To do so, you first need to create a new directory in the .pal
folder of your robot.
mkdir -p ~/.pal/config
And then, within this folder, you can create a new slam_toolbox
configuration file.
touch ~/.pal/config/99_my_slam_config.yaml
Attention
The name of the file should start with a number to ensure that it is loaded last and overrides the default PAL configurations.
Within the newly created 99_my_slam_config.yaml
file, you can insert your custom slam_toolbox
parameters.
For the list of available parameters, their meaning and how they affect the SLAM algorithm, you can refer to the
slam_toolbox configuration guide.
When creating a new Navigation configuration file, you need to specify the node name it refers to, in this case,
slam_toolbox
.
/slam_toolbox:
ros__parameters:
# Your slam_toolbox parameters
Once created, to start using your custom slam_toolbox
configuration, you need to restart the
slam
module with the command:
pal module restart slam
Note
This change is is persistent and will be loaded every time you start the slam
module.
If you want to revert to the default PAL configuration, you can simply delete the custom configuration file
you created in the ~/.pal/config
folder.
ROS 2 API#
To interact with the slam_toolbox, you can refer to the following ROS 2 interfaces:
Topics |
Services |
---|---|
See also#
To continue learning about Mapping and how to create a map of the environment, you can refer to the following tutorials: