Save and convert the SLAM map
Finish the current Cartographer trajectory, write the state to disk and convert to a ROS map.
When SLAM mapping is complete, use these commands to stop trajectory accumulation, persist the pose graph and convert the Cartographer state file (.pbstream) into an occupancy grid map file usable by Nav2.
bash
ros2 service call ${ROS_NAMESPACE}/finish_trajectory cartographer_ros_msgs/srv/FinishTrajectory "{trajectory_id: 0}"
bash
ros2 service call ${ROS_NAMESPACE}/write_state cartographer_ros_msgs/srv/WriteState "{filename: '/home/rcr/map.pbstream'}"
bash
ros2 run cartographer_ros cartographer_pbstream_to_ros_map -i /home/rcr/map.pbstream -o /home/rcr/map -r 0.05