mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
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:
@@ -95,6 +95,7 @@ public:
|
||||
int getTotalMemSize();
|
||||
double getLastProcessTime() const {return _lastProcessTime;};
|
||||
std::multimap<int, cv::KeyPoint> getWords(int nodeId);
|
||||
std::map<int, int> getNeighbors(int nodeId, int margin, bool lookInLTM = false);
|
||||
|
||||
void setTimeThreshold(float maxTimeAllowed); // in ms
|
||||
|
||||
|
||||
@@ -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..."));
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user