I am using the cartographer_node to build the map, together with the cartographer_occupancy_grid_node to publish the occupancy grid map. Both nodes work fine.
I would like to control when to begin the mapping work and when to stop. For example, the robot draws a good map for my first floor; then, it is going to the second floor from the elevator. I would like to tell the robot to stop the mapping work. After it goes out from the elevator, I would like to command it to begin a new map and chart again.
I can stop the cartographer_node and the cartographer_occupancy_grid_node before it goes into the elevator; then, executive them again when it arrives at the new floor. However, it feels odd.
Is there any interface on the nodes that can be used to control the start and stop of the charting?
I am using ROS humble/foxy.
Is the service start_trajectory or finish_trajectory can do the trick?