mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
moved rtabmap-ros-pkg project in this project
git-svn-id: http://rtabmap.googlecode.com/svn/branches/0.3/rtabmap@52 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
162
guilib/include/rtabmap/gui/MainWindow.h
Normal file
162
guilib/include/rtabmap/gui/MainWindow.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2011, Mathieu Labbe and IntRoLab - Universite de Sherbrooke
|
||||
*
|
||||
* This file is part of RTAB-Map.
|
||||
*
|
||||
* RTAB-Map is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RTAB-Map is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RTAB-Map. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MAINWINDOW_H_
|
||||
#define MAINWINDOW_H_
|
||||
|
||||
#include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
|
||||
|
||||
#include "utilite/UEventsHandler.h"
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtCore/QSet>
|
||||
#include "rtabmap/core/RtabmapEvent.h"
|
||||
#include "rtabmap/gui/PreferencesDialog.h"
|
||||
|
||||
namespace rtabmap {
|
||||
class Camera;
|
||||
}
|
||||
|
||||
class QGraphicsScene;
|
||||
class Ui_mainWindow;
|
||||
class QActionGroup;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class LikelihoodScene;
|
||||
class AboutDialog;
|
||||
class Plot;
|
||||
class PdfPlotCurve;
|
||||
class StatsToolBox;
|
||||
class DetailedProgressDialog;
|
||||
|
||||
class RTABMAP_EXP MainWindow : public QMainWindow, public UEventsHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum State {
|
||||
kIdle,
|
||||
kStartingDetection,
|
||||
kDetecting,
|
||||
kPaused,
|
||||
kMonitoring
|
||||
};
|
||||
|
||||
enum SrcType {
|
||||
kSrcUndefined,
|
||||
kSrcVideo,
|
||||
kSrcImages,
|
||||
kSrcStream
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* @param prefDialog If NULL, a default dialog is created. This
|
||||
* dialog is automatically destroyed with the MainWindow.
|
||||
*/
|
||||
MainWindow(PreferencesDialog * prefDialog = 0, QWidget * parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
void changeState(MainWindow::State state);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
virtual void handleEvent(UEvent* anEvent);
|
||||
virtual void resizeEvent(QResizeEvent* anEvent);
|
||||
|
||||
private slots:
|
||||
void startDetection();
|
||||
void pauseDetection();
|
||||
void stopDetection();
|
||||
void generateMap();
|
||||
void deleteMemory();
|
||||
void openWorkingDirectory();
|
||||
void updateEditMenu();
|
||||
void selectImages();
|
||||
void selectVideo();
|
||||
void selectStream();
|
||||
void selectDatabase();
|
||||
void resetTheMemory();
|
||||
void dumpTheMemory();
|
||||
void dumpThePrediction();
|
||||
void clearTheCache();
|
||||
void saveFigures();
|
||||
void loadFigures();
|
||||
void updateElapsedTime();
|
||||
void processStats(const rtabmap::Statistics & stat);
|
||||
void applyAllPrefSettings();
|
||||
void applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags);
|
||||
void applyPrefSettings(const rtabmap::ParametersMap & parameters);
|
||||
void processRtabmapEventInit(int status, const QString & info);
|
||||
void updateItemsShown();
|
||||
void changeImgRateSetting();
|
||||
void changeTimeLimitSetting();
|
||||
void captureScreen();
|
||||
|
||||
signals:
|
||||
void statsReceived(const rtabmap::Statistics &);
|
||||
void thresholdsChanged(int, int);
|
||||
void stateChanged(MainWindow::State);
|
||||
void rtabmapEventInitReceived(int status, const QString & info);
|
||||
void imgRateChanged(double);
|
||||
void timeLimitChanged(double);
|
||||
void noMoreImagesReceived();
|
||||
void loopClosureThrChanged(float);
|
||||
void retrievalThrChanged(float);
|
||||
|
||||
private:
|
||||
void drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords, const std::multimap<int, cv::KeyPoint> & loopWords);
|
||||
void setupMainLayout(bool vertical);
|
||||
void updateSelectSourceMenu(int type);
|
||||
|
||||
private:
|
||||
Ui_mainWindow * _ui;
|
||||
|
||||
State _state;
|
||||
rtabmap::Camera * _camera;
|
||||
|
||||
SrcType _srcType;
|
||||
QString _srcPath;
|
||||
|
||||
//Dialogs
|
||||
PreferencesDialog * _preferencesDialog;
|
||||
AboutDialog * _aboutDialog;
|
||||
|
||||
QSet<int> _lastIds;
|
||||
int _lastId;
|
||||
|
||||
QMap<int, QByteArray> _imagesMap;
|
||||
|
||||
QTimer * _oneSecondTimer;
|
||||
QTime * _elapsedTime;
|
||||
QTime * _logEventTime;
|
||||
|
||||
PdfPlotCurve * _posteriorCurve;
|
||||
PdfPlotCurve * _likelihoodCurve;
|
||||
|
||||
DetailedProgressDialog * _initProgressDialog;
|
||||
QActionGroup * _selectSourceGrp;
|
||||
|
||||
QString _graphSavingFileName;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* MainWindow_H_ */
|
||||
208
guilib/include/rtabmap/gui/PreferencesDialog.h
Normal file
208
guilib/include/rtabmap/gui/PreferencesDialog.h
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2011, Mathieu Labbe and IntRoLab - Universite de Sherbrooke
|
||||
*
|
||||
* This file is part of RTAB-Map.
|
||||
*
|
||||
* RTAB-Map is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RTAB-Map is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RTAB-Map. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PREFERENCESDIALOG_H_
|
||||
#define PREFERENCESDIALOG_H_
|
||||
|
||||
#include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtCore/QModelIndex>
|
||||
|
||||
#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;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class PlotCurve;
|
||||
|
||||
class RTABMAP_EXP PreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum PanelFlag {
|
||||
kPanelDummy = 0,
|
||||
kPanelGeneralStrategy = 1,
|
||||
kPanelGeneral = 2,
|
||||
kPanelFourier = 4,
|
||||
kPanelSurf = 8,
|
||||
kPanelSource = 16,
|
||||
kPanelAll = 31
|
||||
};
|
||||
// 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,
|
||||
kSrcUsbDevice,
|
||||
kSrcImages,
|
||||
kSrcVideo,
|
||||
kSrcDatabase
|
||||
};
|
||||
|
||||
public:
|
||||
static QString getIniFilePath();
|
||||
|
||||
public:
|
||||
PreferencesDialog(QWidget * parent = 0);
|
||||
virtual ~PreferencesDialog();
|
||||
|
||||
void saveWindowGeometry(const QString & windowName, const QWidget * window);
|
||||
void loadWindowGeometry(const QString & windowName, QWidget * window);
|
||||
void saveMainWindowState(const QMainWindow * mainWindow);
|
||||
void loadMainWindowState(QMainWindow * mainWindow);
|
||||
|
||||
void saveCustomConfig(const QString & section, const QString & key, const QString & value);
|
||||
QString loadCustomConfig(const QString & section, const QString & key);
|
||||
|
||||
rtabmap::ParametersMap getAllParameters();
|
||||
|
||||
//General panel
|
||||
int getGeneralLoggerLevel() const;
|
||||
int getGeneralLoggerEventLevel() const;
|
||||
int getGeneralLoggerPauseLevel() const;
|
||||
int getGeneralLoggerType() const;
|
||||
bool getGeneralLoggerPrintTime() const;
|
||||
bool isVerticalLayoutUsed() const;
|
||||
bool isImageFlipped() const;
|
||||
bool imageRejectedShown() const;
|
||||
bool beepOnPause() const;
|
||||
int getKeypointsOpacity() const;
|
||||
QString getWorkingDirectory();
|
||||
|
||||
// source panel
|
||||
double getGeneralImageRate() const;
|
||||
bool getGeneralAutoRestart() const;
|
||||
int getSourceType() const;
|
||||
QString getSourceTypeStr() const;
|
||||
int getSourceWidth() const;
|
||||
int getSourceHeight() const;
|
||||
QString getSourceImagesPath() const; //Images group
|
||||
QString getSourceImagesSuffix() const; //Images group
|
||||
int getSourceImagesSuffixIndex() const; //Images group
|
||||
int getSourceImagesStartPos() const; //Images group
|
||||
bool getSourceImagesRefreshDir() const; //Images group
|
||||
QString getSourceVideoPath() const; //Video group
|
||||
int getSourceUsbDeviceId() const; //UsbDevice group
|
||||
QString getSourceDatabasePath() const; //Database group
|
||||
bool getSourceDatabaseIgnoreChildren() const; //Database group
|
||||
|
||||
//
|
||||
bool isImagesKept() const;
|
||||
double getTimeLimit() const;
|
||||
|
||||
//specific
|
||||
double getLoopThr() const;
|
||||
double getReacThr() const;
|
||||
double getVpThr() const;
|
||||
double getExpThr() const;
|
||||
|
||||
signals:
|
||||
void settingsChanged(PreferencesDialog::PANEL_FLAGS);
|
||||
void settingsChanged(rtabmap::ParametersMap);
|
||||
|
||||
public slots:
|
||||
void setHardThr(int value);
|
||||
void setReactivationThr(int value);
|
||||
void setImgRate(double value);
|
||||
void setAutoRestart(bool value);
|
||||
void setTimeLimit(double value);
|
||||
void selectSource(Src src = kSrcUndef);
|
||||
|
||||
private slots:
|
||||
void closeDialog ( QAbstractButton * button );
|
||||
void resetApply ( QAbstractButton * button );
|
||||
void resetSettings(int panelNumber);
|
||||
void loadConfigFrom();
|
||||
void saveConfigTo();
|
||||
void makeObsoleteGeneralPanel();
|
||||
void makeObsoleteSourcePanel();
|
||||
void clicked(const QModelIndex &index);
|
||||
void addParameter(int value);
|
||||
void addParameter(double value);
|
||||
void addParameter(const QString & value);
|
||||
void updatePredictionLCSliders();
|
||||
void updatePredictionLC();
|
||||
void updateKpROI();
|
||||
void changeWorkingDirectory();
|
||||
void changeDictionaryPath();
|
||||
|
||||
protected:
|
||||
virtual void showEvent ( QShowEvent * event );
|
||||
|
||||
void setParameter(const std::string & key, const std::string & value);
|
||||
|
||||
virtual QString getParamMessage();
|
||||
|
||||
virtual void readSettings(const QString & filePath = QString());
|
||||
virtual void readGuiSettings(const QString & filePath = QString());
|
||||
virtual void readCameraSettings(const QString & filePath = QString());
|
||||
virtual void readCoreSettings(const QString & filePath = QString());
|
||||
|
||||
virtual void writeSettings(const QString & filePath = QString());
|
||||
virtual void writeGuiSettings(const QString & filePath = QString());
|
||||
virtual void writeCameraSettings(const QString & filePath = QString());
|
||||
virtual void writeCoreSettings(const QString & filePath = QString());
|
||||
|
||||
private:
|
||||
bool validateForm();
|
||||
bool validatePanelGeneral();
|
||||
bool validatePanelFourier();
|
||||
bool validatePanelSurf();
|
||||
void setupTreeView();
|
||||
void setupSignals();
|
||||
void setupPredictionPanel();
|
||||
void setupKpRoiPanel();
|
||||
bool parseModel(QList<QGroupBox*> & boxes, QStandardItem * parentItem, int currentLevel, int & absoluteIndex);
|
||||
void addParameter(const QObject * object, int value);
|
||||
void addParameter(const QObject * object, double value);
|
||||
void addParameter(const QObject * object, const QString & value);
|
||||
void addParameters(const QGroupBox * box);
|
||||
QList<QGroupBox*> getGroupBoxes();
|
||||
|
||||
protected:
|
||||
rtabmap::ParametersMap _parameters;
|
||||
PANEL_FLAGS _obsoletePanels;
|
||||
|
||||
private:
|
||||
Ui_preferencesDialog * _ui;
|
||||
QStandardItemModel * _indexModel;
|
||||
bool _initialized;
|
||||
|
||||
//For Bayes filter prediction parameters
|
||||
QList<QSlider*> _predictionLCSliders; // Sliders used to setup the prediction
|
||||
bool _predictionPanelInitialized;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(PreferencesDialog::PANEL_FLAGS)
|
||||
|
||||
}
|
||||
|
||||
#endif /* PREFERENCESDIALOG_H_ */
|
||||
Reference in New Issue
Block a user