Skip to content

New rtabmap-reduceGraph CLI tool#1655

Open
matlabbe wants to merge 18 commits intomasterfrom
offline_reduce_graph_tool
Open

New rtabmap-reduceGraph CLI tool#1655
matlabbe wants to merge 18 commits intomasterfrom
offline_reduce_graph_tool

Conversation

@matlabbe
Copy link
Copy Markdown
Member

@matlabbe matlabbe commented Feb 16, 2026

Usage:

rtabmap-reduceGraph rtabmap.db

While the offline approach uses the same code than the online graph reduction Mem/ReduceGraph (as explained in this paper), it keeps all neighbor merged links instead of ignoring them like in the online version. When reducing nodes arbitrarily in the graph, with some configurations of links, it can split the graph if we don't propagate all neighbor merged links, that is not an issue with the online approach.

  • The --radius parameter limits the length of loop closures that can be reduced. Note also to avoid super long neighbor merged links (propagated from reduced nodes to other reduced nodes), we don't merge a loop closure if any of the merged neighbor link on that node is longer than the radius.
  • Nodes can be merged to latest nodes instead of the oldest nodes, set option --keep_latest to do so.
  • The option --pre_cleanup can be used to remove all loop closure links linking nodes closer than Mem/STMSize nodes. This has been added for convenience for database with which rtabmap-detectMoreLoopClosures have been done without the change below.

Other changes:

  • rtabmap-detectMoreLoopClosures: Now by default it won't add loop closures anymore on close nodes in terms of graph distance, i.e., under Mem/STMSize node distance of each other. That simulates online loop closures that are not done with nodes inside the STM. This also helps to not overwhelm odometry constraints with [normally] less accurate loop closures. Improve detect more loop closures tool to avoid overpowering odometry contribution in local graph optimization #1671. Note that to reproduce the old behavior, do rtabmap-detectMoreLoopClosures --Mem/STMSize 1
  • g2o/Optimizer parameter is now ignored for SBA, it will affect graph optimization only. We found that using gauss newton optimizer with SBA makes g2o easily abort with [SetJac] infinite jac fatal error. For SBA, levenberg optimizer is now hard-coded, so it makes it possible to use gauss newton for graph optimization while using SBA for other stuff at the same time without crashing.

Tasks:

  • Confirm that online graph reduction is working as expected after the refactor (should be exactly like before)
  • Confirm that landmarks are kept in the reduced map
  • Check if Mem/STMSize minimum distance behavior could also be added to "Detect more loop closures" actions in main UI and the database viewer.

… ReduceGraph/DetectMoreLoopClosures: Make sure original parameters are saved back on closing. g2o: fixing optimizer to Levenberg for SBA to avoid [SetJac] infinite jac fatal error.
…of neighbor links based on Mem/STMSize parameter. Reduce graph: added direction parameter.
…t don't reduce if a NM link is longer than maxDistance.
@matlabbe matlabbe marked this pull request as ready for review March 30, 2026 04:10
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