Fusion SLAM
Home
  • OVERVIEW AND INTRODUCTION
  • INSTALLING
  • DATASETS
  • TUTORIALS FOR ROVIOLI (ONLINE FRONTEND)
  • TUTORIALS FOR USING MAPLAB (OFFLINE TOOLS) - BASICS
  • TUTORIALS FOR USING MAPLAB (OFFLINE TOOLS) - USE-CASES
  • TUTORIALS FOR USING MAPLAB SERVER (ONLINE)
  • HARDWARE INTEGRATION AND SENSOR CALIBRATION
  • TUTORIALS FOR EXTENDING MAPLAB
  • DEVELOPEMENT GUIDELINES
  • ADDITIONAL FORMATS
Project
  • 简体中文
  • English
Home
  • OVERVIEW AND INTRODUCTION
  • INSTALLING
  • DATASETS
  • TUTORIALS FOR ROVIOLI (ONLINE FRONTEND)
  • TUTORIALS FOR USING MAPLAB (OFFLINE TOOLS) - BASICS
  • TUTORIALS FOR USING MAPLAB (OFFLINE TOOLS) - USE-CASES
  • TUTORIALS FOR USING MAPLAB SERVER (ONLINE)
  • HARDWARE INTEGRATION AND SENSOR CALIBRATION
  • TUTORIALS FOR EXTENDING MAPLAB
  • DEVELOPEMENT GUIDELINES
  • ADDITIONAL FORMATS
Project
  • 简体中文
  • English
  • OVERVIEW AND INTRODUCTION

    • Introduction to the Maplab Framework
    • Main Papers
    • Additional Citations
    • Related Research
    • FAQ
    • Known Issues
  • INSTALLING

    • Installing on Ubuntu
    • Compilation and Debugging
  • DATASETS
  • TUTORIALS FOR ROVIOLI (ONLINE FRONTEND)

    • ROVIOLI Introduction
    • Running ROVIOLI in VIO mode: calibartion files, rostopics, bag/topic mode, visualization
    • Running ROVIOLI in Localization mode
    • Multi-session mapping with ROVIOLI
  • TUTORIALS FOR USING MAPLAB (OFFLINE TOOLS) - BASICS

    • Basic Console Usage
    • Parameters (Gflags)
    • Console map management: load, save, basic visualization
    • Inspecting and visualizing a map
    • Map visualization: see your map in RViz!
    • Preparing a single session map: optimization, loop-closure
    • Understanding loop-closure
    • Optimizing VI-Maps
    • Preparing a multi-session map: map anchoring, loop-closure, pose-graph relaxation
    • Dense Reconstruction: attaching resources to map, available reconstruction tools
    • Resource Importer
  • TUTORIALS FOR USING MAPLAB (OFFLINE TOOLS) - USE-CASES

    • Multi-session use case: CLA, multi-floor use-case
    • Map sparsification: make your mapping more efficient
    • Stereo Dense Reconstruction: EuRoC, multi-session reconstruction use-case
    • External Features
  • TUTORIALS FOR USING MAPLAB SERVER (ONLINE)
  • HARDWARE INTEGRATION AND SENSOR CALIBRATION

    • Sensor Calibration Format: ncamera, imu-sigmas
    • Initial sensor calibration with Kalibr
    • Sensor calibration refinement
    • Intel RealSense ZR300
    • VersaVIS
  • TUTORIALS FOR EXTENDING MAPLAB

    • Using the MapManager
    • Using Timing and Statistics
    • /maplab/docs/pages/tutorials-extending-maplab/C_Coding-Examples:-Creating-a-custom-console-plugin.html
    • /maplab/docs/pages/tutorials-extending-maplab/D_Coding-Examples:-Working-with-the-VI-Map.html
    • Console Plugin System
  • DEVELOPEMENT GUIDELINES

    • Importing maplab to Eclipse
    • Contributing to maplab
    • Header Include Guide
    • Debugging applications
    • Expressing frame transformations in code
    • Verbosity Policy
  • ADDITIONAL FORMATS

Using the MapManager

The MapManager is the basic class to interact with and access the map storage. This tutorial focuses on the usage with respect to VIMaps.

First, make sure that you include the MapManager and VIMap in your code:

#include <map-manager/map-manager.h>
#include <vi-map/vi-map.h>

Now, you can instantiate a new MapManager object, which will contain a reference to the map storage object (which is a singleton):

vi_map::VIMapManager map_manager;

To get a map from the storage, you use

vi_map::VIMap& map = map_manager.getMap("key_of_map");

Now, you can do your operations on the map. When you're done, there's no need to commit the map back.

If you want to work with the map in a multithreaded environment, you can use thread safe accesses:

{
  vi_map::VIMapManager::MapWriteAccess map = map_manager.getMapWriteAccess("key_of_map");
  // Map is now locked.

  // Work with map.
}
// Map is unlocked when the write access gets out of scope.

When the MapWriteAccess gets created, the map is automatically locked, blocking all other threads that want to get a thread safe access to this map. Once the MapWriteAccess gets out of scope and is deleted, the map is unlocked and is free to be used by other threads.

If you only need read-access, you can instead use the MapReadAccess:

vi_map::VIMapManager::MapReadAccess map = map_manager.getReadAccess("key_of_map");

A read access only allows const access to the map, so no changes can be made. You can have multiple read accesses at the same time, but only on write access can be active.

To use the thread safe accesses, you can use a pointer-like syntax:

vi_map::VIMapManager::MapWriteAccess map = map_manager.getMapWriteAccess("key_of_map");

// Dereference map.
vi_map::VIMap& map_reference = *map;

// Call a function in the map.
map->numMissions();

// Get a raw pointer to the map.
vi_map::VIMap* map_raw_pointer = map.get();

Check out the MapManager header to get a list of the possible commands you can do with the MapManger: https://github.com/ethz-asl/maplab/blob/master/backend/map-manager/include/map-manager/map-manager.h

Next
Using Timing and Statistics