mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Added parameter selection of actionsByTime or not (default true)
Now if parameter databaseCleaned is false, "all" signatures are saved, otherwise, only those with no parent loop closure git-svn-id: http://rtabmap.googlecode.com/svn/branches/0.3/rtabmap@84 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -963,7 +963,7 @@ void Memory::moveToTrash(Signature * s)
|
||||
_dbDriver &&
|
||||
!s->isBadSignature() &&
|
||||
s->id()>0 &&
|
||||
(s->getLoopClosureId() == 0 || s->isSaved()))
|
||||
((s->getLoopClosureId() == 0 || s->isSaved()) || !_databaseCleaned))
|
||||
{
|
||||
_dbDriver->asyncSave(s);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ Rtabmap::Rtabmap() :
|
||||
_remThr(Parameters::defaultRtabmapReactivationThr()),
|
||||
_localGraphCleaned(Parameters::defaultRtabmapLocalGraphCleaned()),
|
||||
_maxRetrieved(Parameters::defaultRtabmapMaxRetrieved()),
|
||||
_actionsByTime(Parameters::defaultRtabmapActionsByTime()),
|
||||
_lcHypothesisId(0),
|
||||
_reactivateId(0),
|
||||
_highestHypothesisValue(0),
|
||||
@@ -264,6 +265,10 @@ void Rtabmap::parseParameters(const ParametersMap & parameters)
|
||||
{
|
||||
_maxRetrieved = std::atoi(iter->second.c_str());
|
||||
}
|
||||
if((iter=parameters.find(Parameters::kRtabmapActionsByTime())) != parameters.end())
|
||||
{
|
||||
_actionsByTime = uStr2Bool(iter->second.c_str());
|
||||
}
|
||||
|
||||
|
||||
// By default, we create our strategies if they are not already created.
|
||||
@@ -950,7 +955,9 @@ void Rtabmap::process()
|
||||
if(sLoop)
|
||||
{
|
||||
// select the actions of the neighbor with the highest
|
||||
// weight (select the more recent is some have the same weight)
|
||||
// weight (select the more recent if some have the same weight)
|
||||
// OR
|
||||
// select the newest one (with actions)
|
||||
const NeighborsMap & neighbors = sLoop->getNeighbors();
|
||||
const Signature * s;
|
||||
int currentWeight = -1;
|
||||
@@ -958,11 +965,19 @@ void Rtabmap::process()
|
||||
{
|
||||
if(iter->second.size())
|
||||
{
|
||||
s = _memory->getSignature(iter->first);
|
||||
if(s && s->getWeight() > currentWeight)
|
||||
if(_actionsByTime)
|
||||
{
|
||||
currentWeight = s->getWeight();
|
||||
_actions = iter->second;
|
||||
break;
|
||||
}
|
||||
else // use also weight
|
||||
{
|
||||
s = _memory->getSignature(iter->first);
|
||||
if(s && s->getWeight() > currentWeight)
|
||||
{
|
||||
currentWeight = s->getWeight();
|
||||
_actions = iter->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user