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:
matlabbe
2011-06-08 20:00:14 +00:00
parent 7407657b23
commit edf8bbb735
6 changed files with 50 additions and 13 deletions

View File

@@ -131,6 +131,7 @@ class RTABMAP_EXP Parameters
RTABMAP_PARAM_STR(Rtabmap, WorkingDirectory, Parameters::getDefaultWorkingDirectory()); // Working directory RTABMAP_PARAM_STR(Rtabmap, WorkingDirectory, Parameters::getDefaultWorkingDirectory()); // Working directory
RTABMAP_PARAM(Rtabmap, LocalGraphCleaned, bool, false); // Clean the neighborhood of the retrieved id RTABMAP_PARAM(Rtabmap, LocalGraphCleaned, bool, false); // Clean the neighborhood of the retrieved id
RTABMAP_PARAM(Rtabmap, MaxRetrieved, unsigned int, 2); // Maximum locations retrieved at the same time from LTM RTABMAP_PARAM(Rtabmap, MaxRetrieved, unsigned int, 2); // Maximum locations retrieved at the same time from LTM
RTABMAP_PARAM(Rtabmap, ActionsByTime, bool, true); // Select next actions based on the more recent neighbor of the current node, otherwise, weight is also used
// Hypotheses selection // Hypotheses selection
RTABMAP_PARAM(Rtabmap, LoopThr, float, 0.10); // Loop closing threshold RTABMAP_PARAM(Rtabmap, LoopThr, float, 0.10); // Loop closing threshold

View File

@@ -133,6 +133,7 @@ private:
float _remThr; float _remThr;
bool _localGraphCleaned; bool _localGraphCleaned;
unsigned int _maxRetrieved; unsigned int _maxRetrieved;
bool _actionsByTime;
int _lcHypothesisId; int _lcHypothesisId;
int _reactivateId; int _reactivateId;

View File

@@ -963,7 +963,7 @@ void Memory::moveToTrash(Signature * s)
_dbDriver && _dbDriver &&
!s->isBadSignature() && !s->isBadSignature() &&
s->id()>0 && s->id()>0 &&
(s->getLoopClosureId() == 0 || s->isSaved())) ((s->getLoopClosureId() == 0 || s->isSaved()) || !_databaseCleaned))
{ {
_dbDriver->asyncSave(s); _dbDriver->asyncSave(s);
} }

View File

@@ -63,6 +63,7 @@ Rtabmap::Rtabmap() :
_remThr(Parameters::defaultRtabmapReactivationThr()), _remThr(Parameters::defaultRtabmapReactivationThr()),
_localGraphCleaned(Parameters::defaultRtabmapLocalGraphCleaned()), _localGraphCleaned(Parameters::defaultRtabmapLocalGraphCleaned()),
_maxRetrieved(Parameters::defaultRtabmapMaxRetrieved()), _maxRetrieved(Parameters::defaultRtabmapMaxRetrieved()),
_actionsByTime(Parameters::defaultRtabmapActionsByTime()),
_lcHypothesisId(0), _lcHypothesisId(0),
_reactivateId(0), _reactivateId(0),
_highestHypothesisValue(0), _highestHypothesisValue(0),
@@ -264,6 +265,10 @@ void Rtabmap::parseParameters(const ParametersMap & parameters)
{ {
_maxRetrieved = std::atoi(iter->second.c_str()); _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. // By default, we create our strategies if they are not already created.
@@ -950,7 +955,9 @@ void Rtabmap::process()
if(sLoop) if(sLoop)
{ {
// select the actions of the neighbor with the highest // 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 NeighborsMap & neighbors = sLoop->getNeighbors();
const Signature * s; const Signature * s;
int currentWeight = -1; int currentWeight = -1;
@@ -958,11 +965,19 @@ void Rtabmap::process()
{ {
if(iter->second.size()) if(iter->second.size())
{ {
s = _memory->getSignature(iter->first); if(_actionsByTime)
if(s && s->getWeight() > currentWeight)
{ {
currentWeight = s->getWeight();
_actions = iter->second; _actions = iter->second;
break;
}
else // use also weight
{
s = _memory->getSignature(iter->first);
if(s && s->getWeight() > currentWeight)
{
currentWeight = s->getWeight();
_actions = iter->second;
}
} }
} }
} }

View File

@@ -110,6 +110,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->general_spinBox_imagesBufferSize->setObjectName(Parameters::kRtabmapSMStateBufferSize().c_str()); _ui->general_spinBox_imagesBufferSize->setObjectName(Parameters::kRtabmapSMStateBufferSize().c_str());
_ui->general_spinBox_minMemorySizeForLoopDetection->setObjectName(Parameters::kRtabmapMinMemorySizeForLoopDetection().c_str()); _ui->general_spinBox_minMemorySizeForLoopDetection->setObjectName(Parameters::kRtabmapMinMemorySizeForLoopDetection().c_str());
_ui->general_spinBox_maxRetrieved->setObjectName(Parameters::kRtabmapMaxRetrieved().c_str()); _ui->general_spinBox_maxRetrieved->setObjectName(Parameters::kRtabmapMaxRetrieved().c_str());
_ui->general_checkBox_actionsByTime->setObjectName(Parameters::kRtabmapActionsByTime().c_str());
_ui->lineEdit_workingDirectory->setObjectName(Parameters::kRtabmapWorkingDirectory().c_str()); _ui->lineEdit_workingDirectory->setObjectName(Parameters::kRtabmapWorkingDirectory().c_str());
connect(_ui->toolButton_workingDirectory, SIGNAL(clicked()), this, SLOT(changeWorkingDirectory())); connect(_ui->toolButton_workingDirectory, SIGNAL(clicked()), this, SLOT(changeWorkingDirectory()));

View File

@@ -68,7 +68,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="page_22"> <widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29"> <layout class="QVBoxLayout" name="verticalLayout_29">
@@ -913,21 +913,21 @@ when using the file type, logs are saved in Logrtabmap.txt (located in the worki
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<widget class="QLineEdit" name="lineEdit_workingDirectory"> <widget class="QLineEdit" name="lineEdit_workingDirectory">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="2"> <item row="8" column="2">
<widget class="QLabel" name="label_87"> <widget class="QLabel" name="label_87">
<property name="text"> <property name="text">
<string>Working directory (where the database is saved/loaded)</string> <string>Working directory (where the database is saved/loaded)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="8" column="1">
<widget class="QToolButton" name="toolButton_workingDirectory"> <widget class="QToolButton" name="toolButton_workingDirectory">
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
@@ -957,6 +957,26 @@ when using the file type, logs are saved in Logrtabmap.txt (located in the worki
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0">
<widget class="QCheckBox" name="general_checkBox_actionsByTime">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_39">
<property name="text">
<string>Select next actions based only on the more recent neighbor of the current node, otherwise, weight is also used.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -1053,8 +1073,8 @@ We can edit how will like the prediction used in the Bayes filter when there is
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>98</width> <width>524</width>
<height>78</height> <height>138</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
@@ -1661,8 +1681,7 @@ see Sqlite3 doc 'PRAGMA journal_mode'</string>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="label_86"> <widget class="QLabel" name="label_86">
<property name="text"> <property name="text">
<string>Database auto cleaning, <string>Database auto cleaning : don't save signature with a loop closure (only keeping the newest one).</string>
delete old signatures in the database after run (the ones which will never be reactivated)</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>