Mapping
Complete robot configuration and connect a
visualization tool before mapping. Replace
<namespace> and <map_name> in commands with your robot namespace and
chosen map name.
Keep the operating area clear and be ready to stop the robot. Monitor the robot and map throughout mapping.
All instruction for this section happen on the robot PC itself.
Start mapping
Set autonomy.indoor.slam.enabled to true in
/etc/clearpath/robot.yaml, then restart the robot service:
sudo systemctl restart clearpath-robot.service
When the robot starts with this setting, IndoorNav launches automatically in mapping mode.
Confirm that the navigation stack is running and the in-progress map appears
on /<namespace>/map in Foxglove or RViz2.
Create and save a map
Drive the robot through the environment while monitoring the map. When mapping is complete, use a terminal with the ROS workspace sourced to save it:
ros2 run nav2_map_server map_saver_cli \
-f /home/robot/colcon_ws/src/clearpath_indoor_navigation/maps/<map_name> \
-t /<namespace>/map
The command writes map metadata and an image into the package's maps
directory. Substitute the actual workspace path if the robot account or
workspace differs.
Review the saved image for mapping artifacts. If it needs correction, edit the
generated .pgm image with an image editor (this would be to potentially remove
any false positives that were detected). Rebuild after adding or updating
maps so the installed package includes them:
cd ~/colcon_ws
colcon build --symlink-install --packages-up-to clearpath_indoor_navigation --event-handlers console_direct+
See the upstream mapping demonstration.
Configure localization
To use the saved map for navigation, follow the
Navigation page and set
autonomy.indoor.slam.enabled to false and
autonomy.indoor.localization.map to the saved map's YAML filename.
The relevant mapping and localization settings are described in Autonomy Configuration.