Skip to content

Conversation

@matlabbe
Copy link
Member

@matlabbe matlabbe commented Jan 21, 2026

Added new parameter: Mem/LocalizationReadOnly (default false, like before)

Current issue (s) detected by setting the database in read-only mode:

  • With memory management enabled in localization mode (and with incremental dictionary), the memory can generate new words (for new localization nodes) that will be eventually used by retrieved nodes (when comparing back old loaded words to current ones in the dictionary). These new words are then saved back in the database. Nodes are also updated to reference new word IDs.
    • Is the dictionary always modified in localization mode? That "if" is used to not save anything to database after a run: if(!databaseSaved || (!_memoryChanged && !_linksChanged && !databaseNameChanged) || this->isReadOnly())
      • _memoryChanged is true only if we save localization data
      • _linksChanged is true if we change label
    • How can we avoid modifying the dictionary (already saved in the database) in localization mode? I don't see why we would need to save the new word IDs after the localization session.
    • Is the saved FLANN index also modified in localization mode?
    • What is the impact of disabling incremental dictionary in localization mode? That could solve issues above, at least for the new word ids and remapping them in the nodes, however the dictionary state could change when memory management is enabled.

Update: To work around the issues above:

  • I am adding a comment to Mem/LocalizationReadOnly that is currently not compatible with memory management and multi-disjoint sessions in the database.
  • If the dictionary is incremental, it will always change, with or without memory management, in localization mode. I think that behavior is required so that new localization nodes with words to corresponding to locations still in LTM can be compared to these locations when they are retrieved.
  • Single-session database in localization mode without memory management can work in read-only mode because all nodes are already in WM (no change of word IDs, so nodes are not modified over time) and that we just ignore/skip any dictionary changes to database if memory didn't change. So the old flann index is still there in the database and valid for the original state of the dictionary, and no new words are added to database (and no reference word IDs changed).

Update 2: To add a slight precision, nodes added in localization mode are removed at the end of the same iteration, meaning that not indexed words added to dictionary are automatically removed. So when we close, the dictionary should then have exactly the same words than at the beginning of the session. To make it work with memory management, we would need to not change word refs from retrieved nodes (or just make a temporary change) when compared back to current dictionary (containing latest localization node), so that the end of the iteration, we restore back the old word refs. Playing devil advocate, retrieved words can be matched not only with new words from localization node, but also nodes from the map that were not there when these nodes were added during SLAM. It seems to me that as soon memory management is used, it is difficult to support a read-only mode at the same time.

@matlabbe matlabbe merged commit da55168 into master Jan 22, 2026
6 of 7 checks passed
@matlabbe matlabbe deleted the read_only_localization_mode branch January 23, 2026 00:00
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.

2 participants