Skip to main content
Version: ROS 2 Jazzy

SLAM

Simultaneous Localization And Mapping (SLAM) is a method of generating a map and tracking the robot's location within the map at the same time. It is generally done using laser scan data from a 2D LIDAR and the robot's odometry. For this demo we are using the slam_toolbox package to map our environment. This tutorial will use the Clearpath simulator, but will work on a physical robot too. We will be using a Husky A300 with a Hokuyo UST10 attached to the top of the robot.

See the sample robot.yaml for configuration details.

tip

Make sure you have installed the simulator before starting this tutorial. Take a look at the installation guide for details.

Launching SLAM

See launch instructions for instructions on how to launch SLAM.

Building the map

Drive the robot around the world. Ensure you have mapped the region you want the robot to navigate through autonomously.

SLAM in simulation

Saving the map

To save the map, open a new terminal and run

ros2 run nav2_map_server map_saver_cli -f "map_name"
--ros-args -p map_subscribe_transient_local:=true -r __ns:=/a300_0000