2011-06-05 14:45:39 +00:00
|
|
|
/*
|
2016-07-17 21:57:10 -04:00
|
|
|
Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
2014-08-11 17:00:55 +00:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
|
* Neither the name of the Universite de Sherbrooke nor the
|
|
|
|
|
names of its contributors may be used to endorse or promote products
|
|
|
|
|
derived from this software without specific prior written permission.
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
|
|
|
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
2011-06-05 14:45:39 +00:00
|
|
|
|
2012-12-11 18:05:05 +00:00
|
|
|
#ifndef DATABASEVIEWER_H_
|
|
|
|
|
#define DATABASEVIEWER_H_
|
|
|
|
|
|
2013-12-12 22:36:56 +00:00
|
|
|
#include "rtabmap/gui/RtabmapGuiExp.h" // DLL export/import defines
|
2011-06-05 14:45:39 +00:00
|
|
|
|
2015-03-16 19:51:22 +00:00
|
|
|
#include <QMainWindow>
|
2011-06-05 14:45:39 +00:00
|
|
|
#include <QtCore/QByteArray>
|
|
|
|
|
#include <QtCore/QMap>
|
|
|
|
|
#include <QtCore/QSet>
|
|
|
|
|
#include <QtGui/QImage>
|
|
|
|
|
#include <opencv2/core/core.hpp>
|
2012-03-03 01:46:30 +00:00
|
|
|
#include <opencv2/features2d/features2d.hpp>
|
2011-06-05 14:45:39 +00:00
|
|
|
#include <set>
|
2014-07-29 21:48:37 +00:00
|
|
|
#include <pcl/point_cloud.h>
|
|
|
|
|
#include <pcl/point_types.h>
|
2011-06-05 14:45:39 +00:00
|
|
|
|
2014-02-11 23:04:22 +00:00
|
|
|
#include <rtabmap/core/Link.h>
|
|
|
|
|
|
2012-12-11 18:05:05 +00:00
|
|
|
class Ui_DatabaseViewer;
|
2012-03-03 01:46:30 +00:00
|
|
|
class QGraphicsScene;
|
2012-06-24 17:19:34 +00:00
|
|
|
class QGraphicsView;
|
|
|
|
|
class QLabel;
|
2011-06-05 14:45:39 +00:00
|
|
|
|
|
|
|
|
namespace rtabmap
|
|
|
|
|
{
|
2015-10-16 14:54:47 -04:00
|
|
|
class DBDriver;
|
2013-12-11 00:12:44 +00:00
|
|
|
class ImageView;
|
2015-05-29 14:46:48 -04:00
|
|
|
class SensorData;
|
2015-03-04 17:27:44 -05:00
|
|
|
class CloudViewer;
|
2011-06-05 14:45:39 +00:00
|
|
|
|
2013-12-12 22:36:56 +00:00
|
|
|
class RTABMAPGUI_EXP DatabaseViewer : public QMainWindow
|
2011-06-05 14:45:39 +00:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2015-12-21 17:27:05 -05:00
|
|
|
DatabaseViewer(const QString & ini = QString(), QWidget * parent = 0);
|
2012-12-11 18:05:05 +00:00
|
|
|
virtual ~DatabaseViewer();
|
|
|
|
|
bool openDatabase(const QString & path);
|
2015-03-04 17:27:44 -05:00
|
|
|
bool isSavedMaximized() const {return savedMaximized_;}
|
2015-04-28 13:04:35 -04:00
|
|
|
void showCloseButton(bool visible = true);
|
2011-06-05 14:45:39 +00:00
|
|
|
|
2014-08-11 15:23:06 +00:00
|
|
|
protected:
|
2014-10-28 19:57:21 +00:00
|
|
|
virtual void showEvent(QShowEvent* anEvent);
|
2015-03-04 17:27:44 -05:00
|
|
|
virtual void moveEvent(QMoveEvent* anEvent);
|
2014-08-11 15:23:06 +00:00
|
|
|
virtual void resizeEvent(QResizeEvent* anEvent);
|
2014-09-21 21:14:17 +00:00
|
|
|
virtual void closeEvent(QCloseEvent* event);
|
2015-03-04 17:27:44 -05:00
|
|
|
virtual bool eventFilter(QObject *obj, QEvent *event);
|
2014-08-11 15:23:06 +00:00
|
|
|
|
2011-06-05 14:45:39 +00:00
|
|
|
private slots:
|
2015-03-04 17:27:44 -05:00
|
|
|
void writeSettings();
|
|
|
|
|
void configModified();
|
2011-06-05 14:45:39 +00:00
|
|
|
void openDatabase();
|
|
|
|
|
void generateGraph();
|
2014-01-22 19:49:28 +00:00
|
|
|
void exportDatabase();
|
2014-02-11 23:04:22 +00:00
|
|
|
void extractImages();
|
2011-06-05 14:45:39 +00:00
|
|
|
void generateLocalGraph();
|
2014-02-27 17:00:46 +00:00
|
|
|
void generateTOROGraph();
|
2015-09-02 17:51:43 -04:00
|
|
|
void generateG2OGraph();
|
2016-08-25 23:47:01 -04:00
|
|
|
void regenerateLocalMaps();
|
2016-08-30 21:15:55 -04:00
|
|
|
void regenerateCurrentLocalMaps();
|
2014-02-11 23:04:22 +00:00
|
|
|
void view3DMap();
|
2015-11-22 18:08:32 -05:00
|
|
|
void view3DLaserScans();
|
2013-12-11 00:12:44 +00:00
|
|
|
void generate3DMap();
|
2015-11-22 18:08:32 -05:00
|
|
|
void generate3DLaserScans();
|
2014-08-11 15:23:06 +00:00
|
|
|
void detectMoreLoopClosures();
|
|
|
|
|
void refineAllNeighborLinks();
|
|
|
|
|
void refineAllLoopClosureLinks();
|
2014-11-03 19:14:02 +00:00
|
|
|
void refineVisuallyAllNeighborLinks();
|
|
|
|
|
void refineVisuallyAllLoopClosureLinks();
|
2015-05-05 17:38:38 -04:00
|
|
|
void resetAllChanges();
|
2011-06-05 14:45:39 +00:00
|
|
|
void sliderAValueChanged(int);
|
|
|
|
|
void sliderBValueChanged(int);
|
|
|
|
|
void sliderAMoved(int);
|
|
|
|
|
void sliderBMoved(int);
|
2016-02-15 19:35:24 -05:00
|
|
|
void update3dView();
|
2014-02-11 23:04:22 +00:00
|
|
|
void sliderNeighborValueChanged(int);
|
|
|
|
|
void sliderLoopValueChanged(int);
|
|
|
|
|
void sliderIterationsValueChanged(int);
|
2015-03-04 17:27:44 -05:00
|
|
|
void updateGrid();
|
2014-02-11 23:04:22 +00:00
|
|
|
void updateGraphView();
|
2014-08-11 15:23:06 +00:00
|
|
|
void refineConstraint();
|
2014-11-03 19:14:02 +00:00
|
|
|
void refineConstraintVisually();
|
2014-08-11 15:23:06 +00:00
|
|
|
void addConstraint();
|
|
|
|
|
void resetConstraint();
|
|
|
|
|
void rejectConstraint();
|
2014-12-14 16:42:10 -05:00
|
|
|
void updateConstraintView();
|
2015-11-22 18:08:32 -05:00
|
|
|
void updateLoggerLevel();
|
2015-06-15 14:44:44 -04:00
|
|
|
void updateStereo();
|
2015-12-17 14:13:19 -05:00
|
|
|
void notifyParametersChanged(const QStringList &);
|
2015-12-21 17:27:05 -05:00
|
|
|
void setupMainLayout(int vertical);
|
2011-06-05 14:45:39 +00:00
|
|
|
|
|
|
|
|
private:
|
2015-03-04 17:27:44 -05:00
|
|
|
QString getIniFilePath() const;
|
|
|
|
|
void readSettings();
|
|
|
|
|
|
2011-06-05 14:45:39 +00:00
|
|
|
void updateIds();
|
2012-06-24 17:19:34 +00:00
|
|
|
void update(int value,
|
|
|
|
|
QLabel * labelIndex,
|
|
|
|
|
QLabel * labelParents,
|
|
|
|
|
QLabel * labelChildren,
|
2015-02-27 15:24:15 -05:00
|
|
|
QLabel * weight,
|
|
|
|
|
QLabel * label,
|
|
|
|
|
QLabel * stamp,
|
2013-12-11 00:12:44 +00:00
|
|
|
rtabmap::ImageView * view,
|
2015-03-04 17:27:44 -05:00
|
|
|
rtabmap::CloudViewer * view3D,
|
2014-10-14 21:44:37 +00:00
|
|
|
QLabel * labelId,
|
2015-05-03 18:16:55 -04:00
|
|
|
QLabel * labelMapId,
|
2015-05-20 18:07:10 -04:00
|
|
|
QLabel * labelPose,
|
2016-04-07 12:15:58 -04:00
|
|
|
QLabel * labeCalib,
|
2015-05-03 18:16:55 -04:00
|
|
|
bool updateConstraintView);
|
2015-05-29 14:46:48 -04:00
|
|
|
void updateStereo(const SensorData * data);
|
2014-08-11 15:23:06 +00:00
|
|
|
void updateWordsMatching();
|
2015-02-25 17:06:52 -05:00
|
|
|
void updateConstraintView(
|
|
|
|
|
const rtabmap::Link & link,
|
|
|
|
|
bool updateImageSliders = true,
|
2014-10-14 21:44:37 +00:00
|
|
|
const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloudFrom = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>),
|
2014-11-17 22:31:04 +00:00
|
|
|
const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloudTo = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>),
|
2015-02-25 17:06:52 -05:00
|
|
|
const pcl::PointCloud<pcl::PointXYZ>::Ptr & scanFrom = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>),
|
|
|
|
|
const pcl::PointCloud<pcl::PointXYZ>::Ptr & scanTo = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>));
|
2014-08-11 15:23:06 +00:00
|
|
|
void updateConstraintButtons();
|
|
|
|
|
Link findActiveLink(int from, int to);
|
|
|
|
|
bool containsLink(
|
|
|
|
|
std::multimap<int, Link> & links,
|
|
|
|
|
int from,
|
|
|
|
|
int to);
|
|
|
|
|
std::multimap<int, rtabmap::Link> updateLinksWithModifications(
|
|
|
|
|
const std::multimap<int, rtabmap::Link> & edgeConstraints);
|
|
|
|
|
void updateLoopClosuresSlider(int from = 0, int to = 0);
|
2015-05-03 18:16:55 -04:00
|
|
|
void refineConstraint(int from, int to, bool silent, bool updateGraph);
|
|
|
|
|
void refineConstraintVisually(int from, int to, bool silent, bool updateGraph);
|
2014-12-14 16:42:10 -05:00
|
|
|
bool addConstraint(int from, int to, bool silent, bool updateGraph);
|
2011-06-05 14:45:39 +00:00
|
|
|
|
|
|
|
|
private:
|
2012-12-11 18:05:05 +00:00
|
|
|
Ui_DatabaseViewer * ui_;
|
2016-05-05 18:25:26 -04:00
|
|
|
CloudViewer * constraintsViewer_;
|
|
|
|
|
CloudViewer * cloudViewerA_;
|
|
|
|
|
CloudViewer * cloudViewerB_;
|
|
|
|
|
CloudViewer * stereoViewer_;
|
2011-06-05 14:45:39 +00:00
|
|
|
QList<int> ids_;
|
2015-05-22 15:06:05 -04:00
|
|
|
std::map<int, int> mapIds_;
|
2014-02-11 23:04:22 +00:00
|
|
|
QMap<int, int> idToIndex_;
|
|
|
|
|
QList<rtabmap::Link> neighborLinks_;
|
|
|
|
|
QList<rtabmap::Link> loopLinks_;
|
2015-10-16 14:54:47 -04:00
|
|
|
rtabmap::DBDriver * dbDriver_;
|
2011-06-05 14:45:39 +00:00
|
|
|
QString pathDatabase_;
|
2015-06-24 20:20:27 -04:00
|
|
|
std::string databaseFileName_;
|
2014-02-11 23:04:22 +00:00
|
|
|
std::list<std::map<int, rtabmap::Transform> > graphes_;
|
2015-05-23 13:36:36 -04:00
|
|
|
std::multimap<int, rtabmap::Link> graphLinks_;
|
2014-02-11 23:04:22 +00:00
|
|
|
std::map<int, rtabmap::Transform> poses_;
|
2016-01-07 19:39:21 -05:00
|
|
|
std::map<int, rtabmap::Transform> groundTruthPoses_;
|
2014-02-11 23:04:22 +00:00
|
|
|
std::multimap<int, rtabmap::Link> links_;
|
2014-08-11 15:23:06 +00:00
|
|
|
std::multimap<int, rtabmap::Link> linksRefined_;
|
|
|
|
|
std::multimap<int, rtabmap::Link> linksAdded_;
|
|
|
|
|
std::multimap<int, rtabmap::Link> linksRemoved_;
|
2015-03-04 17:27:44 -05:00
|
|
|
std::map<int, std::pair<cv::Mat, cv::Mat> > localMaps_; // <ground, obstacles>
|
2016-08-25 23:47:01 -04:00
|
|
|
std::map<int, std::pair<cv::Mat, cv::Mat> > generatedLocalMaps_; // <ground, obstacles>
|
|
|
|
|
std::map<int, std::pair<float, cv::Point3f> > generatedLocalMapsInfo_; // <cell size, viewpoint>
|
2015-03-04 17:27:44 -05:00
|
|
|
|
|
|
|
|
bool savedMaximized_;
|
|
|
|
|
bool firstCall_;
|
2015-12-21 17:27:05 -05:00
|
|
|
QString iniFilePath_;
|
2011-06-05 14:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
2014-08-11 15:23:06 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-11 18:05:05 +00:00
|
|
|
#endif /* DATABASEVIEWER_H_ */
|