How can I start to build a new map and clean the old one in Cartographer?

asked 2023-04-19 08:53:50 -0500

BlueBird gravatar image

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 it 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?

edit retag flag offensive close merge delete

Comments

I have tried the service cartographer_ros_msgs/FinishTrajectory. The cartographer seems to stop the charting work. Then, I call the service cartographer_ros_msgs/StartTrajectory. It starts to build the map again.

That is nice; however, the map that I have received from the node cartographer_occupancy_grid_node is mixed with the old maps. I observed it from the RVIZ2.

Is there some way that I can tell the node to clean the old map and publish a new one?

BlueBird gravatar image BlueBird  ( 2023-04-19 22:13:06 -0500 )edit