DbViewer: refining cancelable, statistics labels selectable and x-axis can be time or IDs

This commit is contained in:
matlabbe
2017-04-27 16:13:27 -04:00
parent 57dbece417
commit 1ea94c0356
3 changed files with 108 additions and 50 deletions
+44 -15
View File
@@ -331,6 +331,8 @@ DatabaseViewer::DatabaseViewer(const QString & ini, QWidget * parent) :
connect(ui_->actionVertical_Layout, SIGNAL(toggled(bool)), this, SLOT(configModified())); connect(ui_->actionVertical_Layout, SIGNAL(toggled(bool)), this, SLOT(configModified()));
connect(ui_->checkBox_alignPosesWithGroundTruth, SIGNAL(stateChanged(int)), this, SLOT(configModified())); connect(ui_->checkBox_alignPosesWithGroundTruth, SIGNAL(stateChanged(int)), this, SLOT(configModified()));
connect(ui_->checkBox_alignPosesWithGroundTruth, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); connect(ui_->checkBox_alignPosesWithGroundTruth, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView()));
connect(ui_->checkBox_timeStats, SIGNAL(stateChanged(int)), this, SLOT(configModified()));
connect(ui_->checkBox_timeStats, SIGNAL(stateChanged(int)), this, SLOT(updateStatistics()));
// Graph view // Graph view
connect(ui_->checkBox_spanAllMaps, SIGNAL(stateChanged(int)), this, SLOT(configModified())); connect(ui_->checkBox_spanAllMaps, SIGNAL(stateChanged(int)), this, SLOT(configModified()));
connect(ui_->checkBox_ignorePoseCorrection, SIGNAL(stateChanged(int)), this, SLOT(configModified())); connect(ui_->checkBox_ignorePoseCorrection, SIGNAL(stateChanged(int)), this, SLOT(configModified()));
@@ -455,6 +457,7 @@ void DatabaseViewer::readSettings()
ui_->comboBox_logger_level->setCurrentIndex(settings.value("loggerLevel", ui_->comboBox_logger_level->currentIndex()).toInt()); ui_->comboBox_logger_level->setCurrentIndex(settings.value("loggerLevel", ui_->comboBox_logger_level->currentIndex()).toInt());
ui_->actionVertical_Layout->setChecked(settings.value("verticalLayout", ui_->actionVertical_Layout->isChecked()).toBool()); ui_->actionVertical_Layout->setChecked(settings.value("verticalLayout", ui_->actionVertical_Layout->isChecked()).toBool());
ui_->checkBox_alignPosesWithGroundTruth->setChecked(settings.value("alignGroundTruth", ui_->checkBox_alignPosesWithGroundTruth->isChecked()).toBool()); ui_->checkBox_alignPosesWithGroundTruth->setChecked(settings.value("alignGroundTruth", ui_->checkBox_alignPosesWithGroundTruth->isChecked()).toBool());
ui_->checkBox_timeStats->setChecked(settings.value("timeStats", ui_->checkBox_timeStats->isChecked()).toBool());
// GraphViewer settings // GraphViewer settings
ui_->graphViewer->loadSettings(settings, "GraphView"); ui_->graphViewer->loadSettings(settings, "GraphView");
@@ -544,6 +547,7 @@ void DatabaseViewer::writeSettings()
settings.setValue("loggerLevel", ui_->comboBox_logger_level->currentIndex()); settings.setValue("loggerLevel", ui_->comboBox_logger_level->currentIndex());
settings.setValue("verticalLayout", ui_->actionVertical_Layout->isChecked()); settings.setValue("verticalLayout", ui_->actionVertical_Layout->isChecked());
settings.setValue("alignGroundTruth", ui_->checkBox_alignPosesWithGroundTruth->isChecked()); settings.setValue("alignGroundTruth", ui_->checkBox_alignPosesWithGroundTruth->isChecked());
settings.setValue("timeStats", ui_->checkBox_timeStats->isChecked());
// save GraphViewer settings // save GraphViewer settings
ui_->graphViewer->saveSettings(settings, "GraphView"); ui_->graphViewer->saveSettings(settings, "GraphView");
@@ -630,6 +634,7 @@ void DatabaseViewer::restoreDefaultSettings()
// reset GUI parameters // reset GUI parameters
ui_->comboBox_logger_level->setCurrentIndex(1); ui_->comboBox_logger_level->setCurrentIndex(1);
ui_->checkBox_alignPosesWithGroundTruth->setChecked(true); ui_->checkBox_alignPosesWithGroundTruth->setChecked(true);
ui_->checkBox_timeStats->setChecked(true);
ui_->checkBox_spanAllMaps->setChecked(true); ui_->checkBox_spanAllMaps->setChecked(true);
ui_->checkBox_ignorePoseCorrection->setChecked(false); ui_->checkBox_ignorePoseCorrection->setChecked(false);
@@ -707,6 +712,8 @@ bool DatabaseViewer::openDatabase(const QString & path)
ui_->checkBox_showOptimized->setEnabled(false); ui_->checkBox_showOptimized->setEnabled(false);
ui_->toolBox_statistics->clear(); ui_->toolBox_statistics->clear();
databaseFileName_.clear(); databaseFileName_.clear();
ui_->checkBox_alignPosesWithGroundTruth->setVisible(false);
ui_->label_alignPosesWithGroundTruth->setVisible(false);
} }
std::string driverType = "sqlite3"; std::string driverType = "sqlite3";
@@ -1283,6 +1290,8 @@ void DatabaseViewer::updateIds()
mapIds_.clear(); mapIds_.clear();
poses_.clear(); poses_.clear();
groundTruthPoses_.clear(); groundTruthPoses_.clear();
ui_->checkBox_alignPosesWithGroundTruth->setVisible(false);
ui_->label_alignPosesWithGroundTruth->setVisible(false);
links_.clear(); links_.clear();
linksAdded_.clear(); linksAdded_.clear();
linksRefined_.clear(); linksRefined_.clear();
@@ -1382,6 +1391,12 @@ void DatabaseViewer::updateIds()
} }
} }
} }
if(!groundTruthPoses_.empty())
{
ui_->checkBox_alignPosesWithGroundTruth->setVisible(true);
ui_->label_alignPosesWithGroundTruth->setVisible(true);
}
UINFO("Loaded %d ids, %d poses and %d links", (int)ids_.size(), (int)poses_.size(), (int)links_.size()); UINFO("Loaded %d ids, %d poses and %d links", (int)ids_.size(), (int)poses_.size(), (int)links_.size());
if(ids_.size() && ui_->toolBox_statistics->isVisible()) if(ids_.size() && ui_->toolBox_statistics->isVisible())
@@ -1547,7 +1562,7 @@ void DatabaseViewer::updateStatistics()
} }
for(std::map<std::string, float>::iterator iter=statistics.begin(); iter!=statistics.end(); ++iter) for(std::map<std::string, float>::iterator iter=statistics.begin(); iter!=statistics.end(); ++iter)
{ {
ui_->toolBox_statistics->updateStat(iter->first.c_str(), float(stamp-firstStamp), iter->second, true); ui_->toolBox_statistics->updateStat(iter->first.c_str(), ui_->checkBox_timeStats->isChecked()?float(stamp-firstStamp):ids_[i], iter->second, true);
} }
} }
} }
@@ -2315,9 +2330,12 @@ void DatabaseViewer::refineAllNeighborLinks()
{ {
if(neighborLinks_.size()) if(neighborLinks_.size())
{ {
rtabmap::ProgressDialog progressDialog(this); rtabmap::ProgressDialog * progressDialog = new rtabmap::ProgressDialog(this);
progressDialog.setMaximumSteps(neighborLinks_.size()); progressDialog->setAttribute(Qt::WA_DeleteOnClose);
progressDialog.show(); progressDialog->setMaximumSteps(neighborLinks_.size());
progressDialog->setCancelButtonVisible(true);
progressDialog->setMinimumWidth(800);
progressDialog->show();
for(int i=0; i<neighborLinks_.size(); ++i) for(int i=0; i<neighborLinks_.size(); ++i)
{ {
@@ -2325,14 +2343,18 @@ void DatabaseViewer::refineAllNeighborLinks()
int to = neighborLinks_[i].to(); int to = neighborLinks_[i].to();
this->refineConstraint(neighborLinks_[i].from(), neighborLinks_[i].to(), true); this->refineConstraint(neighborLinks_[i].from(), neighborLinks_[i].to(), true);
progressDialog.appendText(tr("Refined link %1->%2 (%3/%4)").arg(from).arg(to).arg(i+1).arg(neighborLinks_.size())); progressDialog->appendText(tr("Refined link %1->%2 (%3/%4)").arg(from).arg(to).arg(i+1).arg(neighborLinks_.size()));
progressDialog.incrementStep(); progressDialog->incrementStep();
QApplication::processEvents(); QApplication::processEvents();
if(progressDialog->isCanceled())
{
break;
}
} }
this->updateGraphView(); this->updateGraphView();
progressDialog.setValue(progressDialog.maximumSteps()); progressDialog->setValue(progressDialog->maximumSteps());
progressDialog.appendText("Refining links finished!"); progressDialog->appendText("Refining links finished!");
} }
} }
@@ -2340,9 +2362,12 @@ void DatabaseViewer::refineAllLoopClosureLinks()
{ {
if(loopLinks_.size()) if(loopLinks_.size())
{ {
rtabmap::ProgressDialog progressDialog(this); rtabmap::ProgressDialog * progressDialog = new rtabmap::ProgressDialog(this);
progressDialog.setMaximumSteps(loopLinks_.size()); progressDialog->setAttribute(Qt::WA_DeleteOnClose);
progressDialog.show(); progressDialog->setMaximumSteps(neighborLinks_.size());
progressDialog->setCancelButtonVisible(true);
progressDialog->setMinimumWidth(800);
progressDialog->show();
for(int i=0; i<loopLinks_.size(); ++i) for(int i=0; i<loopLinks_.size(); ++i)
{ {
@@ -2350,14 +2375,18 @@ void DatabaseViewer::refineAllLoopClosureLinks()
int to = loopLinks_[i].to(); int to = loopLinks_[i].to();
this->refineConstraint(loopLinks_[i].from(), loopLinks_[i].to(), true); this->refineConstraint(loopLinks_[i].from(), loopLinks_[i].to(), true);
progressDialog.appendText(tr("Refined link %1->%2 (%3/%4)").arg(from).arg(to).arg(i+1).arg(loopLinks_.size())); progressDialog->appendText(tr("Refined link %1->%2 (%3/%4)").arg(from).arg(to).arg(i+1).arg(loopLinks_.size()));
progressDialog.incrementStep(); progressDialog->incrementStep();
QApplication::processEvents(); QApplication::processEvents();
if(progressDialog->isCanceled())
{
break;
}
} }
this->updateGraphView(); this->updateGraphView();
progressDialog.setValue(progressDialog.maximumSteps()); progressDialog->setValue(progressDialog->maximumSteps());
progressDialog.appendText("Refining links finished!"); progressDialog->appendText("Refining links finished!");
} }
} }
+2
View File
@@ -154,8 +154,10 @@ void StatItem::setupUi(QGridLayout * grid)
_button->setPopupMode(QToolButton::InstantPopup); _button->setPopupMode(QToolButton::InstantPopup);
_button->setMenu(_menu); _button->setMenu(_menu);
_name = new QLabel(this); _name = new QLabel(this);
_name->setTextInteractionFlags(Qt::TextSelectableByMouse);
_name->setWordWrap(true); _name->setWordWrap(true);
_value = new QLabel(this); _value = new QLabel(this);
_value->setTextInteractionFlags(Qt::TextSelectableByMouse);
_unit = new QLabel(this); _unit = new QLabel(this);
if(grid) if(grid)
+62 -35
View File
@@ -52,7 +52,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>394</width> <width>381</width>
<height>196</height> <height>196</height>
</rect> </rect>
</property> </property>
@@ -210,7 +210,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>394</width> <width>381</width>
<height>196</height> <height>196</height>
</rect> </rect>
</property> </property>
@@ -916,6 +916,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QLabel" name="label_alignPosesWithGroundTruth">
<property name="text">
<string>Align poses with ground truth</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_alignPosesWithGroundTruth">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@@ -936,19 +956,12 @@
</attribute> </attribute>
<widget class="QWidget" name="dockWidgetContents_3"> <widget class="QWidget" name="dockWidgetContents_3">
<layout class="QVBoxLayout" name="verticalLayout_10"> <layout class="QVBoxLayout" name="verticalLayout_10">
<property name="margin">
<number>0</number>
</property>
<item> <item>
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,0,1"> <layout class="QGridLayout" name="gridLayout_4" columnstretch="0,1">
<item row="0" column="2"> <item row="0" column="0">
<widget class="QLabel" name="label_logger_level">
<property name="text">
<string>Logger level</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_logger_level"> <widget class="QComboBox" name="comboBox_logger_level">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>1</number>
@@ -975,32 +988,22 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="0" column="1">
<widget class="QLabel" name="label_logger_level_2"> <widget class="QLabel" name="label_logger_level">
<property name="text"> <property name="text">
<string>Align poses with ground truth</string> <string>Logger level</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBox_alignPosesWithGroundTruth">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QToolBox" name="toolBox"> <widget class="QToolBox" name="toolBox">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="page_3"> <widget class="QWidget" name="page_3">
<property name="geometry"> <property name="geometry">
@@ -1008,7 +1011,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>339</width> <width>339</width>
<height>210</height> <height>186</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -1143,8 +1146,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>282</width> <width>326</width>
<height>626</height> <height>609</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -1506,8 +1509,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>295</width> <width>339</width>
<height>223</height> <height>173</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -1606,8 +1609,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>282</width> <width>326</width>
<height>266</height> <height>249</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -1974,6 +1977,30 @@
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<layout class="QGridLayout" name="gridLayout_8" columnstretch="0,1">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_timeStats">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_logger_level_3">
<property name="text">
<string>Time (s) used in figures for x-axis instead of node IDs.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="rtabmap::StatsToolBox" name="toolBox_statistics" native="true"/> <widget class="rtabmap::StatsToolBox" name="toolBox_statistics" native="true"/>
</item> </item>