Files
rtabmap_ros/guilib/include/rtabmap/gui/DatabaseViewer.h
T

205 lines
6.8 KiB
C++
Raw Normal View History

/*
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.
*/
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
2015-03-16 19:51:22 +00:00
#include <QMainWindow>
#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>
#include <set>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <rtabmap/core/Link.h>
#include <rtabmap/core/Signature.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;
class QDialog;
namespace rtabmap
{
class DBDriver;
2013-12-11 00:12:44 +00:00
class ImageView;
2015-05-29 14:46:48 -04:00
class SensorData;
class CloudViewer;
class OctoMap;
class ExportCloudsDialog;
class EditDepthArea;
2013-12-12 22:36:56 +00:00
class RTABMAPGUI_EXP DatabaseViewer : public QMainWindow
{
Q_OBJECT
public:
DatabaseViewer(const QString & ini = QString(), QWidget * parent = 0);
2012-12-11 18:05:05 +00:00
virtual ~DatabaseViewer();
bool openDatabase(const QString & path);
bool isSavedMaximized() const {return savedMaximized_;}
void showCloseButton(bool visible = true);
protected:
virtual void showEvent(QShowEvent* anEvent);
virtual void moveEvent(QMoveEvent* anEvent);
virtual void resizeEvent(QResizeEvent* anEvent);
virtual void keyPressEvent(QKeyEvent *event);
virtual void closeEvent(QCloseEvent* event);
virtual bool eventFilter(QObject *obj, QEvent *event);
private slots:
void writeSettings();
void restoreDefaultSettings();
void configModified();
void openDatabase();
void updateStatistics();
void editDepthImage();
void generateGraph();
2014-01-22 19:49:28 +00:00
void exportDatabase();
void extractImages();
void exportPosesRaw();
void exportPosesRGBDSLAM();
void exportPosesKITTI();
void exportPosesTORO();
void exportPosesG2O();
void generateLocalGraph();
void regenerateLocalMaps();
void regenerateCurrentLocalMaps();
void view3DMap();
2013-12-11 00:12:44 +00:00
void generate3DMap();
void detectMoreLoopClosures();
void refineAllNeighborLinks();
void refineAllLoopClosureLinks();
void resetAllChanges();
void sliderAValueChanged(int);
void sliderBValueChanged(int);
void sliderAMoved(int);
void sliderBMoved(int);
2016-02-15 19:35:24 -05:00
void update3dView();
void sliderNeighborValueChanged(int);
void sliderLoopValueChanged(int);
void sliderIterationsValueChanged(int);
void updateGrid();
void updateOctomapView();
void updateGraphView();
void refineConstraint();
void addConstraint();
void resetConstraint();
void rejectConstraint();
2014-12-14 16:42:10 -05:00
void updateConstraintView();
void updateLoggerLevel();
void updateStereo();
void notifyParametersChanged(const QStringList &);
void setupMainLayout(bool vertical);
private:
QString getIniFilePath() const;
void readSettings();
void updateIds();
2012-06-24 17:19:34 +00:00
void update(int value,
QLabel * labelIndex,
QLabel * labelParents,
QLabel * labelChildren,
QLabel * weight,
QLabel * label,
QLabel * stamp,
2013-12-11 00:12:44 +00:00
rtabmap::ImageView * view,
2014-10-14 21:44:37 +00:00
QLabel * labelId,
QLabel * labelMapId,
2015-05-20 18:07:10 -04:00
QLabel * labelPose,
2016-04-07 12:15:58 -04:00
QLabel * labeCalib,
bool updateConstraintView);
2015-05-29 14:46:48 -04:00
void updateStereo(const SensorData * data);
void updateWordsMatching();
void updateConstraintView(
const rtabmap::Link & link,
bool updateImageSliders = true,
const Signature & signatureFrom = Signature(0),
const Signature & signatureTo = Signature(0));
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);
void refineConstraint(int from, int to, bool silent);
bool addConstraint(int from, int to, bool silent);
void exportPoses(int format);
private:
2012-12-11 18:05:05 +00:00
Ui_DatabaseViewer * ui_;
CloudViewer * constraintsViewer_;
CloudViewer * cloudViewer_;
CloudViewer * stereoViewer_;
CloudViewer * occupancyGridViewer_;
QList<int> ids_;
std::map<int, int> mapIds_;
QMap<int, int> idToIndex_;
QList<rtabmap::Link> neighborLinks_;
QList<rtabmap::Link> loopLinks_;
rtabmap::DBDriver * dbDriver_;
QString pathDatabase_;
2015-06-24 20:20:27 -04:00
std::string databaseFileName_;
std::list<std::map<int, rtabmap::Transform> > graphes_;
std::multimap<int, rtabmap::Link> graphLinks_;
std::map<int, rtabmap::Transform> poses_;
std::map<int, rtabmap::Transform> groundTruthPoses_;
std::multimap<int, rtabmap::Link> links_;
std::multimap<int, rtabmap::Link> linksRefined_;
std::multimap<int, rtabmap::Link> linksAdded_;
std::multimap<int, rtabmap::Link> linksRemoved_;
std::map<int, std::pair<cv::Mat, cv::Mat> > localMaps_; // <ground, obstacles>
std::map<int, std::pair<float, cv::Point3f> > localMapsInfo_; // <cell size, viewpoint>
std::map<int, std::pair<cv::Mat, cv::Mat> > generatedLocalMaps_; // <ground, obstacles>
std::map<int, std::pair<float, cv::Point3f> > generatedLocalMapsInfo_; // <cell size, viewpoint>
std::map<int, cv::Mat> modifiedDepthImages_;
OctoMap * octomap_;
ExportCloudsDialog * exportDialog_;
QDialog * editDepthDialog_;
EditDepthArea * editDepthArea_;
bool savedMaximized_;
bool firstCall_;
QString iniFilePath_;
};
}
2012-12-11 18:05:05 +00:00
#endif /* DATABASEVIEWER_H_ */