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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:08