Added c++ example usage

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@694 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2013-01-10 16:28:12 +00:00
parent d9ef3a603c
commit 0f4e24233c
11 changed files with 141 additions and 29 deletions

View File

@@ -94,11 +94,14 @@ public:
std::set<int> getStMem() const;
std::map<int, int> getWeights() const;
int getTotalMemSize() const;
double getLastProcessTime() const {return _lastProcessTime;};
void setMaxTimeAllowed(float maxTimeAllowed); // in ms
void setDataBufferSize(int size);
void setWorkingDirectory(std::string path);
void deleteMemory();
void adjustLikelihood(std::map<int, float> & likelihood) const;
std::pair<int, float> selectHypothesis(const std::map<int, float> & posterior,
const std::map<int, float> & likelihood) const;
@@ -141,6 +144,7 @@ private:
int _retrievedId;
float _lastLcHypothesisValue;
int _lastLoopClosureId;
double _lastProcessTime;
UMutex _stateMutex;
std::stack<State> _state;

View File

@@ -75,6 +75,7 @@ Rtabmap::Rtabmap() :
_retrievedId(0),
_lastLcHypothesisValue(0),
_lastLoopClosureId(0),
_lastProcessTime(0.0),
_epipolarGeometry(0),
_bayesFilter(0),
_memory(0),
@@ -517,6 +518,15 @@ void Rtabmap::mainLoop()
}
}
void Rtabmap::deleteMemory()
{
// Only if rtabmap's thread is not started...
if(!this->isRunning())
{
this->resetMemory(true);
}
}
void Rtabmap::resetMemory(bool dbOverwritten)
{
if(_memory)
@@ -1146,6 +1156,7 @@ void Rtabmap::process()
ULOGGER_INFO("Removing old signatures because time limit is reached %f>%f or memory is reached %d>%d...", totalTime*1000, _maxTimeAllowed, _memory->getWorkingMemSize(), _maxMemoryAllowed);
signaturesRemoved = _memory->forget(immunizedLocations);
}
_lastProcessTime = totalTime;
timeRealTimeLimitReachedProcess = timer.ticks();
ULOGGER_INFO("Time limit reached processing = %f...", timeRealTimeLimitReachedProcess);