From 2b5ae3f9a8b8682f05179c3412a7386983737ad6 Mon Sep 17 00:00:00 2001 From: Mathieu Labbe Date: Wed, 1 Apr 2015 14:34:43 -0400 Subject: [PATCH] DatabaseViewer: added "Ignore pose correction" option --- guilib/src/DatabaseViewer.cpp | 27 ++++++++++++- guilib/src/ui/DatabaseViewer.ui | 71 ++++++++++++++++----------------- 2 files changed, 61 insertions(+), 37 deletions(-) diff --git a/guilib/src/DatabaseViewer.cpp b/guilib/src/DatabaseViewer.cpp index da8de194..139b7180 100644 --- a/guilib/src/DatabaseViewer.cpp +++ b/guilib/src/DatabaseViewer.cpp @@ -192,6 +192,7 @@ DatabaseViewer::DatabaseViewer(QWidget * parent) : connect(ui_->spinBox_iterations, SIGNAL(editingFinished()), this, SLOT(updateGraphView())); connect(ui_->spinBox_optimizationsFrom, SIGNAL(editingFinished()), this, SLOT(updateGraphView())); connect(ui_->checkBox_ignoreCovariance, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); + connect(ui_->checkBox_ignorePoseCorrection, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); connect(ui_->comboBox_graphOptimizer, SIGNAL(currentIndexChanged(int)), this, SLOT(updateGraphView())); connect(ui_->checkBox_2dslam, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); connect(ui_->spinBox_optimizationDepth, SIGNAL(editingFinished()), this, SLOT(updateGraphView())); @@ -314,6 +315,7 @@ void DatabaseViewer::readSettings() settings.beginGroup("optimization"); ui_->spinBox_iterations->setValue(settings.value("iterations", ui_->spinBox_iterations->value()).toInt()); ui_->checkBox_ignoreCovariance->setChecked(settings.value("ignoreCovariance", ui_->checkBox_ignoreCovariance->isChecked()).toBool()); + ui_->checkBox_ignorePoseCorrection->setChecked(settings.value("ignorePoseCorrection", ui_->checkBox_ignorePoseCorrection->isChecked()).toBool()); ui_->comboBox_graphOptimizer->setCurrentIndex(settings.value("strategy", ui_->comboBox_graphOptimizer->currentIndex()).toInt()); ui_->checkBox_2dslam->setChecked(settings.value("slam2d", ui_->checkBox_2dslam->isChecked()).toBool()); ui_->spinBox_optimizationDepth->setValue(settings.value("depth", ui_->spinBox_optimizationDepth->value()).toInt()); @@ -387,6 +389,7 @@ void DatabaseViewer::writeSettings() settings.beginGroup("optimization"); settings.setValue("iterations", ui_->spinBox_iterations->value()); settings.setValue("ignoreCovariance", ui_->checkBox_ignoreCovariance->isChecked()); + settings.setValue("ignorePoseCorrection", ui_->checkBox_ignorePoseCorrection->isChecked()); settings.setValue("strategy", ui_->comboBox_graphOptimizer->currentIndex()); settings.setValue("slam2d", ui_->checkBox_2dslam->isChecked()); settings.setValue("depth", ui_->spinBox_optimizationDepth->value()); @@ -2289,7 +2292,29 @@ void DatabaseViewer::updateGraphView() std::map finalPoses; graphes_.push_back(poses_); ui_->actionGenerate_TORO_graph_graph->setEnabled(true); - std::multimap links = updateLinksWithModifications(links_); + std::multimap links; + if(ui_->checkBox_ignorePoseCorrection->isChecked()) + { + std::multimap tmp = links_; + for(std::multimap::iterator iter=tmp.begin(); iter!=tmp.end(); ++iter) + { + if(iter->second.type() == Link::kNeighbor) + { + Transform poseFrom = uValue(poses_, iter->second.from(), Transform()); + Transform poseTo = uValue(poses_, iter->second.to(), Transform()); + if(!poseFrom.isNull() && !poseTo.isNull()) + { + iter->second.setTransform(poseFrom.inverse() * poseTo); // recompute raw odom transformation + + } + } + } + links = updateLinksWithModifications(tmp); + } + else + { + links = updateLinksWithModifications(links_); + } graph::Optimizer * optimizer = 0; if(ui_->comboBox_graphOptimizer->currentIndex() == graph::Optimizer::kTypeG2O) { diff --git a/guilib/src/ui/DatabaseViewer.ui b/guilib/src/ui/DatabaseViewer.ui index 6a06e759..2e82d379 100644 --- a/guilib/src/ui/DatabaseViewer.ui +++ b/guilib/src/ui/DatabaseViewer.ui @@ -42,7 +42,7 @@ 0 0 153 - 136 + 127 @@ -122,16 +122,7 @@ - - 12 - - - 12 - - - 12 - - + 12 @@ -206,7 +197,7 @@ 0 0 152 - 136 + 127 @@ -286,16 +277,7 @@ - - 12 - - - 12 - - - 12 - - + 12 @@ -358,7 +340,7 @@ 0 0 1182 - 22 + 25 @@ -1181,6 +1163,22 @@ + + + + + + + 0 + + + 1000 + + + 0 + + + @@ -1218,7 +1216,7 @@ - + 2d SLAM @@ -1249,7 +1247,7 @@ - + @@ -1266,19 +1264,20 @@ - - - + + + + Ignore pose correction + + + + + + - - 0 - - - 1000 - - - 0 + + false