From 93e1d732c9ccc56cd1ee77d9e6391586ae7ee883 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Wed, 21 Feb 2018 15:13:02 -0500 Subject: [PATCH] DbViewer: added option to align scans/clouds to ground truth for convenience --- guilib/src/DatabaseViewer.cpp | 50 ++++++++++++++++++++--- guilib/src/GraphViewer.cpp | 8 ++-- guilib/src/ui/DatabaseViewer.ui | 70 +++++++++++++++++++++------------ 3 files changed, 95 insertions(+), 33 deletions(-) diff --git a/guilib/src/DatabaseViewer.cpp b/guilib/src/DatabaseViewer.cpp index 65fa5f24..b93ce03e 100644 --- a/guilib/src/DatabaseViewer.cpp +++ b/guilib/src/DatabaseViewer.cpp @@ -348,8 +348,8 @@ DatabaseViewer::DatabaseViewer(const QString & ini, QWidget * parent) : //connect(ui_->graphicsView_B, SIGNAL(configChanged()), this, SLOT(configModified())); connect(ui_->comboBox_logger_level, SIGNAL(currentIndexChanged(int)), 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(updateGraphView())); + connect(ui_->checkBox_alignScansCloudsWithGroundTruth, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); connect(ui_->checkBox_ignoreIntermediateNodes, SIGNAL(stateChanged(int)), this, SLOT(configModified())); connect(ui_->checkBox_ignoreIntermediateNodes, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); connect(ui_->checkBox_timeStats, SIGNAL(stateChanged(int)), this, SLOT(configModified())); @@ -634,6 +634,7 @@ void DatabaseViewer::restoreDefaultSettings() // reset GUI parameters ui_->comboBox_logger_level->setCurrentIndex(1); ui_->checkBox_alignPosesWithGroundTruth->setChecked(true); + ui_->checkBox_alignScansCloudsWithGroundTruth->setChecked(false); ui_->checkBox_ignoreIntermediateNodes->setChecked(false); ui_->checkBox_timeStats->setChecked(true); @@ -923,12 +924,14 @@ bool DatabaseViewer::closeDatabase() ui_->toolBox_statistics->clear(); databaseFileName_.clear(); ui_->checkBox_alignPosesWithGroundTruth->setVisible(false); + ui_->checkBox_alignScansCloudsWithGroundTruth->setVisible(false); ui_->doubleSpinBox_optimizationScale->setVisible(false); ui_->label_scale_title->setVisible(false); ui_->label_rmse->setVisible(false); ui_->label_rmse_title->setVisible(false); ui_->checkBox_ignoreIntermediateNodes->setVisible(false); ui_->label_alignPosesWithGroundTruth->setVisible(false); + ui_->label_alignScansCloudsWithGroundTruth->setVisible(false); ui_->label_optimizeFrom->setText(tr("Optimize from")); ui_->textEdit_info->clear(); @@ -1435,12 +1438,14 @@ void DatabaseViewer::updateIds() gpsPoses_.clear(); gpsValues_.clear(); ui_->checkBox_alignPosesWithGroundTruth->setVisible(false); + ui_->checkBox_alignScansCloudsWithGroundTruth->setVisible(false); ui_->doubleSpinBox_optimizationScale->setVisible(false); ui_->label_scale_title->setVisible(false); ui_->label_rmse->setVisible(false); ui_->label_rmse_title->setVisible(false); ui_->checkBox_ignoreIntermediateNodes->setVisible(false); ui_->label_alignPosesWithGroundTruth->setVisible(false); + ui_->label_alignScansCloudsWithGroundTruth->setVisible(false); ui_->menuExport_GPS->setEnabled(false); ui_->actionPoses_KML->setEnabled(false); links_.clear(); @@ -1578,9 +1583,12 @@ void DatabaseViewer::updateIds() ui_->label_rmse->setVisible(true); ui_->label_rmse_title->setVisible(true); ui_->label_alignPosesWithGroundTruth->setVisible(true); + if(!groundTruthPoses_.empty()) { ui_->label_alignPosesWithGroundTruth->setText(tr("Align poses with ground truth")); + ui_->checkBox_alignScansCloudsWithGroundTruth->setVisible(true); + ui_->label_alignScansCloudsWithGroundTruth->setVisible(true); } else { @@ -2018,7 +2026,15 @@ void DatabaseViewer::exportPoses(int format) return; } - std::map optimizedPoses = uValueAt(graphes_, ui_->horizontalSlider_iterations->value()); + std::map optimizedPoses; + if(ui_->checkBox_alignScansCloudsWithGroundTruth->isChecked() && !groundTruthPoses_.empty()) + { + optimizedPoses = groundTruthPoses_; + } + else + { + optimizedPoses = uValueAt(graphes_, ui_->horizontalSlider_iterations->value()); + } if(optimizedPoses.size()) { @@ -2583,7 +2599,15 @@ void DatabaseViewer::view3DMap() } } - std::map optimizedPoses = uValueAt(graphes_, ui_->horizontalSlider_iterations->value()); + std::map optimizedPoses; + if(ui_->checkBox_alignScansCloudsWithGroundTruth->isChecked() && !groundTruthPoses_.empty()) + { + optimizedPoses = groundTruthPoses_; + } + else + { + optimizedPoses = uValueAt(graphes_, ui_->horizontalSlider_iterations->value()); + } if(ui_->groupBox_posefiltering->isChecked()) { optimizedPoses = graph::radiusPosesFiltering(optimizedPoses, @@ -2626,7 +2650,15 @@ void DatabaseViewer::generate3DMap() } } - std::map optimizedPoses = uValueAt(graphes_, ui_->horizontalSlider_iterations->value()); + std::map optimizedPoses; + if(ui_->checkBox_alignScansCloudsWithGroundTruth->isChecked() && !groundTruthPoses_.empty()) + { + optimizedPoses = groundTruthPoses_; + } + else + { + optimizedPoses = uValueAt(graphes_, ui_->horizontalSlider_iterations->value()); + } if(ui_->groupBox_posefiltering->isChecked()) { optimizedPoses = graph::radiusPosesFiltering(optimizedPoses, @@ -4492,7 +4524,15 @@ void DatabaseViewer::sliderIterationsValueChanged(int value) } } - std::map graphFiltered = graph; + std::map graphFiltered; + if(ui_->checkBox_alignScansCloudsWithGroundTruth->isChecked() && !groundTruthPoses_.empty()) + { + graphFiltered = groundTruthPoses_; + } + else + { + graphFiltered = graph; + } if(ui_->groupBox_posefiltering->isChecked()) { graphFiltered = graph::radiusPosesFiltering(graph, diff --git a/guilib/src/GraphViewer.cpp b/guilib/src/GraphViewer.cpp index 2f47b79f..81015bc5 100644 --- a/guilib/src/GraphViewer.cpp +++ b/guilib/src/GraphViewer.cpp @@ -286,11 +286,11 @@ GraphViewer::GraphViewer(QWidget * parent) : _graphRoot->setParentItem(_root); _globalPathRoot = (QGraphicsItem *)this->scene()->addEllipse(QRectF(-0.0001,-0.0001,0.0001,0.0001)); - _globalPathRoot->setZValue(5); + _globalPathRoot->setZValue(8); _globalPathRoot->setParentItem(_root); _localPathRoot = (QGraphicsItem *)this->scene()->addEllipse(QRectF(-0.0001,-0.0001,0.0001,0.0001)); - _localPathRoot->setZValue(6); + _localPathRoot->setZValue(9); _localPathRoot->setParentItem(_root); _gtGraphRoot = (QGraphicsItem *)this->scene()->addEllipse(QRectF(-0.0001,-0.0001,0.0001,0.0001)); @@ -441,11 +441,12 @@ void GraphViewer::updateGraph(const std::map & poses, if(_intraInterSessionColors) { linkItem->setColor(interSessionClosure?_loopInterSessionColor:_loopIntraSessionColor); - linkItem->setZValue(interSessionClosure?8:9); + linkItem->setZValue(interSessionClosure?6:7); } else { linkItem->setColor(_loopClosureLocalColor); + linkItem->setZValue(7); } } else @@ -458,6 +459,7 @@ void GraphViewer::updateGraph(const std::map & poses, else { linkItem->setColor(_loopClosureColor); + linkItem->setZValue(9); } } diff --git a/guilib/src/ui/DatabaseViewer.ui b/guilib/src/ui/DatabaseViewer.ui index d8825b8d..6f223708 100644 --- a/guilib/src/ui/DatabaseViewer.ui +++ b/guilib/src/ui/DatabaseViewer.ui @@ -921,7 +921,7 @@ - + @@ -931,7 +931,7 @@ - + @@ -941,7 +941,7 @@ - + @@ -954,42 +954,42 @@ - + Poses - + Time optimization (s) - + Links (N, NM, G, LS, LT, U, P) - + Path length (m) - + Time grid (s) - + @@ -1020,7 +1020,7 @@ - + @@ -1040,6 +1040,16 @@ + + + + + + + false + + + @@ -1050,18 +1060,18 @@ - - + + - - false + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - + + Ignore intermediate nodes @@ -1070,20 +1080,30 @@ - + RMSE (m) - - + + + + Align scans/clouds with ground truth + + + true + + + + + - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + true @@ -1840,8 +1860,8 @@ 0 0 - 205 - 117 + 298 + 179 @@ -1940,8 +1960,8 @@ 0 0 - 185 - 487 + 433 + 198