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

354 lines
12 KiB
C++
Raw Normal View History

/*
2014-08-11 17:00:55 +00:00
Copyright (c) 2010-2014, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
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.
*/
#ifndef PREFERENCESDIALOG_H_
#define PREFERENCESDIALOG_H_
2013-12-11 00:12:44 +00:00
#include "rtabmap/gui/RtabmapGuiExp.h" // DLL export/import defines
2015-03-16 19:51:22 +00:00
#include <QDialog>
#include <QtCore/QModelIndex>
2013-12-11 00:12:44 +00:00
#include <QtCore/QVector>
2012-12-11 18:05:05 +00:00
#include <set>
2013-12-11 00:12:44 +00:00
#include "rtabmap/core/Transform.h"
#include "rtabmap/core/Parameters.h"
class Ui_preferencesDialog;
class QAbstractItemModel;
class QAbstractButton;
class QStandardItemModel;
class QStandardItem;
class QFile;
class QGroupBox;
class QMainWindow;
class QLineEdit;
class QSlider;
class QProgressDialog;
2012-06-24 17:19:34 +00:00
class UPlotCurve;
2013-12-11 00:12:44 +00:00
class QStackedWidget;
class QCheckBox;
class QSpinBox;
class QDoubleSpinBox;
namespace rtabmap {
2013-12-11 00:12:44 +00:00
class Signature;
class LoopClosureViewer;
class Camera;
class CalibrationDialog;
class CreateSimpleCalibrationDialog;
2013-12-11 00:12:44 +00:00
class RTABMAPGUI_EXP PreferencesDialog : public QDialog
{
Q_OBJECT
public:
enum PanelFlag {
kPanelDummy = 0,
2013-12-11 00:12:44 +00:00
kPanelGeneral = 1,
kPanelCloudRendering = 2,
kPanelLogging = 4,
kPanelSource = 8,
kPanelAll = 15
};
// TODO, tried to change the name of PANEL_FLAGS to PanelFlags... but signals/slots errors appeared...
Q_DECLARE_FLAGS(PANEL_FLAGS, PanelFlag);
enum Src {
kSrcUndef = -1,
kSrcRGBD = 0,
kSrcOpenNI_PCL = 0,
kSrcFreenect = 1,
kSrcOpenNI_CV = 2,
kSrcOpenNI_CV_ASUS = 3,
kSrcOpenNI2 = 4,
kSrcFreenect2 = 5,
kSrcRGBDImages = 6,
kSrcStereo = 100,
kSrcDC1394 = 100,
kSrcFlyCapture2 = 101,
kSrcStereoImages = 102,
kSrcStereoVideo = 103,
kSrcRGB = 200,
kSrcUsbDevice = 200,
kSrcImages = 201,
kSrcVideo = 202,
kSrcDatabase = 300
2012-06-24 17:19:34 +00:00
};
public:
PreferencesDialog(QWidget * parent = 0);
virtual ~PreferencesDialog();
2013-12-11 00:12:44 +00:00
virtual QString getIniFilePath() const;
virtual QString getTmpIniFilePath() const;
2011-06-09 12:51:13 +00:00
void init();
void setCurrentPanelToSource();
2011-06-09 12:51:13 +00:00
// save stuff
void saveSettings();
void saveWindowGeometry(const QWidget * window);
void loadWindowGeometry(QWidget * window);
void saveMainWindowState(const QMainWindow * mainWindow);
void loadMainWindowState(QMainWindow * mainWindow, bool & maximized, bool & statusBarShown);
void saveWidgetState(const QWidget * widget);
void loadWidgetState(QWidget * widget);
void saveCustomConfig(const QString & section, const QString & key, const QString & value);
QString loadCustomConfig(const QString & section, const QString & key);
rtabmap::ParametersMap getAllParameters() const;
//General panel
int getGeneralLoggerLevel() const;
int getGeneralLoggerEventLevel() const;
int getGeneralLoggerPauseLevel() const;
int getGeneralLoggerType() const;
bool getGeneralLoggerPrintTime() const;
2016-01-05 13:55:21 -05:00
bool getGeneralLoggerPrintThreadId() const;
bool isVerticalLayoutUsed() const;
bool imageRejectedShown() const;
bool imageHighestHypShown() const;
bool beepOnPause() const;
bool notifyWhenNewGlobalPathIsReceived() const;
int getOdomQualityWarnThr() const;
bool isPosteriorGraphView() const;
2013-12-11 00:12:44 +00:00
bool isGraphsShown() const;
bool isLabelsShown() const;
2014-07-29 00:52:35 +00:00
bool isCloudMeshing() const;
bool isCloudsShown(int index) const; // 0=map, 1=odom
double getCloudVoxelSize(int index) const; // 0=map, 1=odom
int getCloudDecimation(int index) const; // 0=map, 1=odom
double getCloudMaxDepth(int index) const; // 0=map, 1=odom
double getCloudOpacity(int index) const; // 0=map, 1=odom
int getCloudPointSize(int index) const; // 0=map, 1=odom
2013-12-11 00:12:44 +00:00
2014-07-29 00:52:35 +00:00
bool isScansShown(int index) const; // 0=map, 1=odom
int getDownsamplingStepScan(int index) const; // 0=map, 1=odom
double getCloudVoxelSizeScan(int index) const; // 0=map, 1=odom
double getScanOpacity(int index) const; // 0=map, 1=odom
int getScanPointSize(int index) const; // 0=map, 1=odom
2014-07-29 00:52:35 +00:00
int getMeshNormalKSearch() const;
double getMeshGP3Radius() const;
double getMeshGP3Mu() const;
2014-07-29 00:52:35 +00:00
bool getMeshSmoothing() const;
double getMeshSmoothingRadius() const;
2013-12-11 00:12:44 +00:00
2014-02-13 21:32:46 +00:00
bool isCloudFiltering() const;
bool isSubtractFiltering() const;
2014-02-13 21:32:46 +00:00
double getCloudFilteringRadius() const;
double getCloudFilteringAngle() const;
int getSubstractFilteringMinPts() const;
2014-02-13 21:32:46 +00:00
bool getGridMapShown() const;
double getGridMapResolution() const;
bool isGridMapFrom3DCloud() const;
2015-03-20 14:03:09 -04:00
bool isGridMapEroded() const;
double getGridMapOpacity() const;
2013-12-11 00:12:44 +00:00
QString getWorkingDirectory() const;
// source panel
2012-06-24 17:19:34 +00:00
double getGeneralInputRate() const;
bool isSourceMirroring() const;
PreferencesDialog::Src getSourceType() const;
PreferencesDialog::Src getSourceDriver() const;
QString getSourceDriverStr() const;
QString getSourceDevice() const;
2012-06-24 17:19:34 +00:00
QString getSourceDatabasePath() const; //Database group
2013-12-11 00:12:44 +00:00
bool getSourceDatabaseOdometryIgnored() const; //Database group
bool getSourceDatabaseGoalDelayIgnored() const; //Database group
bool getSourceDatabaseGoalsIgnored() const; //Database group
2012-12-11 18:05:05 +00:00
int getSourceDatabaseStartPos() const; //Database group
bool getSourceDatabaseStampsUsed() const;//Database group
bool isSourceRGBDColorOnly() const;
int getSourceImageDecimation() const;
bool isSourceStereoDepthGenerated() const;
bool isSourceScanFromDepth() const;
int getSourceScanFromDepthDecimation() const;
double getSourceScanFromDepthMaxDepth() const;
double getSourceScanVoxelSize() const;
int getSourceScanNormalsK() const;
Transform getSourceLocalTransform() const; //Openni group
Transform getLaserLocalTransform() const; // directory images
Camera * createCamera(bool useRawImages = false); // return camera should be deleted if not null
2012-12-11 18:05:05 +00:00
int getIgnoredDCComponents() const;
//
bool isImagesKept() const;
2012-03-03 01:46:30 +00:00
float getTimeLimit() const;
2013-12-11 00:12:44 +00:00
float getDetectionRate() const;
bool isSLAMMode() const;
//specific
2012-06-24 17:19:34 +00:00
bool isStatisticsPublished() const;
double getLoopThr() const;
double getVpThr() const;
double getSimThr() const;
2014-10-13 19:10:22 +00:00
int getOdomStrategy() const;
int getOdomBufferSize() const;
bool getRegVarianceFromInliersCount() const;
QString getCameraInfoDir() const; // "workinfDir/camera_info"
2012-06-24 17:19:34 +00:00
//
2013-12-11 00:12:44 +00:00
void setMonitoringState(bool monitoringState) {_monitoringState = monitoringState;}
2012-06-24 17:19:34 +00:00
signals:
void settingsChanged(PreferencesDialog::PANEL_FLAGS);
void settingsChanged(rtabmap::ParametersMap);
public slots:
2012-06-24 17:19:34 +00:00
void setInputRate(double value);
2013-12-11 00:12:44 +00:00
void setDetectionRate(double value);
2012-03-03 01:46:30 +00:00
void setTimeLimit(float value);
2013-12-11 00:12:44 +00:00
void setSLAMMode(bool enabled);
void selectSourceDriver(Src src);
void calibrate();
void calibrateSimple();
private slots:
void closeDialog ( QAbstractButton * button );
void resetApply ( QAbstractButton * button );
void resetSettings(int panelNumber);
void loadConfigFrom();
2014-01-22 19:49:28 +00:00
bool saveConfigTo();
void resetConfig();
void makeObsoleteGeneralPanel();
2013-12-11 00:12:44 +00:00
void makeObsoleteCloudRenderingPanel();
void makeObsoleteLoggingPanel();
void makeObsoleteSourcePanel();
void clicked(const QModelIndex & current, const QModelIndex & previous);
void addParameter(int value);
2013-12-11 00:12:44 +00:00
void addParameter(bool value);
void addParameter(double value);
void addParameter(const QString & value);
2012-03-03 01:46:30 +00:00
void updatePredictionPlot();
void updateKpROI();
void changeWorkingDirectory();
void changeDictionaryPath();
2015-06-25 16:04:42 -04:00
void changeOdomBowFixedLocalMapPath();
void readSettingsEnd();
2012-03-03 01:46:30 +00:00
void setupTreeView();
2012-06-24 17:19:34 +00:00
void updateBasicParameter();
2012-12-11 18:05:05 +00:00
void openDatabaseViewer();
void selectSourceDatabase();
void selectCalibrationPath();
void selectSourceImagesStamps();
void selectSourceRGBDImagesPathRGB();
void selectSourceRGBDImagesPathDepth();
void selectSourceImagesPathScans();
void selectSourceImagesPathGt();
void selectSourceStereoImagesPathLeft();
void selectSourceStereoImagesPathRight();
void selectSourceImagesPath();
void selectSourceVideoPath();
void selectSourceStereoVideoPath();
void selectSourceOniPath();
void selectSourceOni2Path();
void updateSourceGrpVisibility();
void testOdometry();
void testCamera();
protected:
virtual void showEvent ( QShowEvent * event );
2013-12-11 00:12:44 +00:00
virtual void closeEvent(QCloseEvent *event);
void setParameter(const std::string & key, const std::string & value);
virtual QString getParamMessage();
virtual void readGuiSettings(const QString & filePath = QString());
virtual void readCameraSettings(const QString & filePath = QString());
virtual bool readCoreSettings(const QString & filePath = QString());
virtual void writeGuiSettings(const QString & filePath = QString()) const;
virtual void writeCameraSettings(const QString & filePath = QString()) const;
virtual void writeCoreSettings(const QString & filePath = QString()) const;
private:
void readSettings(const QString & filePath = QString());
void writeSettings(const QString & filePath = QString());
bool validateForm();
void setupSignals();
void setupKpRoiPanel();
bool parseModel(QList<QGroupBox*> & boxes, QStandardItem * parentItem, int currentLevel, int & absoluteIndex);
2013-12-11 00:12:44 +00:00
void resetSettings(QGroupBox * groupBox);
void addParameter(const QObject * object, int value);
2013-12-11 00:12:44 +00:00
void addParameter(const QObject * object, bool value);
void addParameter(const QObject * object, double value);
void addParameter(const QObject * object, const QString & value);
2013-12-11 00:12:44 +00:00
void addParameters(const QObjectList & children);
void addParameters(const QStackedWidget * stackedWidget, int panel = -1);
void addParameters(const QGroupBox * box);
QList<QGroupBox*> getGroupBoxes();
void readSettingsBegin();
protected:
PANEL_FLAGS _obsoletePanels;
private:
rtabmap::ParametersMap _modifiedParameters;
rtabmap::ParametersMap _parameters;
Ui_preferencesDialog * _ui;
QStandardItemModel * _indexModel;
bool _initialized;
2013-12-11 00:12:44 +00:00
bool _monitoringState;
QProgressDialog * _progressDialog;
2013-12-11 00:12:44 +00:00
//calibration
CalibrationDialog * _calibrationDialog;
CreateSimpleCalibrationDialog * _createCalibrationDialog;
2013-12-11 00:12:44 +00:00
QVector<QCheckBox*> _3dRenderingShowClouds;
QVector<QDoubleSpinBox*> _3dRenderingVoxelSize;
QVector<QSpinBox*> _3dRenderingDecimation;
QVector<QDoubleSpinBox*> _3dRenderingMaxDepth;
QVector<QDoubleSpinBox*> _3dRenderingOpacity;
QVector<QSpinBox*> _3dRenderingPtSize;
QVector<QCheckBox*> _3dRenderingShowScans;
QVector<QSpinBox*> _3dRenderingDownsamplingScan;
QVector<QDoubleSpinBox*> _3dRenderingVoxelSizeScan;
2013-12-11 00:12:44 +00:00
QVector<QDoubleSpinBox*> _3dRenderingOpacityScan;
QVector<QSpinBox*> _3dRenderingPtSizeScan;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(PreferencesDialog::PANEL_FLAGS)
}
#endif /* PREFERENCESDIALOG_H_ */