mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +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();
|
int getTotalMemSize();
|
||||||
double getLastProcessTime() const {return _lastProcessTime;};
|
double getLastProcessTime() const {return _lastProcessTime;};
|
||||||
std::multimap<int, cv::KeyPoint> getWords(int nodeId);
|
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
|
void setTimeThreshold(float maxTimeAllowed); // in ms
|
||||||
|
|
||||||
|
|||||||
@@ -71,18 +71,19 @@ bool Memory::init(const std::string & dbUrl, bool dbOverwritten, const Parameter
|
|||||||
this->parseParameters(parameters);
|
this->parseParameters(parameters);
|
||||||
|
|
||||||
UEventsManager::post(new RtabmapEventInit("Clearing memory..."));
|
UEventsManager::post(new RtabmapEventInit("Clearing memory..."));
|
||||||
|
DBDriver * tmpDriver = 0;
|
||||||
if(!_memoryChanged)
|
if(!_memoryChanged)
|
||||||
{
|
{
|
||||||
if(_dbDriver)
|
if(_dbDriver)
|
||||||
{
|
{
|
||||||
_dbDriver->closeConnection();
|
tmpDriver = _dbDriver;
|
||||||
delete _dbDriver;
|
_dbDriver = 0; // HACK for the clear() below to think that there is no db
|
||||||
_dbDriver = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->clear();
|
this->clear();
|
||||||
UEventsManager::post(new RtabmapEventInit("Clearing memory, done!"));
|
UEventsManager::post(new RtabmapEventInit("Clearing memory, done!"));
|
||||||
|
|
||||||
|
_dbDriver = tmpDriver;
|
||||||
if(_dbDriver)
|
if(_dbDriver)
|
||||||
{
|
{
|
||||||
UEventsManager::post(new RtabmapEventInit("Closing database connection..."));
|
UEventsManager::post(new RtabmapEventInit("Closing database connection..."));
|
||||||
|
|||||||
@@ -519,6 +519,19 @@ std::multimap<int, cv::KeyPoint> Rtabmap::getWords(int nodeId)
|
|||||||
return words;
|
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()
|
void Rtabmap::clearBufferedSensors()
|
||||||
{
|
{
|
||||||
_imageMutex.lock();
|
_imageMutex.lock();
|
||||||
|
|||||||
Reference in New Issue
Block a user