Added Rtabmap::getNeighbors() method for convenience. Fixed lost of db parameters when resetting memory when memory has not changed.

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@754 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2013-01-25 21:05:20 +00:00
parent cda3948c2e
commit 635dd9c177
3 changed files with 18 additions and 3 deletions

View File

@@ -71,18 +71,19 @@ bool Memory::init(const std::string & dbUrl, bool dbOverwritten, const Parameter
this->parseParameters(parameters);
UEventsManager::post(new RtabmapEventInit("Clearing memory..."));
DBDriver * tmpDriver = 0;
if(!_memoryChanged)
{
if(_dbDriver)
{
_dbDriver->closeConnection();
delete _dbDriver;
_dbDriver = 0;
tmpDriver = _dbDriver;
_dbDriver = 0; // HACK for the clear() below to think that there is no db
}
}
this->clear();
UEventsManager::post(new RtabmapEventInit("Clearing memory, done!"));
_dbDriver = tmpDriver;
if(_dbDriver)
{
UEventsManager::post(new RtabmapEventInit("Closing database connection..."));

View File

@@ -519,6 +519,19 @@ std::multimap<int, cv::KeyPoint> Rtabmap::getWords(int nodeId)
return words;
}
std::map<int, int> Rtabmap::getNeighbors(int nodeId, int margin, bool lookInLTM)
{
UScopeMutex s(&_threadMutex);
std::map<int, int> ids;
if(_memory)
{
ids = _memory->getNeighborsId(nodeId, margin, lookInLTM?-1:0);
}
return ids;
}
void Rtabmap::clearBufferedSensors()
{
_imageMutex.lock();