sl-perception created pull request seb/saltylab-firmware#705

sl-perception
Fri, 20 Mar 2026 16:28:27 -0400

705#feat: SLAM map persistence for AMCL (Issue #696)#

Summary

map_persistence.launch.py: launches map_saver_server lifecycle node (nav2_map_server) + saltybot_map_saver helper + lifecycle_manager. Configurable map_dir (default /mnt/nvme/saltybot/maps) and map_name.

map_saver_node.py: /saltybot/save_map Trigger service → calls map_saver_cli. Reports saved map status on startup. Auto-saves on shutdown.

config/map_saver_params.yaml: map_saver_server params (timeout, thresholds, transient-local QoS).

nav2_slam_bringup.launch.py: adds map_dir/map_name args; includes map_persistence.launch.py so map_saver_server runs during SLAM sessions.

nav2_amcl_bringup.launch.py: adds map_dir arg; auto-detects /mnt/nvme/saltybot/maps/saltybot_map.yaml at launch time — uses saved map automatically, falls back to placeholder.

setup.py: registers new launch, config, and map_saver_node entry point.

test_nav2_amcl.py: 21 new tests (params, launch syntax, node behaviour, auto-detect logic).

Workflow

# 1. Build map with SLAM
ros2 launch saltybot_nav2_slam nav2_slam_bringup.launch.py

# 2. Save map (while SLAM is running)
ros2 service call /saltybot/save_map std_srvs/srv/Trigger {}

# 3. Next boot — AMCL auto-loads saved map
ros2 launch saltybot_nav2_slam nav2_amcl_bringup.launch.py

Test plan

56 unit tests pass (python3 -m pytest test/test_nav2_amcl.py)

On Jetson: ros2 launch nav2_slam_bringup.launch.py → verify map_saver_server active

ros2 service call /saltybot/save_map → verify .yaml/.pgm written to NVMe

Restart with nav2_amcl_bringup.launch.py → verify log shows "saved NVMe map"

Override: map:=/path/to/custom.yaml still respected

🤖 Generated with Claude Code