cartographer-project / cartographer

Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.
Apache License 2.0
7.09k stars 2.25k forks source link

Clean trimming of frozen trajectory data. #1767

Closed MichaelGrupp closed 3 years ago

MichaelGrupp commented 3 years ago

The deletion logic needs to take care of deleting all data that is "exclusively" connected to the submaps that are to be removed. This is achieved by looking at the data that is connected via constraints in the graph.

Deleting a frozen trajectory (one without optimization constraints) doesn't work that way and would leave dangling nodes in the graph.

This modifies the logic to use the node_ids field of the submap instead of the constraints.

Signed-off-by: Michael Grupp grupp@magazino.eu

MichaelGrupp commented 3 years ago

Related to the linked RFC PR and the associated PR in cartographer_ros.

cuicuihaohaoxuexi commented 3 years ago

Hi there, I've tried this DeleteTrajectory service to try to remove a loaded frozen trajectory. It works well and the frozen trajectory is deleted. However, the code crashes after the frozen trajectory is deleted. The error is shown as below:

terminate called after throwing an instance of 'std::out_of_range' what(): map::at

I find it happens in constraint_builder_2d.cc. The line of "(*callback)(result);" I used the latest master for cartographer which has all the updates above. Does anyone have any idea why it happens and how to resolve it? Thanks very much in advance.

shamengjun commented 3 years ago

@cuicuihaohaoxuexi I'm also confused with this problem, my error is the same as you!