Re: Mapping -> Localization without reloading database

Posted by matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Mapping-Localization-without-reloading-database-tp6426p6434.html

Hi,

good question. Currently the code does this when switching from mapping to localization:
// The easiest way to make sure that the mapping session is saved
// is to save the memory in the database and reload it.
if((_memoryChanged || _linksChanged) && _dbDriver)
{
	UWARN("Switching from Mapping to Localization mode, the database will be saved and reloaded.");
	bool memoryChanged = _memoryChanged;
	bool linksChanged = _linksChanged;
	this->clear();
	_memoryChanged = memoryChanged;
	_linksChanged = linksChanged;
	this->loadDataFromDb(false);
	UWARN("Switching from Mapping to Localization mode, the database is reloaded!");
}
We do this because of the multiple options available in RTAB-Map about how memory is managed. It is just easier (and safer) to close everything and reload clean in read-only mode (localization). Knowing that sensor data are already loaded, we could still clear everything (to backup and update working memory stamps) but keep in RAM the sensor data, which should not have changed (raw keypoints and local occupancy grids)... reloading only the visual word vocabulary. I'll make some tests to see what is the actual time used to reload the sensor data. I'll update this thread soon.

cheers,
Mathieu