ethz-asl / maplab

A Modular and Multi-Modal Mapping Framework
https://maplab.asl.ethz.ch
Apache License 2.0
2.64k stars 724 forks source link

Check failed: it != map.end() when trying to do optv #340

Open B-Meg opened 3 years ago

B-Meg commented 3 years ago

I load my map into the maplab console. Optimizing the map with optvi works perfect. But when I try to do the BA without IMU by using optv or optvi --ba_include_inertial=false I get the following Error:

F0918 21:58:51.689087 21734 accessors.h:46] Check failed: it != map.end() Check failure stack trace: Aborted at 1631995131 (unix time) try "date -d @1631995131" if you are using GNU date PC: @ 0x7f300a91ffb7 gsignal SIGABRT (@0x3e8000054e6) received by PID 21734 (TID 0x7f300bc88b40) from PID 21734; stack trace: @ 0x7f300a920040 (unknown) @ 0x7f300a91ffb7 gsignal @ 0x7f300a921921 abort @ 0x5618333d8255 (unknown) @ 0x7f300b498b0d google::LogMessage::Fail() @ 0x7f300b49a9b1 google::LogMessage::SendToLog() @ 0x7f300b49863d google::LogMessage::Flush() @ 0x7f300b49b389 google::LogMessageFatal::~LogMessageFatal() @ 0x7f2fee0af4c8 map_optimization::OptimizationProblem::applyGaugeFixesForInitialVertices() @ 0x7f2fee0f5b4f map_optimization::constructOptimizationProblem() @ 0x7f2fee0ed580 map_optimization::VIMapOptimizer::optimize() @ 0x7f2feb1ce13d map_optimization_plugin::OptimizerPlugin::optimize() @ 0x7f2feb1ce386 _ZZN23map_optimization_plugin15OptimizerPluginC4EPN6common7ConsoleEPN13visualization21ViwlsGraphRvizPlotterEENKUlvE0_clEv @ 0x7f300b8d609e common::CommandRegisterer::processCommand() @ 0x7f300b8d8ca4 common::Console::RunCommand() @ 0x7f300b8da34e common::Console::RunCommandPrompt() @ 0x5618333d7df6 (unknown) @ 0x7f300a902bf7 __libc_start_main @ 0x5618333d7e8a (unknown) Aborted (core dumped)

Why do I get it and why only when I am doing the BA without IMU?

smauq commented 3 years ago

Ah, that's the part of the code that fixes the scale or other things in the map. If you remove the IMU you need to fix the scale (usually by fixing the distance between the first two vertices or the distance to the first keypoint observation for example). I think there's just a bug in that part of the code for the main release, since at that time it wasn't a very tested feature. In our development branch of the code we rewrote that whole part and it should be fixed now.

The function that crashes is applyGaugeFixesForInitialVertices but I think the problem solution was in this part of the code

https://github.com/ethz-asl/maplab/blob/618a0e0154d0c6e6cd84b5ac827140b5a9b84cb0/algorithms/map-optimization/src/vi-optimization-builder.cc#L98-L128

versus

https://github.com/ethz-asl/maplab/blob/c7b0d78365adf75a5f19ed744f8cb79b4e7e02ff/algorithms/map-optimization/src/vi-optimization-builder.cc#L234-L344