Skip to content

Add submap pruning support to offline session merging - #328

Open
noelex wants to merge 7 commits into
koide3:masterfrom
noelex:feature/submap-pruning
Open

noelex wants to merge 7 commits into
koide3:masterfrom
noelex:feature/submap-pruning

Conversation

@noelex

@noelex noelex commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for excluding selected submaps from either the current map or the incoming map during session merging in the offline viewer.

This is useful for patching part of an existing map with data from another mapping session, while excluding outdated, unreliable, or otherwise unwanted regions from either side of the merge.

Changes

  • Add submap range selection for both the current and incoming maps.
  • Build session merges through a transactional candidate graph before replacing the active graph.
  • Remove the full state associated with pruned submaps, including pose, endpoint, velocity, and bias variables, together with factors referencing them.
  • Detect and highlight orphaned subgraphs in merge candidates, allowing them to be repaired with manual loop closures or Find overlapping submaps.

Implementation overview

  • graph_metadata

    • Add submap-range utilities and pruning metadata serialization.
    • Extend graph.txt parsing with optional pruning records while remaining compatible with legacy metadata.
    • Validate pruning ranges and matching-cost factor references when loading and saving.
  • graph_edit

    • Introduce the graph-edit state model, session merge options, and candidate graph representation.
    • Build merge candidates by removing all state owned by pruned submaps and transforming the retained incoming-session state into the current-map frame.
    • Preserve or transfer the pose gauge anchor when necessary.
    • Analyze candidate connectivity and validate candidates with a fresh iSAM2 build before commit.
  • global_mapping

    • Integrate session merging as a transactional graph-edit workflow.
    • Keep disconnected candidates editable and allow additional factors to repair them before commit.
    • Track committed and pending pruning state across load, merge, save, and export operations.
    • Make overlapping-submap factor generation operate on the candidate graph while a candidate is being edited.
  • callbacks, async_global_mapping, and global_mapping_base

    • Add the callbacks and API plumbing required for graph-edit state updates, candidate updates, session merge requests, and adding repair factors.
    • Forward merge and graph-factor requests safely to the global-mapping worker thread.
  • interactive_viewer

    • Add pruning-range selection for the current and incoming maps.
    • Integrate pruning into the existing session-alignment and merge UI.
    • Display candidate graph poses and diagnostics while editing.
    • Highlight orphaned subgraphs and allow manual loop closures or overlapping-submap factors to repair the candidate.
  • manual_loop_close_modal

    • Propagate alignment cancellation back to the session-merge workflow so an aborted alignment does not leave a merge operation pending.
  • offline_viewer

    • Prevent conflicting map open/save/export operations while a graph edit or session merge is in progress.

Session merge workflow

  1. Load an incoming session.
  2. Optionally select submap ranges to prune from the current or incoming map.
  3. Align the sessions and create the merge factor.
  4. Build a candidate graph.
  5. If the candidate contains orphaned subgraphs, keep it editable and highlight the affected submaps.
  6. If needed, add manual loop closures or use Find overlapping submaps to reconnect the graph.
  7. Validate and atomically commit the candidate.

Gauge handling

The current map remains the reference frame for the merged graph.

If pruning removes the submap containing the current pose gauge anchor, the gauge constraint is transferred to the first remaining current-map submap while preserving the original constraint strength.

The incoming session does not retain an independent pose gauge during the merge, consistent with the existing additional-map loading behavior.

Compatibility

When no submap is selected for pruning, the existing session merge workflow is preserved.

This branch has not been deployed

No deployments
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