Skip to content

Auto graph repairing - #1691

Merged
matlabbe merged 6 commits into
masterfrom
auto_repair_max_graph_optimization
May 4, 2026
Merged

matlabbe merged 6 commits into
masterfrom
auto_repair_max_graph_optimization

Conversation

@matlabbe

@matlabbe matlabbe commented Apr 20, 2026 •

Copy link
Copy Markdown
Member

Detect and remove bad loop closures accepted in the past that block new good loop closures to be accepted

To enable this new feature, the new parameter RGBD/OptimizeMaxErrorRepairRadius has to be >0.

If two consecutive loop closures are rejected by RGBD/OptimizeMaxError on the same old loop closure link, we will remove that old link, and other old links under that radius if necessary, until optimization is accepted. When optimization is accepted, the old loop closure links are removed from the graph. This feature is useful to reject bad loop closures that were accepted previously. Set to 0 to disable this feature.

Other things in that PR:

  • Refactored graph::computeMaxGraphErrors() to output single struct with results to simplify usage
  • Added new statistic Loop/Optimization_max_error_removed_count, which is >0 when graph has been repaired with approach described above.

Example of reprocessing logs when repairing happens:

Processed 121/790 nodes [id=17767 map=13 graph=10781 hyp=12]... 804ms Loop on 17648 [13]
Processed 122/790 nodes [id=17768 map=13 graph=10782 hyp=9]... 507ms
[ WARN] (2026-05-04 15:40:35.405) Rtabmap.cpp:3122::process() Rejected loop closure 17662 -> 17769: Not enough inliers 4/40 (matches=130) between 17662 and 17769
[ WARN] (2026-05-04 15:40:35.719) Rtabmap.cpp:3968::process() Rejecting all added loop closures (1, first is 17769 <-> 17598) in this iteration because a wrong loop closure has been detected after graph optimization, resulting in a maximum graph error ratio of 11.354822 (edge 10247->17648, type=1, abs error=0.428626 m, stddev=0.037748). The maximum error ratio parameter "RGBD/OptimizeMaxError" is 10.000000 of std deviation.
[ WARN] (2026-05-04 15:40:35.719) Rtabmap.cpp:4050::process() Loop closure 17769->17598 rejected!
Processed 123/790 nodes [id=17769 map=13 graph=10783 hyp=11]... 877ms
Processed 124/790 nodes [id=17770 map=13 graph=10784 hyp=9]... 507ms
[ WARN] (2026-05-04 15:40:37.161) Rtabmap.cpp:3934::process() We detected 2 consecutive loop closure rejections because of the same loop closure link (10247->17648), trying optimization again without that link...
[ WARN] (2026-05-04 15:40:37.500) Rtabmap.cpp:5626::repairGraph() Optimization error is lower (7.852353, on link 3968->4567) after removing loop closure with highest error. We will remove the old link (10247->17648 collaterals=0) and accept the new one.
[ WARN] (2026-05-04 15:40:37.512) Rtabmap.cpp:3954::process() Removing link 10247->17648 from memory
[ WARN] (2026-05-04 15:40:37.512) Rtabmap.cpp:3957::process() Successfully repaired the graph.
Processed 125/790 nodes [id=17771 map=13 graph=10785 hyp=13]... 1224ms Loop on 17595 [12]

… the past that block new good loop closures to be accepted
…repair the graph (remove bad loop closures added in the past). Refactored max optimization error function, split repairGraph to its own function.
@matlabbe
matlabbe marked this pull request as ready for review May 1, 2026 21:13
@matlabbe
matlabbe merged commit 37f8fa6 into master May 4, 2026
8 of 9 checks passed
@matlabbe
matlabbe deleted the auto_repair_max_graph_optimization branch May 4, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant