DatabaseViewer.h
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 
28 #ifndef RTABMAP_DATABASEVIEWER_H_
29 #define RTABMAP_DATABASEVIEWER_H_
30 
31 #include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
32 
33 #include <QMainWindow>
34 #include <QtCore/QByteArray>
35 #include <QtCore/QMap>
36 #include <QtCore/QSet>
37 #include <QtGui/QImage>
38 #include <opencv2/core/core.hpp>
39 #include <opencv2/features2d/features2d.hpp>
40 #include <set>
41 #include <vector>
42 #include <pcl/point_cloud.h>
43 #include <pcl/point_types.h>
44 
45 #include <rtabmap/core/Link.h>
46 #include <rtabmap/core/Signature.h>
47 #include <rtabmap/core/GlobalMap.h>
48 
49 class Ui_DatabaseViewer;
50 class QGraphicsScene;
51 class QGraphicsView;
52 class QLabel;
53 class QToolButton;
54 class QDialog;
55 class QSpinBox;
56 
57 namespace rtabmap
58 {
59 class DBDriver;
60 class ImageView;
61 class SensorData;
62 class CloudViewer;
63 class OctoMap;
64 class ExportCloudsDialog;
65 class EditDepthArea;
66 class EditMapArea;
67 class LinkRefiningDialog;
68 
69 class RTABMAP_GUI_EXPORT DatabaseViewer : public QMainWindow
70 {
71  Q_OBJECT
72 
73 public:
74  DatabaseViewer(const QString & ini = QString(), QWidget * parent = 0);
75  virtual ~DatabaseViewer();
76  bool openDatabase(const QString & path, const ParametersMap & overridenParameters = ParametersMap());
77  bool isSavedMaximized() const {return savedMaximized_;}
78  void showCloseButton(bool visible = true);
79 
80 protected:
81  virtual void showEvent(QShowEvent* anEvent);
82  virtual void moveEvent(QMoveEvent* anEvent);
83  virtual void resizeEvent(QResizeEvent* anEvent);
84  virtual void keyPressEvent(QKeyEvent *event);
85  virtual void closeEvent(QCloseEvent* event);
86  virtual bool eventFilter(QObject *obj, QEvent *event);
87 
88 private Q_SLOTS:
89  void writeSettings();
90  void restoreDefaultSettings();
91  void configModified();
92  void openDatabase();
93  bool closeDatabase();
94  void recoverDatabase();
95  void updateInfo();
96  void updateStatistics();
97  void selectObstacleColor();
98  void selectGroundColor();
99  void selectEmptyColor();
100  void selectFrontierColor();
101  void editDepthImage();
102  void generateGraph();
103  void editSaved2DMap();
104  void exportSaved2DMap();
105  void import2DMap();
106  void regenerateSavedMap();
107  void viewOptimizedMesh();
108  void exportOptimizedMesh();
109  void updateOptimizedMesh();
110  void exportDatabase();
111  void extractImages();
112  void exportPosesRaw();
113  void exportPosesRGBDSLAMMotionCapture();
114  void exportPosesRGBDSLAM();
115  void exportPosesRGBDSLAMID();
116  void exportPosesKITTI();
117  void exportPosesTORO();
118  void exportPosesG2O();
119  void exportPosesKML();
120  void exportGPS_TXT();
121  void exportGPS_KML();
122  void generateLocalGraph();
123  void regenerateLocalMaps();
124  void regenerateCurrentLocalMaps();
125  void view3DMap();
126  void generate3DMap();
127  void detectMoreLoopClosures();
128  void updateAllNeighborCovariances();
129  void updateAllLoopClosureCovariances();
130  void updateAllLandmarkCovariances();
131  void refineLinks();
132  void resetAllChanges();
133  void graphNodeSelected(int);
134  void graphLinkSelected(int, int);
135  void sliderAValueChanged(int);
136  void sliderBValueChanged(int);
137  void sliderAMoved(int);
138  void sliderBMoved(int);
139  void update3dView();
140  void sliderNeighborValueChanged(int);
141  void sliderLoopValueChanged(int);
142  void sliderIterationsValueChanged(int);
143  void editConstraint();
144  void updateGrid();
145  void updateOctomapView();
146  void updateGraphRotation();
147  void updateGraphView();
148  void refineConstraint();
149  void addConstraint();
150  void resetConstraint();
151  void rejectConstraint();
152  void updateConstraintView();
153  void updateLoggerLevel();
154  void updateStereo();
155  void notifyParametersChanged(const QStringList &);
156  void setupMainLayout(bool vertical);
157  void updateConstraintButtons();
158 
159 private:
160  QString getIniFilePath() const;
161  void readSettings();
162 
163  void updateIds();
164  void update(int value,
165  QSpinBox * spinBoxIndex,
166  QLabel * labelParents,
167  QLabel * labelChildren,
168  QLabel * weight,
169  QLabel * label,
170  QLabel * stamp,
171  rtabmap::ImageView * view,
172  QLabel * labelId,
173  QLabel * labelMapId,
174  QLabel * labelPose,
175  QLabel * labelOptPose,
176  QLabel * labelVelocity,
177  QLabel * labelCalib,
178  QLabel * labelScan,
179  QLabel * labelGravity,
180  QLabel * labelPrior,
181  QToolButton * editPriorButton,
182  QToolButton * removePriorButton,
183  QLabel * labelGps,
184  QLabel * labelGt,
185  QLabel * labelSensors,
186  bool updateConstraintView);
187  void updateStereo(const SensorData * data);
188  void updateWordsMatching(const std::vector<int> & inliers = std::vector<int>());
189  void updateConstraintView(
190  const rtabmap::Link & link,
191  bool updateImageSliders = true,
192  const Signature & signatureFrom = Signature(0),
193  const Signature & signatureTo = Signature(0));
194  Link findActiveLink(int from, int to);
195  bool containsLink(
196  std::multimap<int, Link> & links,
197  int from,
198  int to);
199  std::multimap<int, rtabmap::Link> updateLinksWithModifications(
200  const std::multimap<int, rtabmap::Link> & edgeConstraints);
201  void updateNeighborsSlider(int from = 0, int to = 0);
202  void updateLoopClosuresSlider(int from = 0, int to = 0);
203  void updateCovariances(const QList<Link> & links);
204  void refineLinks(const QList<Link> & links);
205  void refineConstraint(int from, int to, bool silent);
206  bool addConstraint(int from, int to, bool silent, bool silentlyUseOptimizedGraphAsGuess = false);
207  void exportPoses(int format);
208  void exportGPS(int format);
209 
210 private:
211  Ui_DatabaseViewer * ui_;
216  QList<int> ids_;
217  std::set<int> lastWmIds_;
218  std::map<int, int> mapIds_;
219  std::map<int, int> weights_;
220  std::map<int, std::vector<int> > wmStates_;
221  QMap<int, int> idToIndex_;
222  QList<rtabmap::Link> neighborLinks_;
223  QList<rtabmap::Link> loopLinks_;
226  QString pathDatabase_;
227  std::string databaseFileName_;
228  std::list<std::map<int, rtabmap::Transform> > graphes_;
229  std::multimap<int, rtabmap::Link> graphLinks_;
230  std::map<int, rtabmap::Transform> odomPoses_;
231  std::map<int, rtabmap::Transform> groundTruthPoses_;
232  std::map<int, rtabmap::Transform> gpsPoses_;
233  std::map<int, GPS> gpsValues_;
234  std::multimap<int, rtabmap::Link> links_;
235  std::multimap<int, rtabmap::Link> linksRefined_;
236  std::multimap<int, rtabmap::Link> linksAdded_;
237  std::multimap<int, rtabmap::Link> linksRemoved_;
238  std::map<int, LaserScan> modifiedLaserScans_;
239  std::vector<double> odomMaxInf_;
244  QDialog * editDepthDialog_;
246  QDialog * editMapDialog_;
249 
252  QString iniFilePath_;
253 
258 };
259 
260 }
261 
262 #endif /* DATABASEVIEWER_H_ */
rtabmap::SensorData
Definition: SensorData.h:51
rtabmap::DatabaseViewer
Definition: DatabaseViewer.h:69
update
def update(text)
rtabmap::DatabaseViewer::gpsPoses_
std::map< int, rtabmap::Transform > gpsPoses_
Definition: DatabaseViewer.h:232
rtabmap::DatabaseViewer::infoReducedGraph_
bool infoReducedGraph_
Definition: DatabaseViewer.h:254
rtabmap::DatabaseViewer::weights_
std::map< int, int > weights_
Definition: DatabaseViewer.h:219
rtabmap::DatabaseViewer::graphes_
std::list< std::map< int, rtabmap::Transform > > graphes_
Definition: DatabaseViewer.h:228
rtabmap::DatabaseViewer::editMapArea_
EditMapArea * editMapArea_
Definition: DatabaseViewer.h:247
rtabmap::DatabaseViewer::ui_
Ui_DatabaseViewer * ui_
Definition: DatabaseViewer.h:211
rtabmap::ExportCloudsDialog
Definition: ExportCloudsDialog.h:54
rtabmap::EditMapArea
Definition: EditMapArea.h:45
rtabmap::LinkRefiningDialog
Definition: LinkRefiningDialog.h:41
rtabmap::DatabaseViewer::links_
std::multimap< int, rtabmap::Link > links_
Definition: DatabaseViewer.h:234
rtabmap::DatabaseViewer::wmStates_
std::map< int, std::vector< int > > wmStates_
Definition: DatabaseViewer.h:220
rtabmap::DatabaseViewer::editDepthDialog_
QDialog * editDepthDialog_
Definition: DatabaseViewer.h:244
rtabmap::DatabaseViewer::constraintsViewer_
CloudViewer * constraintsViewer_
Definition: DatabaseViewer.h:212
rtabmap::DatabaseViewer::editDepthArea_
EditDepthArea * editDepthArea_
Definition: DatabaseViewer.h:245
rtabmap::DatabaseViewer::firstCall_
bool firstCall_
Definition: DatabaseViewer.h:251
rtabmap::DatabaseViewer::linksRemoved_
std::multimap< int, rtabmap::Link > linksRemoved_
Definition: DatabaseViewer.h:237
rtabmap::LocalGridCache
Definition: LocalGrid.h:56
rtabmap::ParametersMap
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:43
rtabmap::DatabaseViewer::idToIndex_
QMap< int, int > idToIndex_
Definition: DatabaseViewer.h:221
rtabmap::DatabaseViewer::localMaps_
LocalGridCache localMaps_
Definition: DatabaseViewer.h:240
rtabmap::DatabaseViewer::lastWmIds_
std::set< int > lastWmIds_
Definition: DatabaseViewer.h:217
rtabmap::DatabaseViewer::cloudViewer_
CloudViewer * cloudViewer_
Definition: DatabaseViewer.h:213
rtabmap::DatabaseViewer::groundTruthPoses_
std::map< int, rtabmap::Transform > groundTruthPoses_
Definition: DatabaseViewer.h:231
rtabmap::DatabaseViewer::mapIds_
std::map< int, int > mapIds_
Definition: DatabaseViewer.h:218
GlobalMap.h
rtabmap::CloudViewer
Definition: CloudViewer.h:79
rtabmap::DatabaseViewer::octomap_
OctoMap * octomap_
Definition: DatabaseViewer.h:242
rtabmap::DatabaseViewer::graphLinks_
std::multimap< int, rtabmap::Link > graphLinks_
Definition: DatabaseViewer.h:229
rtabmap::DatabaseViewer::linksAdded_
std::multimap< int, rtabmap::Link > linksAdded_
Definition: DatabaseViewer.h:236
rtabmap::DatabaseViewer::ids_
QList< int > ids_
Definition: DatabaseViewer.h:216
rtabmap::DatabaseViewer::editMapDialog_
QDialog * editMapDialog_
Definition: DatabaseViewer.h:246
rtabmap::DatabaseViewer::linksRefined_
std::multimap< int, rtabmap::Link > linksRefined_
Definition: DatabaseViewer.h:235
rtabmap::DatabaseViewer::savedMaximized_
bool savedMaximized_
Definition: DatabaseViewer.h:250
Signature.h
rtabmap::DatabaseViewer::infoTotalOdom_
double infoTotalOdom_
Definition: DatabaseViewer.h:255
rtabmap::DatabaseViewer::odomPoses_
std::map< int, rtabmap::Transform > odomPoses_
Definition: DatabaseViewer.h:230
rtabmap::DatabaseViewer::linkRefiningDialog_
LinkRefiningDialog * linkRefiningDialog_
Definition: DatabaseViewer.h:248
exportPoses
bool exportPoses
Definition: tools/Reprocess/main.cpp:131
rtabmap::graph::exportGPS
bool RTABMAP_CORE_EXPORT exportGPS(const std::string &filePath, const std::map< int, GPS > &gpsValues, unsigned int rgba=0xFFFFFFFF)
Definition: Graph.cpp:510
rtabmap::DatabaseViewer::generatedLocalMaps_
LocalGridCache generatedLocalMaps_
Definition: DatabaseViewer.h:241
rtabmap::DatabaseViewer::stereoViewer_
CloudViewer * stereoViewer_
Definition: DatabaseViewer.h:214
rtabmap::DatabaseViewer::occupancyGridViewer_
CloudViewer * occupancyGridViewer_
Definition: DatabaseViewer.h:215
rtabmap::DatabaseViewer::modifiedLaserScans_
std::map< int, LaserScan > modifiedLaserScans_
Definition: DatabaseViewer.h:238
path
path
rtabmap::DatabaseViewer::exportDialog_
ExportCloudsDialog * exportDialog_
Definition: DatabaseViewer.h:243
rtabmap::DBDriver
Definition: DBDriver.h:62
rtabmap::DatabaseViewer::infoTotalTime_
double infoTotalTime_
Definition: DatabaseViewer.h:256
rtabmap::DatabaseViewer::lastSliderIndexBrowsed_
int lastSliderIndexBrowsed_
Definition: DatabaseViewer.h:224
rtabmap::DatabaseViewer::isSavedMaximized
bool isSavedMaximized() const
Definition: DatabaseViewer.h:77
rtabmap::DatabaseViewer::iniFilePath_
QString iniFilePath_
Definition: DatabaseViewer.h:252
rtabmap::DatabaseViewer::gpsValues_
std::map< int, GPS > gpsValues_
Definition: DatabaseViewer.h:233
rtabmap::DatabaseViewer::databaseFileName_
std::string databaseFileName_
Definition: DatabaseViewer.h:227
rtabmap::DatabaseViewer::infoSessions_
int infoSessions_
Definition: DatabaseViewer.h:257
rtabmap::ImageView
Definition: ImageView.h:49
rtabmap::DatabaseViewer::loopLinks_
QList< rtabmap::Link > loopLinks_
Definition: DatabaseViewer.h:223
rtabmap::DatabaseViewer::dbDriver_
rtabmap::DBDriver * dbDriver_
Definition: DatabaseViewer.h:225
rtabmap::DatabaseViewer::neighborLinks_
QList< rtabmap::Link > neighborLinks_
Definition: DatabaseViewer.h:222
rtabmap::OctoMap
Definition: global_map/OctoMap.h:175
rtabmap::DatabaseViewer::odomMaxInf_
std::vector< double > odomMaxInf_
Definition: DatabaseViewer.h:239
rtabmap
Definition: CameraARCore.cpp:35
openDatabase
static int openDatabase(const char *zFilename, sqlite3 **ppDb, unsigned int flags, const char *zVfs)
Definition: sqlite3.c:121402
rtabmap::DatabaseViewer::pathDatabase_
QString pathDatabase_
Definition: DatabaseViewer.h:226
rtabmap::Signature
Definition: Signature.h:48
rtabmap::EditDepthArea
Definition: EditDepthArea.h:45


rtabmap
Author(s): Mathieu Labbe
autogenerated on Sun Dec 1 2024 03:42:43