Added badSignaturesIgnored parameter, set to false will keep bad images in memory and in the map's graph (useful on RGBD-SLAM with TORO optimizations to propagate more equally errors to nodes with blank images)

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1063 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-01-15 20:41:58 +00:00
parent 11eed189c9
commit b8c6014ed2
5 changed files with 54 additions and 16 deletions

View File

@@ -196,6 +196,7 @@ private:
float _recentWmRatio;
bool _idUpdatedToNewOneRehearsal;
bool _generateIds;
bool _badSignaturesIgnored;
int _idCount;
int _idMapCount;

View File

@@ -148,7 +148,8 @@ class RTABMAP_EXP Parameters
RTABMAP_PARAM(Mem, IncrementalMemory, bool, true, "SLAM mode, othwersize it is Localization mode.");
RTABMAP_PARAM(Mem, RecentWmRatio, float, 0.2, "Ratio of locations after the last loop closure in WM that cannot be transferred.");
RTABMAP_PARAM(Mem, RehearsalIdUpdatedToNewOne, bool, false, "On merge, update to new id. When false, no copy.");
RTABMAP_PARAM(Mem, GenerateIds, bool, true, "True=Generate location Ids, False=use input image ids.")
RTABMAP_PARAM(Mem, GenerateIds, bool, true, "True=Generate location Ids, False=use input image ids.");
RTABMAP_PARAM(Mem, BadSignaturesIgnored, bool, true, "Bad signatures are ignored.")
// KeypointMemory (Keypoint-based)
RTABMAP_PARAM(Kp, PublishKeypoints, bool, true, "Publishing keypoints.");

View File

@@ -54,6 +54,7 @@ Memory::Memory(const ParametersMap & parameters) :
_recentWmRatio(Parameters::defaultMemRecentWmRatio()),
_idUpdatedToNewOneRehearsal(Parameters::defaultMemRehearsalIdUpdatedToNewOne()),
_generateIds(Parameters::defaultMemGenerateIds()),
_badSignaturesIgnored(Parameters::defaultMemBadSignaturesIgnored()),
_idCount(kIdStart),
_idMapCount(kIdStart),
_lastSignature(0),
@@ -147,7 +148,7 @@ bool Memory::init(const std::string & dbUrl, bool dbOverwritten, const Parameter
for(std::list<Signature*>::reverse_iterator iter=dbSignatures.rbegin(); iter!=dbSignatures.rend(); ++iter)
{
// ignore bad signatures
if(!(*iter)->isBadSignature())
if(!((*iter)->isBadSignature() && _badSignaturesIgnored))
{
_signatures.insert(std::pair<int, Signature *>((*iter)->id(), *iter));
if((int)_stMem.size() <= _maxStMemSize)
@@ -286,6 +287,7 @@ void Memory::parseParameters(const ParametersMap & parameters)
Parameters::parse(parameters, Parameters::kMemRehearsedNodesKept(), _keepRehearsedNodesInDb);
Parameters::parse(parameters, Parameters::kMemRehearsalIdUpdatedToNewOne(), _idUpdatedToNewOneRehearsal);
Parameters::parse(parameters, Parameters::kMemGenerateIds(), _generateIds);
Parameters::parse(parameters, Parameters::kMemBadSignaturesIgnored(), _badSignaturesIgnored);
Parameters::parse(parameters, Parameters::kMemRehearsalSimilarity(), _similarityThreshold);
Parameters::parse(parameters, Parameters::kMemRecentWmRatio(), _recentWmRatio);
Parameters::parse(parameters, Parameters::kMemSTMSize(), _maxStMemSize);
@@ -466,12 +468,6 @@ bool Memory::update(const Image & image, Statistics * stats)
_lastSignature = signature;
if(_lastLoopClosureId == 0 && !signature->isBadSignature())
{
// If not set use the new one added
_lastLoopClosureId = signature->id();
}
//============================================================
// Rehearsal step...
// Compare with the X last signatures. If different, add this
@@ -1233,7 +1229,7 @@ std::list<int> Memory::cleanup(const std::list<int> & ignoredIds)
std::list<int> signaturesRemoved;
// bad signature
if(_lastSignature->isBadSignature() || !_incrementalMemory)
if((_lastSignature->isBadSignature() && _badSignaturesIgnored) || !_incrementalMemory)
{
if(_lastSignature->isBadSignature())
{
@@ -1448,7 +1444,7 @@ void Memory::moveToTrash(Signature * s, bool saveToDatabase)
if(s)
{
// If not saved to database or it is a bad signature, remove links!
if(!saveToDatabase || s->isBadSignature())
if(!saveToDatabase || (s->isBadSignature() && _badSignaturesIgnored))
{
UASSERT_MSG(this->isInSTM(s->id()),
uFormat("Deleting location (%d) outside the STM is not implemented!", s->id()).c_str());

View File

@@ -310,6 +310,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->general_doubleSpinBox_recentWmRatio->setObjectName(Parameters::kMemRecentWmRatio().c_str());
_ui->general_checkBox_RehearsalIdUpdatedToNewOne->setObjectName(Parameters::kMemRehearsalIdUpdatedToNewOne().c_str());
_ui->general_checkBox_generateIds->setObjectName(Parameters::kMemGenerateIds().c_str());
_ui->general_checkBox_badSignaturesIgnored->setObjectName(Parameters::kMemBadSignaturesIgnored().c_str());
// Database
_ui->checkBox_dbInMemory->setObjectName(Parameters::kDbSqlite3InMemory().c_str());
@@ -1800,6 +1801,25 @@ void PreferencesDialog::addParameter(const QObject * object, bool value)
{
// Add parameter
_parameters.insert(rtabmap::ParametersPair(object->objectName().toStdString(), uBool2Str(value)));
if(value && checkbox == _ui->general_checkBox_activateRGBD)
{
// add all RGBD parameters!
this->addParameter(_ui->rgdb_linearUpdate, _ui->rgdb_linearUpdate->value());
this->addParameter(_ui->rgdb_angularUpdate, _ui->rgdb_linearUpdate->value());
this->addParameter(_ui->odomScanHistory, _ui->odomScanHistory->value());
this->addParameters(_ui->groupBox_local_loop_closure);
this->addParameters(_ui->groupBox_lcc_bow);
if(_ui->loopClosure_icpEnabled->isChecked())
{
this->addParameter(_ui->loopClosure_icpType, _ui->loopClosure_icpType->currentIndex());
}
}
if(value && checkbox == _ui->loopClosure_icpEnabled)
{
this->addParameter(_ui->loopClosure_icpType, _ui->loopClosure_icpType->currentIndex());
}
}
else
{

View File

@@ -64,8 +64,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>955</width>
<height>685</height>
<width>939</width>
<height>724</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -86,7 +86,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>9</number>
<number>12</number>
</property>
<widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29">
@@ -2399,6 +2399,26 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_retrieved_3">
<property name="text">
<string>Bad signatures are ignored.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="general_checkBox_badSignaturesIgnored">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -3644,7 +3664,7 @@ Rigid transformations between nodes are saved on the neighbor links of the RTAB-
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<widget class="QGroupBox" name="groupBox_local_loop_closure">
<property name="title">
<string>Local loop closure detection</string>
</property>
@@ -4416,7 +4436,7 @@ Rigid transformations between nodes are saved on the neighbor links of the RTAB-
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBox_lcc_bow">
<property name="title">
<string>Guess transform</string>
</property>
@@ -4563,7 +4583,7 @@ Rigid transformations between nodes are saved on the neighbor links of the RTAB-
<item>
<widget class="QStackedWidget" name="stackedWidget_loopClosureICP">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="page_17">
<layout class="QVBoxLayout" name="verticalLayout_37">