Skip to content

Commit

Permalink
DBViewer: added option to ignore optimized graph guess when detecting…
Browse files Browse the repository at this point in the history
… more loop closures
  • Loading branch information
matlabbe committed Jul 19, 2024
1 parent 41fe47e commit 08a44ec
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 64 deletions.
2 changes: 1 addition & 1 deletion guilib/include/rtabmap/gui/DatabaseViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private Q_SLOTS:
void updateCovariances(const QList<Link> & links);
void refineLinks(const QList<Link> & links);
void refineConstraint(int from, int to, bool silent);
bool addConstraint(int from, int to, bool silent);
bool addConstraint(int from, int to, bool silent, bool silentlyUseOptimizedGraphAsGuess = false);
void exportPoses(int format);
void exportGPS(int format);

Expand Down
11 changes: 8 additions & 3 deletions guilib/src/DatabaseViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ DatabaseViewer::DatabaseViewer(const QString & ini, QWidget * parent) :
connect(ui_->spinBox_detectMore_iterations, SIGNAL(valueChanged(int)), this, SLOT(configModified()));
connect(ui_->checkBox_detectMore_intraSession, SIGNAL(stateChanged(int)), this, SLOT(configModified()));
connect(ui_->checkBox_detectMore_interSession, SIGNAL(stateChanged(int)), this, SLOT(configModified()));
connect(ui_->checkBox_opt_graph_as_guess, SIGNAL(stateChanged(int)), this, SLOT(configModified()));

connect(ui_->lineEdit_obstacleColor, SIGNAL(textChanged(const QString &)), this, SLOT(configModified()));
connect(ui_->lineEdit_groundColor, SIGNAL(textChanged(const QString &)), this, SLOT(configModified()));
Expand Down Expand Up @@ -635,6 +636,7 @@ void DatabaseViewer::readSettings()
ui_->spinBox_detectMore_iterations->setValue(settings.value("iterations", ui_->spinBox_detectMore_iterations->value()).toInt());
ui_->checkBox_detectMore_intraSession->setChecked(settings.value("intra_session", ui_->checkBox_detectMore_intraSession->isChecked()).toBool());
ui_->checkBox_detectMore_interSession->setChecked(settings.value("inter_session", ui_->checkBox_detectMore_interSession->isChecked()).toBool());
ui_->checkBox_opt_graph_as_guess->setChecked(settings.value("opt_graph_as_guess", ui_->checkBox_opt_graph_as_guess->isChecked()).toBool());
settings.endGroup();
settings.endGroup();

Expand Down Expand Up @@ -725,6 +727,7 @@ void DatabaseViewer::writeSettings()
settings.setValue("iterations", ui_->spinBox_detectMore_iterations->value());
settings.setValue("intra_session", ui_->checkBox_detectMore_intraSession->isChecked());
settings.setValue("inter_session", ui_->checkBox_detectMore_interSession->isChecked());
settings.setValue("opt_graph_as_guess", ui_->checkBox_opt_graph_as_guess->isChecked());
settings.endGroup();
settings.endGroup();

Expand Down Expand Up @@ -802,6 +805,7 @@ void DatabaseViewer::restoreDefaultSettings()
ui_->spinBox_detectMore_iterations->setValue(5);
ui_->checkBox_detectMore_intraSession->setChecked(true);
ui_->checkBox_detectMore_interSession->setChecked(true);
ui_->checkBox_opt_graph_as_guess->setChecked(true);
}

void DatabaseViewer::openDatabase()
Expand Down Expand Up @@ -4215,6 +4219,7 @@ void DatabaseViewer::detectMoreLoopClosures()
std::pair<int, int> lastAdded(0,0);
bool intraSession = ui_->checkBox_detectMore_intraSession->isChecked();
bool interSession = ui_->checkBox_detectMore_interSession->isChecked();
bool useOptimizedGraphAsGuess = ui_->checkBox_opt_graph_as_guess->isChecked();
if(!interSession && !intraSession)
{
QMessageBox::warning(this, tr("Cannot detect more loop closures"), tr("Intra and inter session parameters are disabled! Enable one or both."));
Expand Down Expand Up @@ -4268,7 +4273,7 @@ void DatabaseViewer::detectMoreLoopClosures()
delta.getNorm() >= ui_->doubleSpinBox_detectMore_radiusMin->value())
{
checkedLoopClosures.insert(std::make_pair(from, to));
if(addConstraint(from, to, true))
if(addConstraint(from, to, true, useOptimizedGraphAsGuess))
{
UINFO("Added new loop closure between %d and %d.", from, to);
++added;
Expand Down Expand Up @@ -8560,7 +8565,7 @@ void DatabaseViewer::addConstraint()
addConstraint(from, to, false);
}

bool DatabaseViewer::addConstraint(int from, int to, bool silent)
bool DatabaseViewer::addConstraint(int from, int to, bool silent, bool silentlyUseOptimizedGraphAsGuess)
{
bool switchedIds = false;
if(from == to)
Expand Down Expand Up @@ -8728,7 +8733,7 @@ bool DatabaseViewer::addConstraint(int from, int to, bool silent)
guessFromGraphRejected = true;
}
}
else
else if(silentlyUseOptimizedGraphAsGuess)
{
guess = fromIter->second.inverse() * toIter->second;
}
Expand Down
140 changes: 80 additions & 60 deletions guilib/src/ui/DatabaseViewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>307</width>
<width>417</width>
<height>389</height>
</rect>
</property>
Expand Down Expand Up @@ -392,7 +392,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>306</width>
<width>416</width>
<height>389</height>
</rect>
</property>
Expand Down Expand Up @@ -1634,7 +1634,7 @@
<item>
<widget class="QToolBox" name="toolBox">
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="page_3">
<property name="geometry">
Expand Down Expand Up @@ -2458,24 +2458,17 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>226</width>
<height>192</height>
<y>-42</y>
<width>298</width>
<height>272</height>
</rect>
</property>
<attribute name="label">
<string>Detect more loop closures</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_10" columnstretch="0,1">
<item row="4" column="1">
<widget class="QLabel" name="label_32">
<property name="text">
<string>Intra-session</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_detectMore_radius">
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_detectMore_radiusMin">
<property name="suffix">
<string> m</string>
</property>
Expand All @@ -2489,17 +2482,51 @@
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_36">
<property name="text">
<string>Radius Min</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_32">
<property name="text">
<string>Intra-session</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_29">
<property name="text">
<string>Radius Max</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_30">
<property name="text">
<string>Angle</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_detectMore_angle">
<property name="suffix">
Expand All @@ -2519,10 +2546,22 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_30">
<property name="text">
<string>Angle</string>
<item row="0" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_detectMore_radius">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
Expand All @@ -2539,70 +2578,51 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_detectMore_intraSession">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Iterations</string>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_34">
<property name="text">
<string>Inter-session</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_detectMore_intraSession">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="checkBox_detectMore_interSession">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_36">
<item row="6" column="0">
<widget class="QCheckBox" name="checkBox_opt_graph_as_guess">
<property name="text">
<string>Radius Min</string>
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_detectMore_radiusMin">
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
<item row="6" column="1">
<widget class="QLabel" name="label_37">
<property name="text">
<string>Use optimized graph as guess</string>
</property>
<property name="value">
<double>0.000000000000000</double>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
Expand All @@ -2613,8 +2633,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>185</width>
<height>485</height>
<width>432</width>
<height>196</height>
</rect>
</property>
<attribute name="label">
Expand Down

0 comments on commit 08a44ec

Please sign in to comment.