Overview
Map persistence allows you to:- Reuse previously built maps: Load a map and localize without rebuilding
- Multi-session SLAM: Continue mapping across multiple runs
- Localization mode: Track camera pose in a known environment
- Share maps: Transfer maps between systems or sessions
Map saving/loading is implemented through the Atlas system, which manages multiple maps and their relationships.
Configuration
Map loading and saving are configured in the YAML settings file:Configuration Options
System.LoadAtlasFromFile
System.LoadAtlasFromFile
Specifies the filename to load a previously saved Atlas.
- If the file doesn’t exist, ORB-SLAM3 creates a new Atlas from scratch
- If the file exists, it loads all maps, keyframes, and map points
- Comment out or remove this line to start with an empty Atlas
System.SaveAtlasToFile
System.SaveAtlasToFile
Specifies the filename to save the Atlas after shutdown.
- The Atlas is saved when
System::Shutdown()is called - If the file already exists, it will be overwritten
- Comment out to disable saving
API Methods
While direct SaveMap/LoadMap methods are marked as TODO ininclude/System.h:170-172, the functionality is implemented through the Atlas system.
System.h Interface
SaveAtlas() and LoadAtlas() methods are called internally based on the YAML configuration.
File Format
ORB-SLAM3 supports two file formats:- Binary Format (Recommended)
- Text Format
Advantages:
- Faster loading and saving
- Smaller file size
- Preserves floating-point precision
Use Cases
1. Build and Save a Map
Create a map from a dataset and save it for future use:Wait for completion
The system will build the map as usual. After completion, it automatically saves the Atlas.
2. Localization in a Known Map
Load a previously built map and localize only (no mapping):3. Multi-Session SLAM
Continue mapping across multiple runs:4. Map Sharing
Transfer maps between systems:Atlas Structure
The Atlas manages multiple maps and handles map merging:Multi-Map SLAM
ORB-SLAM3’s Atlas can maintain multiple maps simultaneously:- Map creation: New map created when tracking is lost and cannot relocalize
- Map switching: System switches between maps during relocalization
- Map merging: Related maps can be merged through loop closure
Implementation Details
Saving Process
Shutdown called
When
System::Shutdown() is called, the system:- Stops all threads (Tracking, LocalMapping, LoopClosing)
- Waits for pending operations to complete
Prepare Atlas
Atlas::PreSave() prepares data structures:- Resolves all keyframe and map point references
- Serializes covisibility graph
- Prepares essential metadata
Loading Process
Load Atlas
LoadAtlas(int type) reads from file:- Verifies checksum
- Deserializes maps, keyframes, map points
- Restores graph structure
File Management
Map File Naming
By convention, use descriptive names:Storage Requirements
Map file sizes vary based on:- Scene size: Larger environments = larger maps
- Mapping duration: Longer runs = more keyframes
- ORB features: More features per frame = larger storage
- Small indoor (2-5 min): 50-200 MB
- Large indoor (10-20 min): 200-800 MB
- Outdoor sequences: 500 MB - 2 GB+
Backup Strategy
Troubleshooting
Map fails to load
Map fails to load
Symptoms: Error message on startup, system starts with empty AtlasPossible causes:
- Map file doesn’t exist at specified path
- File corrupted or incomplete
- Incompatible ORB-SLAM3 version
- Checksum verification failed
Map loads but relocalization fails
Map loads but relocalization fails
Symptoms: Map loaded successfully, but tracking cannot initializePossible causes:
- Camera in area not covered by loaded map
- Different lighting conditions
- Camera calibration changed
- Vocabulary mismatch
- Start in area where map was originally built
- Ensure consistent lighting
- Verify camera calibration matches map session
- Move camera to help relocalization (show distinctive features)
- Consider using ORB parameter tuning for challenging conditions
Localization mode not working
Localization mode not working
Symptoms: System continues creating new map points despite localization modeSolution: Ensure To resume mapping:
ActivateLocalizationMode() is called after System initialization:Map file very large
Map file very large
Symptoms: Map file grows to several GB, causing slow load timesCauses:
- Very long mapping sessions
- High feature count settings
- Multiple maps in Atlas
- Reduce
ORBextractor.nFeaturesfor future sessions - Use keyframe culling (automatic in ORB-SLAM3)
- Split into multiple smaller maps
- Compress old maps for archival:
Cannot save map after run
Cannot save map after run
Symptoms: No map file created, or file incompleteCauses:
- Insufficient disk space
- No write permissions
- System crashed before shutdown
Best Practices
Map Building
- Use high-quality calibration
- Ensure good visual coverage
- Include loop closures for consistency
- Verify map quality before saving
- Backup important maps
Map Loading
- Start in mapped area
- Use same vocabulary file
- Match camera calibration
- Test relocalization before deployment
- Monitor tracking status
Localization Mode
- Load established, optimized map
- Disable mapping for efficiency
- Handle tracking loss gracefully
- Provide relocalization assistance
- Log pose estimates
Multi-Session
- Maintain version history
- Use descriptive filenames
- Verify map merging
- Test incrementally
- Document map coverage
Future Development
The TODO comment in System.h suggests future public API methods:Next Steps
- ROS Integration - Use map persistence with ROS nodes
- Configuration Guide - Configure Atlas settings
- System API Reference - Detailed System class documentation