From 141f2d3334c3c1c4af60208b7a01ab6a5e57b171 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Wed, 5 Apr 2023 22:19:54 -0700 Subject: [PATCH] DbViewer: added align gps checkbox --- guilib/src/DatabaseViewer.cpp | 60 +++++--- guilib/src/ui/DatabaseViewer.ui | 254 +++++++++++++++++--------------- 2 files changed, 173 insertions(+), 141 deletions(-) diff --git a/guilib/src/DatabaseViewer.cpp b/guilib/src/DatabaseViewer.cpp index 51cb2e98..eb1be46e 100644 --- a/guilib/src/DatabaseViewer.cpp +++ b/guilib/src/DatabaseViewer.cpp @@ -412,6 +412,7 @@ 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_alignPosesWithGPS, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); 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())); @@ -717,6 +718,7 @@ void DatabaseViewer::restoreDefaultSettings() { // reset GUI parameters ui_->comboBox_logger_level->setCurrentIndex(1); + ui_->checkBox_alignPosesWithGPS->setChecked(true); ui_->checkBox_alignPosesWithGroundTruth->setChecked(true); ui_->checkBox_alignScansCloudsWithGroundTruth->setChecked(false); ui_->checkBox_ignoreIntermediateNodes->setChecked(false); @@ -1070,6 +1072,7 @@ bool DatabaseViewer::closeDatabase() ui_->checkBox_showOptimized->setEnabled(false); ui_->toolBox_statistics->clear(); databaseFileName_.clear(); + ui_->checkBox_alignPosesWithGPS->setVisible(false); ui_->checkBox_alignPosesWithGroundTruth->setVisible(false); ui_->checkBox_alignScansCloudsWithGroundTruth->setVisible(false); ui_->doubleSpinBox_optimizationScale->setVisible(false); @@ -1078,6 +1081,7 @@ bool DatabaseViewer::closeDatabase() ui_->label_rmse_title->setVisible(false); ui_->checkBox_ignoreIntermediateNodes->setVisible(false); ui_->label_ignoreINtermediateNdoes->setVisible(false); + ui_->label_alignPosesWithGPS->setVisible(false); ui_->label_alignPosesWithGroundTruth->setVisible(false); ui_->label_alignScansCloudsWithGroundTruth->setVisible(false); ui_->label_optimizeFrom->setText(tr("Root")); @@ -1701,6 +1705,7 @@ void DatabaseViewer::updateIds() gpsValues_.clear(); lastSliderIndexBrowsed_ = 0; ui_->checkBox_wmState->setVisible(false); + ui_->checkBox_alignPosesWithGPS->setVisible(false); ui_->checkBox_alignPosesWithGroundTruth->setVisible(false); ui_->checkBox_alignScansCloudsWithGroundTruth->setVisible(false); ui_->doubleSpinBox_optimizationScale->setVisible(false); @@ -1709,6 +1714,7 @@ void DatabaseViewer::updateIds() ui_->label_rmse_title->setVisible(false); ui_->checkBox_ignoreIntermediateNodes->setVisible(false); ui_->label_ignoreINtermediateNdoes->setVisible(false); + ui_->label_alignPosesWithGPS->setVisible(false); ui_->label_alignPosesWithGroundTruth->setVisible(false); ui_->label_alignScansCloudsWithGroundTruth->setVisible(false); ui_->menuEdit->setEnabled(true); @@ -1891,26 +1897,18 @@ void DatabaseViewer::updateIds() uSleep(100); QApplication::processEvents(); - if(!groundTruthPoses_.empty() || !gpsPoses_.empty()) - { - ui_->checkBox_alignPosesWithGroundTruth->setVisible(true); - ui_->doubleSpinBox_optimizationScale->setVisible(true); - ui_->label_scale_title->setVisible(true); - ui_->label_rmse->setVisible(true); - ui_->label_rmse_title->setVisible(true); - ui_->label_alignPosesWithGroundTruth->setVisible(true); + ui_->doubleSpinBox_optimizationScale->setVisible(!groundTruthPoses_.empty()); + ui_->label_scale_title->setVisible(!groundTruthPoses_.empty()); + ui_->label_rmse->setVisible(!groundTruthPoses_.empty()); + ui_->label_rmse_title->setVisible(!groundTruthPoses_.empty()); + + ui_->checkBox_alignPosesWithGPS->setVisible(!gpsPoses_.empty()); + ui_->label_alignPosesWithGPS->setVisible(!gpsPoses_.empty()); + ui_->checkBox_alignPosesWithGroundTruth->setVisible(!groundTruthPoses_.empty()); + ui_->label_alignPosesWithGroundTruth->setVisible(!groundTruthPoses_.empty()); + ui_->checkBox_alignScansCloudsWithGroundTruth->setVisible(!groundTruthPoses_.empty()); + ui_->label_alignScansCloudsWithGroundTruth->setVisible(!groundTruthPoses_.empty()); - if(!groundTruthPoses_.empty()) - { - ui_->label_alignPosesWithGroundTruth->setText(tr("Align poses with ground truth")); - ui_->checkBox_alignScansCloudsWithGroundTruth->setVisible(true); - ui_->label_alignScansCloudsWithGroundTruth->setVisible(true); - } - else - { - ui_->label_alignPosesWithGroundTruth->setText(tr("Align poses with GPS")); - } - } if(!gpsValues_.empty()) { ui_->menuExport_GPS->setEnabled(true); @@ -2553,10 +2551,11 @@ void DatabaseViewer::exportPoses(int format) optimizedPoses = uValueAt(graphes_, ui_->horizontalSlider_iterations->value()); } - if(ui_->checkBox_alignPosesWithGroundTruth->isChecked()) + if(ui_->checkBox_alignPosesWithGPS->isChecked() || + ui_->checkBox_alignPosesWithGroundTruth->isChecked()) { std::map refPoses = groundTruthPoses_; - if(refPoses.empty()) + if(ui_->checkBox_alignPosesWithGPS->isChecked()) { refPoses = gpsPoses_; } @@ -2593,7 +2592,7 @@ void DatabaseViewer::exportPoses(int format) rotational_min, rotational_max); - if(ui_->checkBox_alignPosesWithGroundTruth->isChecked() && !gtToMap.isIdentity()) + if(!gtToMap.isIdentity()) { for(std::map::iterator iter=optimizedPoses.begin(); iter!=optimizedPoses.end(); ++iter) { @@ -6666,7 +6665,7 @@ void DatabaseViewer::sliderIterationsValueChanged(int value) std::map graph = uValueAt(graphes_, value); std::map refPoses = groundTruthPoses_; - if(refPoses.empty()) + if(ui_->checkBox_alignPosesWithGPS->isChecked()) { refPoses = gpsPoses_; } @@ -6730,7 +6729,9 @@ void DatabaseViewer::sliderIterationsValueChanged(int value) UINFO("rotational_min=%f", rotational_min); UINFO("rotational_max=%f", rotational_max); - if(ui_->checkBox_alignPosesWithGroundTruth->isChecked() && !gtToMap.isIdentity()) + if((ui_->checkBox_alignPosesWithGPS->isChecked() || + ui_->checkBox_alignPosesWithGroundTruth->isChecked()) && + !gtToMap.isIdentity()) { for(std::map::iterator iter=graph.begin(); iter!=graph.end(); ++iter) { @@ -7174,6 +7175,15 @@ void DatabaseViewer::updateGraphView() ui_->label_poses->clear(); ui_->label_rmse->clear(); + if(sender() == ui_->checkBox_alignPosesWithGPS && ui_->checkBox_alignPosesWithGPS->isChecked()) + { + ui_->checkBox_alignPosesWithGroundTruth->setChecked(false); + } + else if(sender() == ui_->checkBox_alignPosesWithGroundTruth && ui_->checkBox_alignPosesWithGroundTruth->isChecked()) + { + ui_->checkBox_alignPosesWithGPS->setChecked(false); + } + if(odomPoses_.size()) { int fromId = ui_->spinBox_optimizationsFrom->value(); @@ -7600,6 +7610,7 @@ void DatabaseViewer::updateGraphView() ui_->spinBox_optimizationsFrom->setEnabled(false); ui_->checkBox_spanAllMaps->setEnabled(false); ui_->checkBox_wmState->setEnabled(false); + ui_->checkBox_alignPosesWithGPS->setEnabled(false); ui_->checkBox_alignPosesWithGroundTruth->setEnabled(false); ui_->checkBox_alignScansCloudsWithGroundTruth->setEnabled(false); ui_->checkBox_ignoreIntermediateNodes->setEnabled(false); @@ -7612,6 +7623,7 @@ void DatabaseViewer::updateGraphView() ui_->spinBox_optimizationsFrom->setEnabled(true); ui_->checkBox_spanAllMaps->setEnabled(true); ui_->checkBox_wmState->setEnabled(true); + ui_->checkBox_alignPosesWithGPS->setEnabled(true); ui_->checkBox_alignPosesWithGroundTruth->setEnabled(true); ui_->checkBox_alignScansCloudsWithGroundTruth->setEnabled(true); ui_->checkBox_ignoreIntermediateNodes->setEnabled(true); diff --git a/guilib/src/ui/DatabaseViewer.ui b/guilib/src/ui/DatabaseViewer.ui index eb1a292e..a363256f 100644 --- a/guilib/src/ui/DatabaseViewer.ui +++ b/guilib/src/ui/DatabaseViewer.ui @@ -1269,81 +1269,23 @@ - - + + - + Align poses with ground truth - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - - Poses - - - - - - - Time optimization (s) - - - - - - - Links (N, NM, G, LS, LT, U, P, LM, GR) - - - - - - - Path length (m) - - - - - - - Time grid (s) + + true - + - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + false @@ -1375,7 +1317,31 @@ - + + + + Time grid (s) + + + + + + + RMSE (m) + + + + + + + + + + true + + + + @@ -1385,38 +1351,8 @@ - - - - Align poses with ground truth - - - true - - - - - - - - - - false - - - - - - - - - - true - - - - - + + @@ -1426,23 +1362,6 @@ - - - Ignore intermediate nodes - - - true - - - - - - - RMSE (m) - - - - Align scans/clouds with ground truth @@ -1452,8 +1371,109 @@ + + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Links (N, NM, G, LS, LT, U, P, LM, GR) + + + + + + + Path length (m) + + + + + + + Poses + + + + + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Ignore intermediate nodes + + + true + + + + + + + Time optimization (s) + + + - + + + + + + true + + + + + + + Align poses with GPS + + + true + + + + +