cartographer-project / cartographer_ros

Provides ROS integration for Cartographer.
Apache License 2.0
1.64k stars 1.2k forks source link

Is there any interface on the nodes that can be used to control the start and stop of the charting? #1782

Open BlueBirdHouse opened 1 year ago

BlueBirdHouse commented 1 year ago

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.

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

BlueBirdHouse commented 1 year ago

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?

eithwa commented 1 year ago

Maybe you can select the submap of the trajectory that needs to be displayed in cartographer_ocupancy_grid_node