PostProcessingDialog.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
29 #include "ui_postProcessingDialog.h"
30 
31 #include <QPushButton>
32 #include <rtabmap/core/Optimizer.h>
33 
34 namespace rtabmap {
35 
37  QDialog(parent)
38 {
39  _ui = new Ui_PostProcessingDialog();
40  _ui->setupUi(this);
41 
43  {
44  _ui->sba->setEnabled(false);
45  _ui->sba->setChecked(false);
46  }
48  {
49  _ui->comboBox_sbaType->setItemData(1, 0, Qt::UserRole - 1);
50  _ui->comboBox_sbaType->setCurrentIndex(0);
51  }
53  {
54  _ui->comboBox_sbaType->setItemData(0, 0, Qt::UserRole - 1);
55  _ui->comboBox_sbaType->setCurrentIndex(1);
56  }
57 
59 
60  connect(_ui->detectMoreLoopClosures, SIGNAL(clicked(bool)), this, SLOT(updateButtonBox()));
61  connect(_ui->refineNeighborLinks, SIGNAL(stateChanged(int)), this, SLOT(updateButtonBox()));
62  connect(_ui->refineLoopClosureLinks, SIGNAL(stateChanged(int)), this, SLOT(updateButtonBox()));
63  connect(_ui->sba, SIGNAL(clicked(bool)), this, SLOT(updateButtonBox()));
64  connect(_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
65 
66  connect(_ui->detectMoreLoopClosures, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
67  connect(_ui->clusterRadius, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
68  connect(_ui->clusterAngle, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
69  connect(_ui->iterations, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
70  connect(_ui->refineNeighborLinks, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
71  connect(_ui->refineLoopClosureLinks, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
72 
73  connect(_ui->sba, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
74  connect(_ui->sba_iterations, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
75  connect(_ui->comboBox_sbaType, SIGNAL(currentIndexChanged(int)), this, SIGNAL(configChanged()));
76  connect(_ui->comboBox_sbaType, SIGNAL(currentIndexChanged(int)), this, SLOT(updateVisibility()));
77 
79 }
80 
82 {
83  delete _ui;
84 }
85 
87 {
88  _ui->sba_variance->setVisible(_ui->comboBox_sbaType->currentIndex() == 0);
89  _ui->label_variance->setVisible(_ui->comboBox_sbaType->currentIndex() == 0);
90 }
91 
92 void PostProcessingDialog::saveSettings(QSettings & settings, const QString & group) const
93 {
94  if(!group.isEmpty())
95  {
96  settings.beginGroup(group);
97  }
98  settings.setValue("detect_more_lc", this->isDetectMoreLoopClosures());
99  settings.setValue("cluster_radius", this->clusterRadius());
100  settings.setValue("cluster_angle", this->clusterAngle());
101  settings.setValue("iterations", this->iterations());
102  settings.setValue("refine_neigbors", this->isRefineNeighborLinks());
103  settings.setValue("refine_lc", this->isRefineLoopClosureLinks());
104  settings.setValue("sba", this->isSBA());
105  settings.setValue("sba_iterations", this->sbaIterations());
106  settings.setValue("sba_type", this->sbaType());
107  settings.setValue("sba_variance", this->sbaVariance());
108  if(!group.isEmpty())
109  {
110  settings.endGroup();
111  }
112 }
113 
114 void PostProcessingDialog::loadSettings(QSettings & settings, const QString & group)
115 {
116  if(!group.isEmpty())
117  {
118  settings.beginGroup(group);
119  }
120  this->setDetectMoreLoopClosures(settings.value("detect_more_lc", this->isDetectMoreLoopClosures()).toBool());
121  this->setClusterRadius(settings.value("cluster_radius", this->clusterRadius()).toDouble());
122  this->setClusterAngle(settings.value("cluster_angle", this->clusterAngle()).toDouble());
123  this->setIterations(settings.value("iterations", this->iterations()).toInt());
124  this->setRefineNeighborLinks(settings.value("refine_neigbors", this->isRefineNeighborLinks()).toBool());
125  this->setRefineLoopClosureLinks(settings.value("refine_lc", this->isRefineLoopClosureLinks()).toBool());
126  this->setSBA(settings.value("sba", this->isSBA()).toBool());
127  this->setSBAIterations(settings.value("sba_iterations", this->sbaIterations()).toInt());
128  this->setSBAType((Optimizer::Type)settings.value("sba_type", this->sbaType()).toInt());
129  this->setSBAVariance(settings.value("sba_variance", this->sbaVariance()).toDouble());
130  if(!group.isEmpty())
131  {
132  settings.endGroup();
133  }
134 }
135 
137 {
139  setClusterRadius(1);
140  setClusterAngle(30);
141  setIterations(5);
142  setRefineNeighborLinks(false);
144  setSBA(false);
145  setSBAIterations(20);
147  setSBAVariance(1.0);
148 }
149 
151 {
152  _ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
154 }
155 
157 {
158  return _ui->detectMoreLoopClosures->isChecked();
159 }
160 
162 {
163  return _ui->clusterRadius->value();
164 }
165 
167 {
168  return _ui->clusterAngle->value();
169 }
170 
172 {
173  return _ui->iterations->value();
174 }
175 
177 {
178  return _ui->refineNeighborLinks->isChecked();
179 }
180 
182 {
183  return _ui->refineLoopClosureLinks->isChecked();
184 }
185 
187 {
188  return _ui->sba->isChecked();
189 }
190 
192 {
193  return _ui->sba_iterations->value();
194 }
196 {
197  return _ui->sba_variance->value();
198 }
200 {
201  return _ui->comboBox_sbaType->currentIndex()==0?Optimizer::kTypeG2O:Optimizer::kTypeCVSBA;
202 }
203 
204 //setters
206 {
207  _ui->detectMoreLoopClosures->setChecked(on);
208 }
210 {
211  _ui->clusterRadius->setValue(radius);
212 }
214 {
215  _ui->clusterAngle->setValue(angle);
216 }
218 {
219  _ui->iterations->setValue(iterations);
220 }
222 {
223  _ui->refineNeighborLinks->setChecked(on);
224 }
226 {
227  _ui->refineLoopClosureLinks->setChecked(on);
228 }
230 {
231  _ui->sba->setChecked(Optimizer::isAvailable(Optimizer::kTypeCVSBA) && on);
232 }
234 {
235  _ui->sba_iterations->setValue(iterations);
236 }
238 {
239  _ui->sba_variance->setValue(variance);
240 }
242 {
243  if(type == Optimizer::kTypeCVSBA)
244  {
245  _ui->comboBox_sbaType->setCurrentIndex(1);
246  }
247  else
248  {
249  _ui->comboBox_sbaType->setCurrentIndex(0);
250  }
251 }
252 
253 
254 }
void loadSettings(QSettings &settings, const QString &group="")
void saveSettings(QSettings &settings, const QString &group="") const
GLM_FUNC_DECL T angle(detail::tquat< T, P > const &x)
Ui_PostProcessingDialog * _ui
static bool isAvailable(Optimizer::Type type)
Definition: Optimizer.cpp:46
Optimizer::Type sbaType() const
void setSBAType(Optimizer::Type type)


rtabmap
Author(s): Mathieu Labbe
autogenerated on Wed Jun 5 2019 22:41:32