2011-06-05 14:45:39 +00:00
/*
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.
*/
2011-06-05 14:45:39 +00:00
#include "rtabmap/gui/PreferencesDialog.h"
2012-12-11 18:05:05 +00:00
#include "rtabmap/gui/DatabaseViewer.h"
2013-12-11 00:12:44 +00:00
#include "rtabmap/gui/OdometryViewer.h"
2014-07-26 04:36:00 +00:00
#include "rtabmap/gui/CalibrationDialog.h"
2013-12-11 00:12:44 +00:00
2011-06-05 14:45:39 +00:00
#include <QtCore/QSettings>
#include <QtCore/QDir>
2013-12-11 00:12:44 +00:00
#include <QtCore/QTimer>
2015-03-16 19:51:22 +00:00
#include <QFileDialog>
2015-12-17 14:13:19 -05:00
#include <QInputDialog>
2015-03-16 19:51:22 +00:00
#include <QMessageBox>
2011-06-05 14:45:39 +00:00
#include <QtGui/QStandardItemModel>
2015-03-16 19:51:22 +00:00
#include <QMainWindow>
#include <QProgressDialog>
#include <QScrollBar>
2015-09-04 13:46:37 -04:00
#include <QStatusBar>
2013-12-11 00:12:44 +00:00
#include <QtGui/QCloseEvent>
2011-06-05 14:45:39 +00:00
#include "ui_preferencesDialog.h"
2013-12-11 00:12:44 +00:00
2014-10-02 15:12:56 +00:00
#include "rtabmap/core/Version.h"
2011-06-05 14:45:39 +00:00
#include "rtabmap/core/Rtabmap.h"
#include "rtabmap/core/Parameters.h"
2013-12-11 00:12:44 +00:00
#include "rtabmap/core/Odometry.h"
2015-04-23 22:01:41 -04:00
#include "rtabmap/core/OdometryThread.h"
2014-06-15 03:31:35 +00:00
#include "rtabmap/core/CameraRGBD.h"
2014-06-13 03:47:39 +00:00
#include "rtabmap/core/CameraThread.h"
2015-06-26 18:21:32 -04:00
#include "rtabmap/core/CameraRGB.h"
#include "rtabmap/core/CameraStereo.h"
2013-12-11 00:12:44 +00:00
#include "rtabmap/core/Memory.h"
2014-06-22 03:33:56 +00:00
#include "rtabmap/core/VWDictionary.h"
2015-11-27 11:09:39 -05:00
#include "rtabmap/core/Optimizer.h"
2016-02-15 19:35:24 -05:00
#include "rtabmap/core/OptimizerG2O.h"
2015-06-26 18:21:32 -04:00
#include "rtabmap/core/DBReader.h"
2013-12-11 00:12:44 +00:00
#include "rtabmap/gui/LoopClosureViewer.h"
2015-04-06 00:28:04 -04:00
#include "rtabmap/gui/CameraViewer.h"
2015-01-13 18:11:34 -05:00
#include "rtabmap/gui/CloudViewer.h"
#include "rtabmap/gui/ImageView.h"
2015-08-25 10:32:27 -04:00
#include "rtabmap/gui/GraphViewer.h"
2015-01-14 11:02:17 -05:00
#include "ExportCloudsDialog.h"
2016-03-14 17:27:53 -04:00
#include "ExportScansDialog.h"
2015-01-14 11:02:17 -05:00
#include "PostProcessingDialog.h"
2015-07-30 14:17:29 -04:00
#include "CreateSimpleCalibrationDialog.h"
2013-12-11 00:12:44 +00:00
2013-04-30 20:16:01 +00:00
#include <rtabmap/utilite/ULogger.h>
#include <rtabmap/utilite/UConversion.h>
#include <rtabmap/utilite/UStl.h>
2013-12-11 00:12:44 +00:00
#include <rtabmap/utilite/UEventsManager.h>
2015-08-25 10:32:27 -04:00
#include "rtabmap/utilite/UPlot.h"
2011-06-05 14:45:39 +00:00
2015-06-18 23:00:46 -04:00
#include <opencv2/opencv_modules.hpp>
#if CV_MAJOR_VERSION < 3
2016-01-21 17:11:57 -05:00
#ifdef HAVE_OPENCV_GPU
2015-06-18 23:00:46 -04:00
#include <opencv2/gpu/gpu.hpp>
2016-01-21 17:11:57 -05:00
#endif
2015-06-18 23:00:46 -04:00
#else
2016-01-21 17:11:57 -05:00
#ifdef HAVE_OPENCV_CUDAFEATURES2D
2015-06-18 23:00:46 -04:00
#include <opencv2/core/cuda.hpp>
#endif
2016-01-21 17:11:57 -05:00
#endif
2013-12-14 02:43:26 +00:00
2011-06-05 14:45:39 +00:00
using namespace rtabmap ;
namespace rtabmap {
PreferencesDialog :: PreferencesDialog ( QWidget * parent ) :
QDialog ( parent ),
_obsoletePanels ( kPanelDummy ),
_ui ( 0 ),
_indexModel ( 0 ),
2013-12-11 00:12:44 +00:00
_initialized ( false ),
2016-05-05 18:25:26 -04:00
_progressDialog ( new QProgressDialog ( this )),
2016-01-19 17:43:33 -05:00
_calibrationDialog ( new CalibrationDialog ( false , "." , this )),
_createCalibrationDialog ( new CreateSimpleCalibrationDialog ( "." , "" , this ))
2011-06-05 14:45:39 +00:00
{
ULOGGER_DEBUG ( "" );
2015-04-06 13:35:44 -04:00
_calibrationDialog -> setWindowFlags ( Qt :: Window );
2015-04-06 15:54:19 -04:00
_calibrationDialog -> setWindowTitle ( tr ( "Calibration" ));
2011-06-05 14:45:39 +00:00
2016-05-05 18:25:26 -04:00
_progressDialog -> setWindowTitle ( tr ( "Read parameters..." ));
_progressDialog -> setMaximum ( 2 );
_progressDialog -> setValue ( 2 );
2011-06-05 14:45:39 +00:00
_ui = new Ui_preferencesDialog ();
_ui -> setupUi ( this );
2015-06-18 23:00:46 -04:00
bool haveCuda = false ;
#if CV_MAJOR_VERSION < 3
2016-01-21 17:11:57 -05:00
#ifdef HAVE_OPENCV_GPU
2015-06-18 23:00:46 -04:00
haveCuda = cv :: gpu :: getCudaEnabledDeviceCount () != 0 ;
2016-01-21 17:11:57 -05:00
#endif
2015-06-18 23:00:46 -04:00
#else
2016-01-21 17:11:57 -05:00
#ifdef HAVE_OPENCV_CUDAFEATURES2D
2015-06-18 23:00:46 -04:00
haveCuda = cv :: cuda :: getCudaEnabledDeviceCount () != 0 ;
#endif
#endif
if ( ! haveCuda )
2013-12-14 02:43:26 +00:00
{
2014-06-22 03:33:56 +00:00
_ui -> surf_checkBox_gpuVersion -> setChecked ( false );
2013-12-14 02:43:26 +00:00
_ui -> surf_checkBox_gpuVersion -> setEnabled ( false );
_ui -> label_surf_checkBox_gpuVersion -> setEnabled ( false );
2014-06-22 03:33:56 +00:00
_ui -> surf_doubleSpinBox_gpuKeypointsRatio -> setEnabled ( false );
_ui -> label_surf_checkBox_gpuKeypointsRatio -> setEnabled ( false );
_ui -> fastGpu -> setChecked ( false );
_ui -> fastGpu -> setEnabled ( false );
_ui -> label_fastGPU -> setEnabled ( false );
_ui -> fastKeypointRatio -> setEnabled ( false );
_ui -> label_fastGPUKptRatio -> setEnabled ( false );
_ui -> checkBox_ORBGpu -> setChecked ( false );
_ui -> checkBox_ORBGpu -> setEnabled ( false );
_ui -> label_orbGpu -> setEnabled ( false );
// remove BruteForceGPU option
_ui -> comboBox_dictionary_strategy -> removeItem ( 4 );
2014-09-21 21:14:17 +00:00
_ui -> reextract_nn -> removeItem ( 4 );
2013-12-14 02:43:26 +00:00
}
2014-02-13 21:32:46 +00:00
2014-07-29 21:48:37 +00:00
#if PCL_VERSION_COMPARE(<, 1, 7, 2)
_ui -> checkBox_map_shown -> setChecked ( false );
_ui -> checkBox_map_shown -> setEnabled ( false );
_ui -> label_map_shown -> setText ( _ui -> label_map_shown -> text () + " (Disabled, PCL >=1.7.2 required)" );
#endif
2016-03-01 14:25:00 -05:00
#ifndef RTABMAP_NONFREE
2014-11-21 23:37:23 +00:00
_ui -> comboBox_detector_strategy -> setItemData ( 0 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_detector_strategy -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_type -> setItemData ( 0 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_type -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_dictionary_strategy -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_nn -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
2015-06-18 23:00:46 -04:00
#if CV_MAJOR_VERSION == 3
_ui -> comboBox_detector_strategy -> setItemData ( 0 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_detector_strategy -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_detector_strategy -> setItemData ( 3 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_detector_strategy -> setItemData ( 4 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_detector_strategy -> setItemData ( 5 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_detector_strategy -> setItemData ( 6 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_type -> setItemData ( 0 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_type -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_type -> setItemData ( 3 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_type -> setItemData ( 4 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_type -> setItemData ( 5 , 0 , Qt :: UserRole - 1 );
_ui -> reextract_type -> setItemData ( 6 , 0 , Qt :: UserRole - 1 );
#endif
2016-03-01 14:25:00 -05:00
#endif
2016-02-22 18:22:49 -05:00
#if CV_MAJOR_VERSION == 3
_ui -> groupBox_fast_opencv2 -> setEnabled ( false );
#endif
2016-01-15 17:05:55 -05:00
_ui -> comboBox_cameraImages_gtFormat -> setItemData ( 4 , 0 , Qt :: UserRole - 1 );
2015-11-27 11:09:39 -05:00
if ( ! Optimizer :: isAvailable ( Optimizer :: kTypeG2O ))
2015-03-12 17:00:56 -04:00
{
_ui -> graphOptimization_type -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
}
2016-02-15 19:35:24 -05:00
if ( ! OptimizerG2O :: isCSparseAvailable ())
{
_ui -> comboBox_g2o_solver -> setItemData ( 0 , 0 , Qt :: UserRole - 1 );
}
if ( ! OptimizerG2O :: isCholmodAvailable ())
{
_ui -> comboBox_g2o_solver -> setItemData ( 2 , 0 , Qt :: UserRole - 1 );
}
2016-03-01 14:25:00 -05:00
if ( ! Optimizer :: isAvailable ( Optimizer :: kTypeTORO ))
{
_ui -> graphOptimization_type -> setItemData ( 0 , 0 , Qt :: UserRole - 1 );
}
2015-11-27 11:09:39 -05:00
if ( ! Optimizer :: isAvailable ( Optimizer :: kTypeGTSAM ))
2015-09-02 17:51:43 -04:00
{
_ui -> graphOptimization_type -> setItemData ( 2 , 0 , Qt :: UserRole - 1 );
}
2016-03-01 14:25:00 -05:00
#ifdef RTABMAP_VERTIGO
2015-11-27 11:09:39 -05:00
if ( ! Optimizer :: isAvailable ( Optimizer :: kTypeG2O ) && ! Optimizer :: isAvailable ( Optimizer :: kTypeGTSAM ))
2016-03-01 14:25:00 -05:00
#endif
2015-09-02 17:51:43 -04:00
{
_ui -> graphOptimization_robust -> setEnabled ( false );
}
2015-07-24 20:42:36 -04:00
if ( ! CameraOpenni :: available ())
{
_ui -> comboBox_cameraRGBD -> setItemData ( 0 , 0 , Qt :: UserRole - 1 );
}
2015-04-06 00:28:04 -04:00
if ( ! CameraFreenect :: available ())
{
_ui -> comboBox_cameraRGBD -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
}
if ( ! CameraOpenNICV :: available ())
{
_ui -> comboBox_cameraRGBD -> setItemData ( 2 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_cameraRGBD -> setItemData ( 3 , 0 , Qt :: UserRole - 1 );
}
if ( ! CameraOpenNI2 :: available ())
{
_ui -> comboBox_cameraRGBD -> setItemData ( 4 , 0 , Qt :: UserRole - 1 );
}
if ( ! CameraFreenect2 :: available ())
{
_ui -> comboBox_cameraRGBD -> setItemData ( 5 , 0 , Qt :: UserRole - 1 );
}
if ( ! CameraStereoDC1394 :: available ())
{
2015-07-06 17:25:38 -04:00
_ui -> comboBox_cameraStereo -> setItemData ( 0 , 0 , Qt :: UserRole - 1 );
2015-04-06 00:28:04 -04:00
}
2015-04-07 12:00:10 -04:00
if ( ! CameraStereoFlyCapture2 :: available ())
{
2015-07-06 17:25:38 -04:00
_ui -> comboBox_cameraStereo -> setItemData ( 1 , 0 , Qt :: UserRole - 1 );
2015-04-07 12:00:10 -04:00
}
2016-05-31 19:09:49 -04:00
if ( ! CameraStereoZed :: available ())
{
_ui -> comboBox_cameraRGBD -> setItemData ( 7 , 0 , Qt :: UserRole - 1 );
_ui -> comboBox_cameraStereo -> setItemData ( 4 , 0 , Qt :: UserRole - 1 );
}
2015-04-06 00:28:04 -04:00
_ui -> openni2_exposure -> setEnabled ( CameraOpenNI2 :: exposureGainAvailable ());
_ui -> openni2_gain -> setEnabled ( CameraOpenNI2 :: exposureGainAvailable ());
2014-11-21 23:37:23 +00:00
2015-04-25 17:30:15 -04:00
// Default Driver
2015-06-26 18:21:32 -04:00
connect ( _ui -> comboBox_sourceType , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( updateSourceGrpVisibility ()));
2016-01-06 17:26:55 -05:00
connect ( _ui -> comboBox_cameraRGBD , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( updateSourceGrpVisibility ()));
connect ( _ui -> source_comboBox_image_type , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( updateSourceGrpVisibility ()));
connect ( _ui -> comboBox_cameraStereo , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( updateSourceGrpVisibility ()));
2015-04-25 17:30:15 -04:00
this -> resetSettings ( _ui -> groupBox_source0 );
2011-06-05 14:45:39 +00:00
_ui -> predictionPlot -> showLegend ( false );
2013-12-11 00:12:44 +00:00
QButtonGroup * buttonGroup = new QButtonGroup ( this );
buttonGroup -> addButton ( _ui -> radioButton_basic );
buttonGroup -> addButton ( _ui -> radioButton_advanced );
2011-06-05 14:45:39 +00:00
// Connect
connect ( _ui -> buttonBox_global , SIGNAL ( clicked ( QAbstractButton * )), this , SLOT ( closeDialog ( QAbstractButton * )));
connect ( _ui -> buttonBox_local , SIGNAL ( clicked ( QAbstractButton * )), this , SLOT ( resetApply ( QAbstractButton * )));
connect ( _ui -> pushButton_loadConfig , SIGNAL ( clicked ()), this , SLOT ( loadConfigFrom ()));
connect ( _ui -> pushButton_saveConfig , SIGNAL ( clicked ()), this , SLOT ( saveConfigTo ()));
2014-01-22 19:49:28 +00:00
connect ( _ui -> pushButton_resetConfig , SIGNAL ( clicked ()), this , SLOT ( resetConfig ()));
2012-03-03 01:46:30 +00:00
connect ( _ui -> radioButton_basic , SIGNAL ( toggled ( bool )), this , SLOT ( setupTreeView ()));
2014-04-02 15:51:02 +00:00
connect ( _ui -> pushButton_testOdometry , SIGNAL ( clicked ()), this , SLOT ( testOdometry ()));
2015-06-26 18:21:32 -04:00
connect ( _ui -> pushButton_test_camera , SIGNAL ( clicked ()), this , SLOT ( testCamera ()));
2011-06-05 14:45:39 +00:00
// General panel
connect ( _ui -> general_checkBox_imagesKept , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
2016-06-12 17:53:35 -04:00
connect ( _ui -> general_checkBox_cloudsKept , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
2011-06-05 14:45:39 +00:00
connect ( _ui -> checkBox_verticalLayoutUsed , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
connect ( _ui -> checkBox_imageRejectedShown , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
2012-03-03 01:46:30 +00:00
connect ( _ui -> checkBox_imageHighestHypShown , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
2011-06-05 14:45:39 +00:00
connect ( _ui -> checkBox_beep , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
2015-05-05 17:38:38 -04:00
connect ( _ui -> checkBox_notifyWhenNewGlobalPathIsReceived , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
2014-09-25 17:37:11 +00:00
connect ( _ui -> spinBox_odomQualityWarnThr , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
2015-01-07 17:30:20 -05:00
connect ( _ui -> checkBox_posteriorGraphView , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteGeneralPanel ()));
2011-06-05 14:45:39 +00:00
2013-12-11 00:12:44 +00:00
// Cloud rendering panel
2014-07-29 00:52:35 +00:00
_3dRenderingShowClouds . resize ( 2 );
2013-12-11 00:12:44 +00:00
_3dRenderingShowClouds [ 0 ] = _ui -> checkBox_showClouds ;
_3dRenderingShowClouds [ 1 ] = _ui -> checkBox_showOdomClouds ;
2014-07-29 00:52:35 +00:00
_3dRenderingDecimation . resize ( 2 );
2013-12-11 00:12:44 +00:00
_3dRenderingDecimation [ 0 ] = _ui -> spinBox_decimation ;
_3dRenderingDecimation [ 1 ] = _ui -> spinBox_decimation_odom ;
2014-07-29 00:52:35 +00:00
_3dRenderingMaxDepth . resize ( 2 );
2013-12-11 00:12:44 +00:00
_3dRenderingMaxDepth [ 0 ] = _ui -> doubleSpinBox_maxDepth ;
_3dRenderingMaxDepth [ 1 ] = _ui -> doubleSpinBox_maxDepth_odom ;
2016-04-12 15:14:04 -04:00
_3dRenderingMinDepth . resize ( 2 );
_3dRenderingMinDepth [ 0 ] = _ui -> doubleSpinBox_minDepth ;
_3dRenderingMinDepth [ 1 ] = _ui -> doubleSpinBox_minDepth_odom ;
2013-12-11 00:12:44 +00:00
_3dRenderingOpacity . resize ( 2 );
_3dRenderingOpacity [ 0 ] = _ui -> doubleSpinBox_opacity ;
_3dRenderingOpacity [ 1 ] = _ui -> doubleSpinBox_opacity_odom ;
_3dRenderingPtSize . resize ( 2 );
_3dRenderingPtSize [ 0 ] = _ui -> spinBox_ptsize ;
_3dRenderingPtSize [ 1 ] = _ui -> spinBox_ptsize_odom ;
2014-07-29 00:52:35 +00:00
_3dRenderingShowScans . resize ( 2 );
2013-12-11 00:12:44 +00:00
_3dRenderingShowScans [ 0 ] = _ui -> checkBox_showScans ;
_3dRenderingShowScans [ 1 ] = _ui -> checkBox_showOdomScans ;
2015-11-22 18:08:32 -05:00
_3dRenderingDownsamplingScan . resize ( 2 );
_3dRenderingDownsamplingScan [ 0 ] = _ui -> spinBox_downsamplingScan ;
_3dRenderingDownsamplingScan [ 1 ] = _ui -> spinBox_downsamplingScan_odom ;
_3dRenderingVoxelSizeScan . resize ( 2 );
_3dRenderingVoxelSizeScan [ 0 ] = _ui -> doubleSpinBox_voxelSizeScan ;
_3dRenderingVoxelSizeScan [ 1 ] = _ui -> doubleSpinBox_voxelSizeScan_odom ;
2013-12-11 00:12:44 +00:00
_3dRenderingOpacityScan . resize ( 2 );
_3dRenderingOpacityScan [ 0 ] = _ui -> doubleSpinBox_opacity_scan ;
_3dRenderingOpacityScan [ 1 ] = _ui -> doubleSpinBox_opacity_odom_scan ;
_3dRenderingPtSizeScan . resize ( 2 );
_3dRenderingPtSizeScan [ 0 ] = _ui -> spinBox_ptsize_scan ;
_3dRenderingPtSizeScan [ 1 ] = _ui -> spinBox_ptsize_odom_scan ;
2016-03-01 17:33:27 -05:00
_3dRenderingShowFeatures . resize ( 2 );
_3dRenderingShowFeatures [ 0 ] = _ui -> checkBox_showFeatures ;
_3dRenderingShowFeatures [ 1 ] = _ui -> checkBox_showOdomFeatures ;
_3dRenderingPtSizeFeatures . resize ( 2 );
_3dRenderingPtSizeFeatures [ 0 ] = _ui -> spinBox_ptsize_features ;
_3dRenderingPtSizeFeatures [ 1 ] = _ui -> spinBox_ptsize_odom_features ;
2014-07-29 00:52:35 +00:00
for ( int i = 0 ; i < 2 ; ++ i )
2013-12-11 00:12:44 +00:00
{
connect ( _3dRenderingShowClouds [ i ], SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _3dRenderingDecimation [ i ], SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _3dRenderingMaxDepth [ i ], SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2016-04-12 15:14:04 -04:00
connect ( _3dRenderingMinDepth [ i ], SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2013-12-11 00:12:44 +00:00
connect ( _3dRenderingShowScans [ i ], SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2016-03-01 17:33:27 -05:00
connect ( _3dRenderingShowFeatures [ i ], SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2013-12-11 00:12:44 +00:00
2015-11-22 18:08:32 -05:00
connect ( _3dRenderingDownsamplingScan [ i ], SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _3dRenderingVoxelSizeScan [ i ], SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2014-07-29 00:52:35 +00:00
connect ( _3dRenderingOpacity [ i ], SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _3dRenderingPtSize [ i ], SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _3dRenderingOpacityScan [ i ], SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _3dRenderingPtSizeScan [ i ], SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2016-03-01 17:33:27 -05:00
connect ( _3dRenderingPtSizeFeatures [ i ], SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2013-12-11 00:12:44 +00:00
}
2016-06-10 20:12:13 -04:00
connect ( _ui -> doubleSpinBox_voxel , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_noiseRadius , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> spinBox_noiseMinNeighbors , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2014-10-30 19:38:58 +00:00
connect ( _ui -> checkBox_showGraphs , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2015-07-26 15:50:39 -04:00
connect ( _ui -> checkBox_showLabels , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2014-10-30 19:38:58 +00:00
2016-02-15 19:35:24 -05:00
connect ( _ui -> radioButton_noFiltering , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> radioButton_nodeFiltering , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> radioButton_subtractFiltering , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2014-02-13 21:32:46 +00:00
connect ( _ui -> doubleSpinBox_cloudFilterRadius , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_cloudFilterAngle , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2016-02-15 19:35:24 -05:00
connect ( _ui -> spinBox_subtractFilteringMinPts , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_subtractFilteringRadius , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_subtractFilteringAngle , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2016-06-12 13:51:49 -04:00
connect ( _ui -> spinBox_normalKSearch , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2014-02-13 21:32:46 +00:00
2014-07-29 21:48:37 +00:00
connect ( _ui -> checkBox_map_shown , SIGNAL ( clicked ( bool )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_map_resolution , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_map_opacity , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2015-03-20 14:03:09 -04:00
connect ( _ui -> checkBox_map_erode , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2016-06-10 20:12:13 -04:00
connect ( _ui -> groupBox_map_occupancyFrom3DCloud , SIGNAL ( clicked ( bool )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> checkBox_projMapFrame , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_projMaxGroundAngle , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_projMaxGroundHeight , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> spinBox_projMinClusterSize , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_projMaxObstaclesHeight , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> checkBox_projFlatObstaclesDetected , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2014-07-29 21:48:37 +00:00
2016-02-15 19:35:24 -05:00
connect ( _ui -> groupBox_organized , SIGNAL ( clicked ( bool )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> doubleSpinBox_mesh_angleTolerance , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> checkBox_mesh_quad , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
connect ( _ui -> spinBox_mesh_triangleSize , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteCloudRenderingPanel ()));
2013-12-11 00:12:44 +00:00
//Logging panel
connect ( _ui -> comboBox_loggerLevel , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteLoggingPanel ()));
connect ( _ui -> comboBox_loggerEventLevel , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteLoggingPanel ()));
connect ( _ui -> comboBox_loggerPauseLevel , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteLoggingPanel ()));
connect ( _ui -> checkBox_logger_printTime , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteLoggingPanel ()));
2016-01-05 13:55:21 -05:00
connect ( _ui -> checkBox_logger_printThreadId , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteLoggingPanel ()));
2013-12-11 00:12:44 +00:00
connect ( _ui -> comboBox_loggerType , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteLoggingPanel ()));
2011-06-05 14:45:39 +00:00
//Source panel
connect ( _ui -> general_doubleSpinBox_imgRate , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-02-28 18:09:22 -05:00
connect ( _ui -> source_mirroring , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-11-22 18:08:32 -05:00
connect ( _ui -> toolButton_source_path_calibration , SIGNAL ( clicked ()), this , SLOT ( selectCalibrationPath ()));
connect ( _ui -> lineEdit_calibrationFile , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-06-26 18:21:32 -04:00
_ui -> stackedWidget_src -> setCurrentIndex ( _ui -> comboBox_sourceType -> currentIndex ());
connect ( _ui -> comboBox_sourceType , SIGNAL ( currentIndexChanged ( int )), _ui -> stackedWidget_src , SLOT ( setCurrentIndex ( int )));
connect ( _ui -> comboBox_sourceType , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> lineEdit_sourceDevice , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> lineEdit_sourceLocalTransform , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2012-06-24 17:19:34 +00:00
//Image source
_ui -> stackedWidget_image -> setCurrentIndex ( _ui -> source_comboBox_image_type -> currentIndex ());
connect ( _ui -> source_comboBox_image_type , SIGNAL ( currentIndexChanged ( int )), _ui -> stackedWidget_image , SLOT ( setCurrentIndex ( int )));
connect ( _ui -> source_comboBox_image_type , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2011-06-05 14:45:39 +00:00
//images group
2015-06-26 18:21:32 -04:00
connect ( _ui -> source_images_toolButton_selectSource , SIGNAL ( clicked ()), this , SLOT ( selectSourceImagesPath ()));
2011-06-05 14:45:39 +00:00
connect ( _ui -> source_images_lineEdit_path , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> source_images_spinBox_startPos , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> source_images_refreshDir , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-16 14:44:25 -04:00
connect ( _ui -> checkBox_rgbImages_rectify , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-19 17:43:33 -05:00
connect ( _ui -> comboBox_cameraImages_bayerMode , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2011-06-05 14:45:39 +00:00
//video group
2015-06-26 18:21:32 -04:00
connect ( _ui -> source_video_toolButton_selectSource , SIGNAL ( clicked ()), this , SLOT ( selectSourceVideoPath ()));
2011-06-05 14:45:39 +00:00
connect ( _ui -> source_video_lineEdit_path , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-16 14:44:25 -04:00
connect ( _ui -> checkBox_rgbVideo_rectify , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2011-06-05 14:45:39 +00:00
//database group
2012-06-24 17:19:34 +00:00
connect ( _ui -> source_database_toolButton_selectSource , SIGNAL ( clicked ()), this , SLOT ( selectSourceDatabase ()));
2012-12-11 18:05:05 +00:00
connect ( _ui -> toolButton_dbViewer , SIGNAL ( clicked ()), this , SLOT ( openDatabaseViewer ()));
2012-06-24 17:19:34 +00:00
connect ( _ui -> groupBox_sourceDatabase , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteSourcePanel ()));
2012-12-11 18:05:05 +00:00
connect ( _ui -> source_database_lineEdit_path , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2013-12-11 00:12:44 +00:00
connect ( _ui -> source_checkBox_ignoreOdometry , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-04-27 02:43:06 -04:00
connect ( _ui -> source_checkBox_ignoreGoalDelay , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-10-13 12:50:25 -04:00
connect ( _ui -> source_checkBox_ignoreGoals , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2012-12-11 18:05:05 +00:00
connect ( _ui -> source_spinBox_databaseStartPos , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-05-01 07:30:09 -04:00
connect ( _ui -> source_checkBox_useDbStamps , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2013-12-11 00:12:44 +00:00
//openni group
2015-06-26 18:21:32 -04:00
_ui -> stackedWidget_rgbd -> setCurrentIndex ( _ui -> comboBox_cameraRGBD -> currentIndex ());
connect ( _ui -> comboBox_cameraRGBD , SIGNAL ( currentIndexChanged ( int )), _ui -> stackedWidget_rgbd , SLOT ( setCurrentIndex ( int )));
2015-04-06 00:28:04 -04:00
connect ( _ui -> comboBox_cameraRGBD , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-06 17:25:38 -04:00
_ui -> stackedWidget_stereo -> setCurrentIndex ( _ui -> comboBox_cameraStereo -> currentIndex ());
connect ( _ui -> comboBox_cameraStereo , SIGNAL ( currentIndexChanged ( int )), _ui -> stackedWidget_stereo , SLOT ( setCurrentIndex ( int )));
connect ( _ui -> comboBox_cameraStereo , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2014-11-20 22:00:47 +00:00
connect ( _ui -> openni2_autoWhiteBalance , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> openni2_autoExposure , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> openni2_exposure , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> openni2_gain , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-02-20 15:32:39 -05:00
connect ( _ui -> openni2_mirroring , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-10-15 16:40:49 -04:00
connect ( _ui -> openni2_stampsIdsUsed , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-05-05 18:21:43 -04:00
connect ( _ui -> comboBox_freenect2Format , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-11-04 18:31:52 -05:00
connect ( _ui -> doubleSpinBox_freenect2MinDepth , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> doubleSpinBox_freenect2MaxDepth , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> checkBox_freenect2BilateralFiltering , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> checkBox_freenect2EdgeAwareFiltering , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> checkBox_freenect2NoiseFiltering , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-30 14:17:29 -04:00
2016-01-06 17:26:55 -05:00
connect ( _ui -> toolButton_cameraImages_timestamps , SIGNAL ( clicked ()), this , SLOT ( selectSourceImagesStamps ()));
connect ( _ui -> lineEdit_cameraImages_timestamps , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-30 14:17:29 -04:00
connect ( _ui -> toolButton_cameraRGBDImages_path_rgb , SIGNAL ( clicked ()), this , SLOT ( selectSourceRGBDImagesPathRGB ()));
connect ( _ui -> toolButton_cameraRGBDImages_path_depth , SIGNAL ( clicked ()), this , SLOT ( selectSourceRGBDImagesPathDepth ()));
2016-01-06 17:26:55 -05:00
connect ( _ui -> toolButton_cameraImages_path_scans , SIGNAL ( clicked ()), this , SLOT ( selectSourceImagesPathScans ()));
connect ( _ui -> toolButton_cameraImages_gt , SIGNAL ( clicked ()), this , SLOT ( selectSourceImagesPathGt ()));
2015-07-30 14:17:29 -04:00
connect ( _ui -> lineEdit_cameraRGBDImages_path_rgb , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> lineEdit_cameraRGBDImages_path_depth , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-06 17:26:55 -05:00
connect ( _ui -> checkBox_cameraImages_timestamps , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-13 18:13:44 -05:00
connect ( _ui -> checkBox_cameraImages_syncTimeStamps , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-30 14:17:29 -04:00
connect ( _ui -> doubleSpinBox_cameraRGBDImages_scale , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-06 17:26:55 -05:00
connect ( _ui -> lineEdit_cameraImages_path_scans , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> lineEdit_cameraImages_laser_transform , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> spinBox_cameraImages_max_scan_pts , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-08 19:15:49 -05:00
connect ( _ui -> spinBox_cameraImages_scanDownsampleStep , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> doubleSpinBox_cameraImages_scanVoxelSize , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-06 17:26:55 -05:00
connect ( _ui -> lineEdit_cameraImages_gt , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> comboBox_cameraImages_gtFormat , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-11 17:21:06 -05:00
connect ( _ui -> groupBox_depthFromScan , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-03-10 12:31:22 -05:00
connect ( _ui -> groupBox_depthFromScan_fillHoles , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-03-10 16:50:24 -05:00
connect ( _ui -> radioButton_depthFromScan_vertical , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> radioButton_depthFromScan_horizontal , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-11 17:21:06 -05:00
connect ( _ui -> checkBox_depthFromScan_fillBorders , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-30 14:17:29 -04:00
connect ( _ui -> toolButton_cameraStereoImages_path_left , SIGNAL ( clicked ()), this , SLOT ( selectSourceStereoImagesPathLeft ()));
connect ( _ui -> toolButton_cameraStereoImages_path_right , SIGNAL ( clicked ()), this , SLOT ( selectSourceStereoImagesPathRight ()));
connect ( _ui -> lineEdit_cameraStereoImages_path_left , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> lineEdit_cameraStereoImages_path_right , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-16 14:44:25 -04:00
connect ( _ui -> checkBox_stereoImages_rectify , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-30 14:17:29 -04:00
2015-07-16 14:44:25 -04:00
connect ( _ui -> toolButton_cameraStereoVideo_path , SIGNAL ( clicked ()), this , SLOT ( selectSourceStereoVideoPath ()));
connect ( _ui -> lineEdit_cameraStereoVideo_path , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> checkBox_stereoVideo_rectify , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-07-30 14:17:29 -04:00
2016-06-02 17:27:12 -04:00
connect ( _ui -> comboBox_stereoZed_resolution , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> comboBox_stereoZed_quality , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> comboBox_stereoZed_sensingMode , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> spinBox_stereoZed_confidenceThr , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> toolButton_zedSvoPath , SIGNAL ( clicked ()), this , SLOT ( selectSourceSvoPath ()));
connect ( _ui -> lineEdit_zedSvoPath , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-05-31 19:09:49 -04:00
2015-04-23 22:01:41 -04:00
connect ( _ui -> checkbox_rgbd_colorOnly , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-08 19:15:49 -05:00
connect ( _ui -> spinBox_source_imageDecimation , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2015-08-27 17:16:12 -04:00
connect ( _ui -> checkbox_stereo_depthGenerated , SIGNAL ( stateChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2014-07-26 04:36:00 +00:00
connect ( _ui -> pushButton_calibrate , SIGNAL ( clicked ()), this , SLOT ( calibrate ()));
2015-07-30 14:17:29 -04:00
connect ( _ui -> pushButton_calibrate_simple , SIGNAL ( clicked ()), this , SLOT ( calibrateSimple ()));
2015-06-26 18:21:32 -04:00
connect ( _ui -> toolButton_openniOniPath , SIGNAL ( clicked ()), this , SLOT ( selectSourceOniPath ()));
connect ( _ui -> toolButton_openni2OniPath , SIGNAL ( clicked ()), this , SLOT ( selectSourceOni2Path ()));
connect ( _ui -> lineEdit_openniOniPath , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> lineEdit_openni2OniPath , SIGNAL ( textChanged ( const QString & )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-06 17:26:55 -05:00
connect ( _ui -> groupBox_scanFromDepth , SIGNAL ( toggled ( bool )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> spinBox_cameraScanFromDepth_decimation , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> doubleSpinBox_cameraSCanFromDepth_maxDepth , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteSourcePanel ()));
2016-01-08 19:15:49 -05:00
connect ( _ui -> doubleSpinBox_cameraImages_scanVoxelSize , SIGNAL ( valueChanged ( double )), this , SLOT ( makeObsoleteSourcePanel ()));
connect ( _ui -> spinBox_cameraImages_scanNormalsK , SIGNAL ( valueChanged ( int )), this , SLOT ( makeObsoleteSourcePanel ()));
2011-06-05 14:45:39 +00:00
2012-03-03 01:46:30 +00:00
//Rtabmap basic
connect ( _ui -> general_doubleSpinBox_timeThr , SIGNAL ( valueChanged ( double )), _ui -> general_doubleSpinBox_timeThr_2 , SLOT ( setValue ( double )));
connect ( _ui -> general_doubleSpinBox_hardThr , SIGNAL ( valueChanged ( double )), _ui -> general_doubleSpinBox_hardThr_2 , SLOT ( setValue ( double )));
2012-12-11 18:05:05 +00:00
connect ( _ui -> doubleSpinBox_similarityThreshold , SIGNAL ( valueChanged ( double )), _ui -> doubleSpinBox_similarityThreshold_2 , SLOT ( setValue ( double )));
2013-12-11 00:12:44 +00:00
connect ( _ui -> general_doubleSpinBox_detectionRate , SIGNAL ( valueChanged ( double )), _ui -> general_doubleSpinBox_detectionRate_2 , SLOT ( setValue ( double )));
2012-03-03 01:46:30 +00:00
connect ( _ui -> general_spinBox_imagesBufferSize , SIGNAL ( valueChanged ( int )), _ui -> general_spinBox_imagesBufferSize_2 , SLOT ( setValue ( int )));
2012-06-24 17:19:34 +00:00
connect ( _ui -> general_spinBox_maxStMemSize , SIGNAL ( valueChanged ( int )), _ui -> general_spinBox_maxStMemSize_2 , SLOT ( setValue ( int )));
connect ( _ui -> general_doubleSpinBox_timeThr_2 , SIGNAL ( editingFinished ()), this , SLOT ( updateBasicParameter ()));
connect ( _ui -> general_doubleSpinBox_hardThr_2 , SIGNAL ( editingFinished ()), this , SLOT ( updateBasicParameter ()));
2012-12-11 18:05:05 +00:00
connect ( _ui -> doubleSpinBox_similarityThreshold_2 , SIGNAL ( editingFinished ()), this , SLOT ( updateBasicParameter ()));
2013-12-11 00:12:44 +00:00
connect ( _ui -> general_doubleSpinBox_detectionRate_2 , SIGNAL ( editingFinished ()), this , SLOT ( updateBasicParameter ()));
2012-06-24 17:19:34 +00:00
connect ( _ui -> general_spinBox_imagesBufferSize_2 , SIGNAL ( editingFinished ()), this , SLOT ( updateBasicParameter ()));
connect ( _ui -> general_spinBox_maxStMemSize_2 , SIGNAL ( editingFinished ()), this , SLOT ( updateBasicParameter ()));
2014-10-18 13:12:45 +00:00
connect ( _ui -> groupBox_publishing , SIGNAL ( clicked ( bool )), this , SLOT ( updateBasicParameter ()));
2012-06-24 17:19:34 +00:00
connect ( _ui -> general_checkBox_publishStats_2 , SIGNAL ( stateChanged ( int )), this , SLOT ( updateBasicParameter ()));
2013-12-11 00:12:44 +00:00
connect ( _ui -> general_checkBox_activateRGBD , SIGNAL ( stateChanged ( int )), this , SLOT ( updateBasicParameter ()));
connect ( _ui -> general_checkBox_activateRGBD_2 , SIGNAL ( stateChanged ( int )), this , SLOT ( updateBasicParameter ()));
connect ( _ui -> general_checkBox_SLAM_mode , SIGNAL ( stateChanged ( int )), this , SLOT ( updateBasicParameter ()));
connect ( _ui -> general_checkBox_SLAM_mode_2 , SIGNAL ( stateChanged ( int )), this , SLOT ( updateBasicParameter ()));
2012-06-24 17:19:34 +00:00
2011-06-05 14:45:39 +00:00
// Map objects name with the corresponding parameter key, needed for the addParameter() slots
//Rtabmap
2014-10-18 13:12:45 +00:00
_ui -> groupBox_publishing -> setObjectName ( Parameters :: kRtabmapPublishStats (). c_str ());
2014-10-26 21:47:29 +00:00
_ui -> general_checkBox_publishRawData -> setObjectName ( Parameters :: kRtabmapPublishLastSignature (). c_str ());
2012-03-03 01:46:30 +00:00
_ui -> general_checkBox_publishPdf -> setObjectName ( Parameters :: kRtabmapPublishPdf (). c_str ());
_ui -> general_checkBox_publishLikelihood -> setObjectName ( Parameters :: kRtabmapPublishLikelihood (). c_str ());
2012-12-11 18:05:05 +00:00
_ui -> general_checkBox_statisticLogsBufferedInRAM -> setObjectName ( Parameters :: kRtabmapStatisticLogsBufferedInRAM (). c_str ());
2014-10-18 13:12:45 +00:00
_ui -> groupBox_statistics -> setObjectName ( Parameters :: kRtabmapStatisticLogged (). c_str ());
_ui -> general_checkBox_statisticLoggedHeaders -> setObjectName ( Parameters :: kRtabmapStatisticLoggedHeaders (). c_str ());
2011-06-05 14:45:39 +00:00
_ui -> general_doubleSpinBox_timeThr -> setObjectName ( Parameters :: kRtabmapTimeThr (). c_str ());
2012-03-03 01:46:30 +00:00
_ui -> general_spinBox_memoryThr -> setObjectName ( Parameters :: kRtabmapMemoryThr (). c_str ());
2013-12-11 00:12:44 +00:00
_ui -> general_doubleSpinBox_detectionRate -> setObjectName ( Parameters :: kRtabmapDetectionRate (). c_str ());
2012-12-11 18:05:05 +00:00
_ui -> general_spinBox_imagesBufferSize -> setObjectName ( Parameters :: kRtabmapImageBufferSize (). c_str ());
2015-06-11 16:57:16 -04:00
_ui -> general_checkBox_createIntermediateNodes -> setObjectName ( Parameters :: kRtabmapCreateIntermediateNodes (). c_str ());
2011-06-05 14:45:39 +00:00
_ui -> general_spinBox_maxRetrieved -> setObjectName ( Parameters :: kRtabmapMaxRetrieved (). c_str ());
2014-10-01 19:52:46 +00:00
_ui -> general_checkBox_startNewMapOnLoopClosure -> setObjectName ( Parameters :: kRtabmapStartNewMapOnLoopClosure (). c_str ());
2011-06-05 14:45:39 +00:00
_ui -> lineEdit_workingDirectory -> setObjectName ( Parameters :: kRtabmapWorkingDirectory (). c_str ());
connect ( _ui -> toolButton_workingDirectory , SIGNAL ( clicked ()), this , SLOT ( changeWorkingDirectory ()));
// Memory
2012-12-11 18:05:05 +00:00
_ui -> general_checkBox_keepRawData -> setObjectName ( Parameters :: kMemImageKept (). c_str ());
2015-01-12 18:23:25 -05:00
_ui -> general_checkBox_keepBinaryData -> setObjectName ( Parameters :: kMemBinDataKept (). c_str ());
2016-02-15 19:35:24 -05:00
_ui -> general_checkBox_keepDescriptors -> setObjectName ( Parameters :: kMemRawDescriptorsKept (). c_str ());
2015-08-27 17:16:12 -04:00
_ui -> general_checkBox_saveDepth16bits -> setObjectName ( Parameters :: kMemSaveDepth16Format (). c_str ());
2015-10-24 17:03:44 -04:00
_ui -> general_checkBox_reduceGraph -> setObjectName ( Parameters :: kMemReduceGraph (). c_str ());
2015-04-17 18:30:12 -04:00
_ui -> general_checkBox_keepNotLinkedNodes -> setObjectName ( Parameters :: kMemNotLinkedNodesKept (). c_str ());
2012-12-11 18:05:05 +00:00
_ui -> general_spinBox_maxStMemSize -> setObjectName ( Parameters :: kMemSTMSize (). c_str ());
_ui -> doubleSpinBox_similarityThreshold -> setObjectName ( Parameters :: kMemRehearsalSimilarity (). c_str ());
2013-12-11 00:12:44 +00:00
_ui -> general_checkBox_SLAM_mode -> setObjectName ( Parameters :: kMemIncrementalMemory (). c_str ());
2011-06-05 14:45:39 +00:00
_ui -> general_doubleSpinBox_recentWmRatio -> setObjectName ( Parameters :: kMemRecentWmRatio (). c_str ());
2015-03-09 15:25:51 -04:00
_ui -> general_checkBox_transferSortingByWeightId -> setObjectName ( Parameters :: kMemTransferSortingByWeightId (). c_str ());
2013-01-27 04:50:49 +00:00
_ui -> general_checkBox_RehearsalIdUpdatedToNewOne -> setObjectName ( Parameters :: kMemRehearsalIdUpdatedToNewOne (). c_str ());
2013-12-11 00:12:44 +00:00
_ui -> general_checkBox_generateIds -> setObjectName ( Parameters :: kMemGenerateIds (). c_str ());
2014-01-15 20:41:58 +00:00
_ui -> general_checkBox_badSignaturesIgnored -> setObjectName ( Parameters :: kMemBadSignaturesIgnored (). c_str ());
2015-11-27 14:57:29 -05:00
_ui -> general_checkBox_createMapLabels -> setObjectName ( Parameters :: kMemMapLabelsAdded (). c_str ());
2014-09-21 21:14:17 +00:00
_ui -> general_checkBox_initWMWithAllNodes -> setObjectName ( Parameters :: kMemInitWMWithAllNodes (). c_str ());
2015-10-13 16:06:19 -04:00
_ui -> checkBox_localSpaceScanMatchingIDsSaved -> setObjectName ( Parameters :: kRGBDScanMatchingIdsSavedInLinks (). c_str ());
2016-04-08 16:15:08 -04:00
_ui -> spinBox_imagePreDecimation -> setObjectName ( Parameters :: kMemImagePreDecimation (). c_str ());
_ui -> spinBox_imagePostDecimation -> setObjectName ( Parameters :: kMemImagePostDecimation (). c_str ());
2015-11-22 18:08:32 -05:00
_ui -> general_spinBox_laserScanDownsample -> setObjectName ( Parameters :: kMemLaserScanDownsampleStepSize (). c_str ());
2016-02-22 17:57:40 -05:00
_ui -> checkBox_useOdomFeatures -> setObjectName ( Parameters :: kMemUseOdomFeatures (). c_str ());
2011-06-05 14:45:39 +00:00
// Database
_ui -> checkBox_dbInMemory -> setObjectName ( Parameters :: kDbSqlite3InMemory (). c_str ());
_ui -> spinBox_dbCacheSize -> setObjectName ( Parameters :: kDbSqlite3CacheSize (). c_str ());
_ui -> comboBox_dbJournalMode -> setObjectName ( Parameters :: kDbSqlite3JournalMode (). c_str ());
2012-03-03 01:46:30 +00:00
_ui -> comboBox_dbSynchronous -> setObjectName ( Parameters :: kDbSqlite3Synchronous (). c_str ());
_ui -> comboBox_dbTempStore -> setObjectName ( Parameters :: kDbSqlite3TempStore (). c_str ());
2011-06-05 14:45:39 +00:00
// Create hypotheses
_ui -> general_doubleSpinBox_hardThr -> setObjectName ( Parameters :: kRtabmapLoopThr (). c_str ());
_ui -> general_doubleSpinBox_loopRatio -> setObjectName ( Parameters :: kRtabmapLoopRatio (). c_str ());
//Bayes
_ui -> general_doubleSpinBox_vp -> setObjectName ( Parameters :: kBayesVirtualPlacePriorThr (). c_str ());
_ui -> lineEdit_bayes_predictionLC -> setObjectName ( Parameters :: kBayesPredictionLC (). c_str ());
2012-12-11 18:05:05 +00:00
_ui -> checkBox_bayes_fullPredictionUpdate -> setObjectName ( Parameters :: kBayesFullPredictionUpdate (). c_str ());
2012-03-03 01:46:30 +00:00
connect ( _ui -> lineEdit_bayes_predictionLC , SIGNAL ( textChanged ( const QString & )), this , SLOT ( updatePredictionPlot ()));
2011-06-05 14:45:39 +00:00
//Keypoint-based
_ui -> comboBox_dictionary_strategy -> setObjectName ( Parameters :: kKpNNStrategy (). c_str ());
_ui -> checkBox_dictionary_incremental -> setObjectName ( Parameters :: kKpIncrementalDictionary (). c_str ());
2015-09-09 00:58:45 -04:00
_ui -> checkBox_kp_incrementalFlann -> setObjectName ( Parameters :: kKpIncrementalFlann (). c_str ());
2011-06-05 14:45:39 +00:00
_ui -> comboBox_detector_strategy -> setObjectName ( Parameters :: kKpDetectorStrategy (). c_str ());
_ui -> surf_doubleSpinBox_nndrRatio -> setObjectName ( Parameters :: kKpNndrRatio (). c_str ());
2014-04-03 19:59:46 +00:00
_ui -> surf_doubleSpinBox_maxDepth -> setObjectName ( Parameters :: kKpMaxDepth (). c_str ());
2015-11-22 18:08:32 -05:00
_ui -> surf_doubleSpinBox_minDepth -> setObjectName ( Parameters :: kKpMinDepth (). c_str ());
2015-12-21 17:27:05 -05:00
_ui -> surf_spinBox_wordsPerImageTarget -> setObjectName ( Parameters :: kKpMaxFeatures (). c_str ());
2011-06-05 14:45:39 +00:00
_ui -> surf_doubleSpinBox_ratioBadSign -> setObjectName ( Parameters :: kKpBadSignRatio (). c_str ());
_ui -> checkBox_kp_tfIdfLikelihoodUsed -> setObjectName ( Parameters :: kKpTfIdfLikelihoodUsed (). c_str ());
_ui -> checkBox_kp_parallelized -> setObjectName ( Parameters :: kKpParallelized (). c_str ());
_ui -> lineEdit_kp_roi -> setObjectName ( Parameters :: kKpRoiRatios (). c_str ());
_ui -> lineEdit_dictionaryPath -> setObjectName ( Parameters :: kKpDictionaryPath (). c_str ());
connect ( _ui -> toolButton_dictionaryPath , SIGNAL ( clicked ()), this , SLOT ( changeDictionaryPath ()));
2014-10-14 21:48:50 +00:00
_ui -> checkBox_kp_newWordsComparedTogether -> setObjectName ( Parameters :: kKpNewWordsComparedTogether (). c_str ());
2015-11-22 18:08:32 -05:00
_ui -> subpix_winSize_kp -> setObjectName ( Parameters :: kKpSubPixWinSize (). c_str ());
_ui -> subpix_iterations_kp -> setObjectName ( Parameters :: kKpSubPixIterations (). c_str ());
_ui -> subpix_eps_kp -> setObjectName ( Parameters :: kKpSubPixEps (). c_str ());
2011-06-05 14:45:39 +00:00
2014-11-04 18:58:40 +00:00
_ui -> subpix_winSize -> setObjectName ( Parameters :: kKpSubPixWinSize (). c_str ());
_ui -> subpix_iterations -> setObjectName ( Parameters :: kKpSubPixIterations (). c_str ());
_ui -> subpix_eps -> setObjectName ( Parameters :: kKpSubPixEps (). c_str ());
2011-06-05 14:45:39 +00:00
//SURF detector
_ui -> surf_doubleSpinBox_hessianThr -> setObjectName ( Parameters :: kSURFHessianThreshold (). c_str ());
_ui -> surf_spinBox_octaves -> setObjectName ( Parameters :: kSURFOctaves (). c_str ());
_ui -> surf_spinBox_octaveLayers -> setObjectName ( Parameters :: kSURFOctaveLayers (). c_str ());
_ui -> checkBox_surfExtended -> setObjectName ( Parameters :: kSURFExtended (). c_str ());
_ui -> surf_checkBox_upright -> setObjectName ( Parameters :: kSURFUpright (). c_str ());
2012-06-24 17:19:34 +00:00
_ui -> surf_checkBox_gpuVersion -> setObjectName ( Parameters :: kSURFGpuVersion (). c_str ());
2014-06-22 03:33:56 +00:00
_ui -> surf_doubleSpinBox_gpuKeypointsRatio -> setObjectName ( Parameters :: kSURFGpuKeypointsRatio (). c_str ());
2011-06-05 14:45:39 +00:00
//SIFT detector
2012-06-24 17:19:34 +00:00
_ui -> sift_spinBox_nFeatures -> setObjectName ( Parameters :: kSIFTNFeatures (). c_str ());
_ui -> sift_spinBox_nOctaveLayers -> setObjectName ( Parameters :: kSIFTNOctaveLayers (). c_str ());
_ui -> sift_doubleSpinBox_contrastThr -> setObjectName ( Parameters :: kSIFTContrastThreshold (). c_str ());
2011-06-05 14:45:39 +00:00
_ui -> sift_doubleSpinBox_edgeThr -> setObjectName ( Parameters :: kSIFTEdgeThreshold (). c_str ());
2012-06-24 17:19:34 +00:00
_ui -> sift_doubleSpinBox_sigma -> setObjectName ( Parameters :: kSIFTSigma (). c_str ());
2011-06-05 14:45:39 +00:00
2014-06-22 03:33:56 +00:00
//BRIEF descriptor
_ui -> briefBytes -> setObjectName ( Parameters :: kBRIEFBytes (). c_str ());
//FAST detector
_ui -> fastSuppressNonMax -> setObjectName ( Parameters :: kFASTNonmaxSuppression (). c_str ());
_ui -> fastThreshold -> setObjectName ( Parameters :: kFASTThreshold (). c_str ());
2015-11-25 19:56:14 -05:00
_ui -> fastThresholdMin -> setObjectName ( Parameters :: kFASTMinThreshold (). c_str ());
_ui -> fastThresholdMax -> setObjectName ( Parameters :: kFASTMaxThreshold (). c_str ());
_ui -> fastGridRows -> setObjectName ( Parameters :: kFASTGridRows (). c_str ());
_ui -> fastGridCols -> setObjectName ( Parameters :: kFASTGridCols (). c_str ());
2014-06-22 03:33:56 +00:00
_ui -> fastGpu -> setObjectName ( Parameters :: kFASTGpu (). c_str ());
_ui -> fastKeypointRatio -> setObjectName ( Parameters :: kFASTGpuKeypointsRatio (). c_str ());
//ORB detector
_ui -> doubleSpinBox_ORBScaleFactor -> setObjectName ( Parameters :: kORBScaleFactor (). c_str ());
_ui -> spinBox_ORBNLevels -> setObjectName ( Parameters :: kORBNLevels (). c_str ());
_ui -> spinBox_ORBEdgeThreshold -> setObjectName ( Parameters :: kORBEdgeThreshold (). c_str ());
_ui -> spinBox_ORBFirstLevel -> setObjectName ( Parameters :: kORBFirstLevel (). c_str ());
_ui -> spinBox_ORBWTA_K -> setObjectName ( Parameters :: kORBWTA_K (). c_str ());
_ui -> spinBox_ORBScoreType -> setObjectName ( Parameters :: kORBScoreType (). c_str ());
_ui -> spinBox_ORBPatchSize -> setObjectName ( Parameters :: kORBPatchSize (). c_str ());
_ui -> checkBox_ORBGpu -> setObjectName ( Parameters :: kORBGpu (). c_str ());
//FREAK descriptor
_ui -> checkBox_FREAKOrientationNormalized -> setObjectName ( Parameters :: kFREAKOrientationNormalized (). c_str ());
_ui -> checkBox_FREAKScaleNormalized -> setObjectName ( Parameters :: kFREAKScaleNormalized (). c_str ());
_ui -> doubleSpinBox_FREAKPatternScale -> setObjectName ( Parameters :: kFREAKPatternScale (). c_str ());
_ui -> spinBox_FREAKNOctaves -> setObjectName ( Parameters :: kFREAKNOctaves (). c_str ());
2014-08-20 23:05:06 +00:00
//GFTT detector
_ui -> doubleSpinBox_GFTT_qualityLevel -> setObjectName ( Parameters :: kGFTTQualityLevel (). c_str ());
_ui -> doubleSpinBox_GFTT_minDistance -> setObjectName ( Parameters :: kGFTTMinDistance (). c_str ());
_ui -> spinBox_GFTT_blockSize -> setObjectName ( Parameters :: kGFTTBlockSize (). c_str ());
_ui -> checkBox_GFTT_useHarrisDetector -> setObjectName ( Parameters :: kGFTTUseHarrisDetector (). c_str ());
_ui -> doubleSpinBox_GFTT_k -> setObjectName ( Parameters :: kGFTTK (). c_str ());
2014-10-06 19:41:45 +00:00
//BRISK
_ui -> spinBox_BRISK_thresh -> setObjectName ( Parameters :: kBRISKThresh (). c_str ());
_ui -> spinBox_BRISK_octaves -> setObjectName ( Parameters :: kBRISKOctaves (). c_str ());
_ui -> doubleSpinBox_BRISK_patterScale -> setObjectName ( Parameters :: kBRISKPatternScale (). c_str ());
2011-06-05 14:45:39 +00:00
// verifyHypotheses
_ui -> comboBox_vh_strategy -> setObjectName ( Parameters :: kRtabmapVhStrategy (). c_str ());
_ui -> surf_spinBox_matchCountMinAccepted -> setObjectName ( Parameters :: kVhEpMatchCountMin (). c_str ());
_ui -> surf_doubleSpinBox_ransacParam1 -> setObjectName ( Parameters :: kVhEpRansacParam1 (). c_str ());
_ui -> surf_doubleSpinBox_ransacParam2 -> setObjectName ( Parameters :: kVhEpRansacParam2 (). c_str ());
2013-12-11 00:12:44 +00:00
// RGB-D SLAM
_ui -> general_checkBox_activateRGBD -> setObjectName ( Parameters :: kRGBDEnabled (). c_str ());
_ui -> rgdb_linearUpdate -> setObjectName ( Parameters :: kRGBDLinearUpdate (). c_str ());
_ui -> rgdb_angularUpdate -> setObjectName ( Parameters :: kRGBDAngularUpdate (). c_str ());
2015-05-03 18:16:55 -04:00
_ui -> rgdb_rehearsalWeightIgnoredWhileMoving -> setObjectName ( Parameters :: kMemRehearsalWeightIgnoredWhileMoving (). c_str ());
2014-02-19 19:00:38 +00:00
_ui -> rgdb_newMapOdomChange -> setObjectName ( Parameters :: kRGBDNewMapOdomChangeDistance (). c_str ());
2015-11-25 12:15:41 -05:00
_ui -> odomScanHistory -> setObjectName ( Parameters :: kRGBDNeighborLinkRefining (). c_str ());
2015-02-20 15:32:39 -05:00
_ui -> spinBox_maxLocalLocationsRetrieved -> setObjectName ( Parameters :: kRGBDMaxLocalRetrieved (). c_str ());
2013-12-11 00:12:44 +00:00
2015-11-27 11:09:39 -05:00
_ui -> graphOptimization_type -> setObjectName ( Parameters :: kOptimizerStrategy (). c_str ());
_ui -> graphOptimization_slam2d -> setObjectName ( Parameters :: kOptimizerSlam2D (). c_str ());
_ui -> graphOptimization_iterations -> setObjectName ( Parameters :: kOptimizerIterations (). c_str ());
_ui -> graphOptimization_covarianceIgnored -> setObjectName ( Parameters :: kOptimizerVarianceIgnored (). c_str ());
2015-03-12 17:00:56 -04:00
_ui -> graphOptimization_fromGraphEnd -> setObjectName ( Parameters :: kRGBDOptimizeFromGraphEnd (). c_str ());
2015-09-03 12:37:14 -04:00
_ui -> graphOptimization_maxError -> setObjectName ( Parameters :: kRGBDOptimizeMaxError (). c_str ());
2015-11-27 11:09:39 -05:00
_ui -> graphOptimization_stopEpsilon -> setObjectName ( Parameters :: kOptimizerEpsilon (). c_str ());
_ui -> graphOptimization_robust -> setObjectName ( Parameters :: kOptimizerRobust (). c_str ());
2015-03-12 17:00:56 -04:00
2016-02-15 19:35:24 -05:00
_ui -> comboBox_g2o_solver -> setObjectName ( Parameters :: kg2oSolver (). c_str ());
_ui -> comboBox_g2o_optimizer -> setObjectName ( Parameters :: kg2oOptimizer (). c_str ());
2016-04-06 15:24:36 -04:00
_ui -> doubleSpinBox_g2o_variance -> setObjectName ( Parameters :: kg2oPixelVariance (). c_str ());
2016-02-15 19:35:24 -05:00
2015-01-30 15:30:57 -05:00
_ui -> graphPlan_goalReachedRadius -> setObjectName ( Parameters :: kRGBDGoalReachedRadius (). c_str ());
2015-04-17 18:30:12 -04:00
_ui -> graphPlan_goalsSavedInUserData -> setObjectName ( Parameters :: kRGBDGoalsSavedInUserData (). c_str ());
2015-09-23 18:15:34 -04:00
_ui -> graphPlan_stuckIterations -> setObjectName ( Parameters :: kRGBDPlanStuckIterations (). c_str ());
2015-10-13 12:50:25 -04:00
_ui -> graphPlan_linearVelocity -> setObjectName ( Parameters :: kRGBDPlanLinearVelocity (). c_str ());
_ui -> graphPlan_angularVelocity -> setObjectName ( Parameters :: kRGBDPlanAngularVelocity (). c_str ());
2015-01-30 15:30:57 -05:00
2015-11-25 12:15:41 -05:00
_ui -> groupBox_localDetection_time -> setObjectName ( Parameters :: kRGBDProximityByTime (). c_str ());
_ui -> groupBox_localDetection_space -> setObjectName ( Parameters :: kRGBDProximityBySpace (). c_str ());
2015-02-20 15:32:39 -05:00
_ui -> localDetection_radius -> setObjectName ( Parameters :: kRGBDLocalRadius (). c_str ());
2015-11-25 12:15:41 -05:00
_ui -> localDetection_maxDiffID -> setObjectName ( Parameters :: kRGBDProximityMaxGraphDepth (). c_str ());
_ui -> localDetection_pathFilteringRadius -> setObjectName ( Parameters :: kRGBDProximityPathFilteringRadius (). c_str ());
2016-03-02 18:11:19 -05:00
_ui -> localDetection_angle -> setObjectName ( Parameters :: kRGBDProximityAngle (). c_str ());
2015-11-25 12:15:41 -05:00
_ui -> checkBox_localSpacePathOdomPosesUsed -> setObjectName ( Parameters :: kRGBDProximityPathRawPosesUsed (). c_str ());
2015-05-04 16:00:21 -04:00
_ui -> rgdb_localImmunizationRatio -> setObjectName ( Parameters :: kRGBDLocalImmunizationRatio (). c_str ());
2016-03-01 20:47:46 -05:00
_ui -> loopClosure_reextract -> setObjectName ( Parameters :: kRGBDLoopClosureReextractFeatures (). c_str ());
2013-12-11 00:12:44 +00:00
2016-03-01 20:47:46 -05:00
// Registration
_ui -> loopClosure_bowVarianceFromInliersCount -> setObjectName ( Parameters :: kRegVarianceFromInliersCount (). c_str ());
_ui -> comboBox_registrationStrategy -> setObjectName ( Parameters :: kRegStrategy (). c_str ());
_ui -> loopClosure_bowForce2D -> setObjectName ( Parameters :: kRegForce3DoF (). c_str ());
//RegistrationVis
2015-11-22 18:08:32 -05:00
_ui -> loopClosure_bowMinInliers -> setObjectName ( Parameters :: kVisMinInliers (). c_str ());
_ui -> loopClosure_bowInlierDistance -> setObjectName ( Parameters :: kVisInlierDistance (). c_str ());
_ui -> loopClosure_bowIterations -> setObjectName ( Parameters :: kVisIterations (). c_str ());
_ui -> loopClosure_bowRefineIterations -> setObjectName ( Parameters :: kVisRefineIterations (). c_str ());
_ui -> loopClosure_estimationType -> setObjectName ( Parameters :: kVisEstimationType (). c_str ());
2015-06-27 01:43:29 -04:00
connect ( _ui -> loopClosure_estimationType , SIGNAL ( currentIndexChanged ( int )), _ui -> stackedWidget_loopClosureEstimation , SLOT ( setCurrentIndex ( int )));
2015-11-22 18:08:32 -05:00
_ui -> stackedWidget_loopClosureEstimation -> setCurrentIndex ( Parameters :: defaultVisEstimationType ());
2015-12-21 17:27:05 -05:00
_ui -> loopClosure_forwardEst -> setObjectName ( Parameters :: kVisForwardEstOnly (). c_str ());
2015-11-22 18:08:32 -05:00
_ui -> loopClosure_bowEpipolarGeometryVar -> setObjectName ( Parameters :: kVisEpipolarGeometryVar (). c_str ());
_ui -> loopClosure_pnpReprojError -> setObjectName ( Parameters :: kVisPnPReprojError (). c_str ());
_ui -> loopClosure_pnpFlags -> setObjectName ( Parameters :: kVisPnPFlags (). c_str ());
2015-12-22 19:32:52 -05:00
_ui -> loopClosure_pnpRefineIterations -> setObjectName ( Parameters :: kVisPnPRefineIterations (). c_str ());
2015-12-21 17:27:05 -05:00
_ui -> loopClosure_correspondencesType -> setObjectName ( Parameters :: kVisCorType (). c_str ());
connect ( _ui -> loopClosure_correspondencesType , SIGNAL ( currentIndexChanged ( int )), _ui -> stackedWidget_loopClosureCorrespondences , SLOT ( setCurrentIndex ( int )));
_ui -> stackedWidget_loopClosureCorrespondences -> setCurrentIndex ( Parameters :: defaultVisCorType ());
_ui -> reextract_nn -> setObjectName ( Parameters :: kVisCorNNType (). c_str ());
_ui -> reextract_nndrRatio -> setObjectName ( Parameters :: kVisCorNNDR (). c_str ());
2016-02-22 16:13:14 -05:00
_ui -> spinBox_visCorGuessWinSize -> setObjectName ( Parameters :: kVisCorGuessWinSize (). c_str ());
2015-11-22 18:08:32 -05:00
_ui -> reextract_type -> setObjectName ( Parameters :: kVisFeatureType (). c_str ());
_ui -> reextract_maxFeatures -> setObjectName ( Parameters :: kVisMaxFeatures (). c_str ());
_ui -> loopClosure_bowMaxDepth -> setObjectName ( Parameters :: kVisMaxDepth (). c_str ());
_ui -> loopClosure_bowMinDepth -> setObjectName ( Parameters :: kVisMinDepth (). c_str ());
_ui -> loopClosure_roi -> setObjectName ( Parameters :: kVisRoiRatios (). c_str ());
_ui -> subpix_winSize -> setObjectName ( Parameters :: kVisSubPixWinSize (). c_str ());
_ui -> subpix_iterations -> setObjectName ( Parameters :: kVisSubPixIterations (). c_str ());
_ui -> subpix_eps -> setObjectName ( Parameters :: kVisSubPixEps (). c_str ());
2016-03-01 20:47:46 -05:00
_ui -> odom_flow_winSize_2 -> setObjectName ( Parameters :: kVisCorFlowWinSize (). c_str ());
_ui -> odom_flow_maxLevel_2 -> setObjectName ( Parameters :: kVisCorFlowMaxLevel (). c_str ());
_ui -> odom_flow_iterations_2 -> setObjectName ( Parameters :: kVisCorFlowIterations (). c_str ());
_ui -> odom_flow_eps_2 -> setObjectName ( Parameters :: kVisCorFlowEps (). c_str ());
2013-12-11 00:12:44 +00:00
2016-03-01 20:47:46 -05:00
//RegistrationIcp
2015-11-22 18:08:32 -05:00
_ui -> globalDetection_icpMaxTranslation -> setObjectName ( Parameters :: kIcpMaxTranslation (). c_str ());
_ui -> globalDetection_icpMaxRotation -> setObjectName ( Parameters :: kIcpMaxRotation (). c_str ());
_ui -> loopClosure_icpVoxelSize -> setObjectName ( Parameters :: kIcpVoxelSize (). c_str ());
_ui -> loopClosure_icpDownsamplingStep -> setObjectName ( Parameters :: kIcpDownsamplingStep (). c_str ());
_ui -> loopClosure_icpMaxCorrespondenceDistance -> setObjectName ( Parameters :: kIcpMaxCorrespondenceDistance (). c_str ());
_ui -> loopClosure_icpIterations -> setObjectName ( Parameters :: kIcpIterations (). c_str ());
2016-01-12 11:37:50 -05:00
_ui -> loopClosure_icpEpsilon -> setObjectName ( Parameters :: kIcpEpsilon (). c_str ());
2015-11-22 18:08:32 -05:00
_ui -> loopClosure_icpRatio -> setObjectName ( Parameters :: kIcpCorrespondenceRatio (). c_str ());
_ui -> loopClosure_icpPointToPlane -> setObjectName ( Parameters :: kIcpPointToPlane (). c_str ());
_ui -> loopClosure_icpPointToPlaneNormals -> setObjectName ( Parameters :: kIcpPointToPlaneNormalNeighbors (). c_str ());
2015-02-24 16:06:02 -05:00
2013-12-11 00:12:44 +00:00
//Odometry
2014-10-13 19:10:22 +00:00
_ui -> odom_strategy -> setObjectName ( Parameters :: kOdomStrategy (). c_str ());
2015-12-22 19:32:52 -05:00
connect ( _ui -> odom_strategy , SIGNAL ( currentIndexChanged ( int )), _ui -> stackedWidget_odometryType , SLOT ( setCurrentIndex ( int )));
_ui -> odom_strategy -> setCurrentIndex ( Parameters :: defaultOdomStrategy ());
2013-12-11 00:12:44 +00:00
_ui -> odom_countdown -> setObjectName ( Parameters :: kOdomResetCountdown (). c_str ());
2015-06-15 20:53:31 -04:00
_ui -> odom_holonomic -> setObjectName ( Parameters :: kOdomHolonomic (). c_str ());
2014-12-18 16:54:46 -05:00
_ui -> odom_fillInfoData -> setObjectName ( Parameters :: kOdomFillInfoData (). c_str ());
2015-06-11 16:57:16 -04:00
_ui -> odom_dataBufferSize -> setObjectName ( Parameters :: kOdomImageBufferSize (). c_str ());
2016-03-01 20:47:46 -05:00
_ui -> odom_flow_keyframeThr -> setObjectName ( Parameters :: kOdomKeyFrameThr (). c_str ());
2016-03-06 15:11:09 -05:00
_ui -> odom_flow_scanKeyframeThr -> setObjectName ( Parameters :: kOdomScanKeyFrameThr (). c_str ());
2016-03-01 20:47:46 -05:00
_ui -> odom_flow_guessMotion -> setObjectName ( Parameters :: kOdomGuessMotion (). c_str ());
2016-04-08 16:15:08 -04:00
_ui -> odom_imageDecimation -> setObjectName ( Parameters :: kOdomImageDecimation (). c_str ());
2016-06-12 21:45:22 -04:00
_ui -> odom_alignWithGround -> setObjectName ( Parameters :: kOdomAlignWithGround (). c_str ());
2014-10-13 19:10:22 +00:00
2016-02-22 16:13:14 -05:00
//Odometry Frame to Map
_ui -> odom_localHistory -> setObjectName ( Parameters :: kOdomF2MMaxSize (). c_str ());
2016-03-01 20:47:46 -05:00
_ui -> spinBox_odom_f2m_maxNewFeatures -> setObjectName ( Parameters :: kOdomF2MMaxNewFeatures (). c_str ());
2016-03-06 15:11:09 -05:00
_ui -> spinBox_odom_f2m_scanMaxSize -> setObjectName ( Parameters :: kOdomF2MScanMaxSize (). c_str ());
_ui -> doubleSpinBox_odom_f2m_scanRadius -> setObjectName ( Parameters :: kOdomF2MScanSubstractRadius (). c_str ());
2016-02-22 16:13:14 -05:00
_ui -> odom_fixedLocalMapPath -> setObjectName ( Parameters :: kOdomF2MFixedMapPath (). c_str ());
2015-06-25 16:04:42 -04:00
connect ( _ui -> toolButton_odomBowFixedLocalMap , SIGNAL ( clicked ()), this , SLOT ( changeOdomBowFixedLocalMapPath ()));
2014-10-13 19:10:22 +00:00
2015-04-23 22:01:41 -04:00
//Odometry Mono
_ui -> doubleSpinBox_minFlow -> setObjectName ( Parameters :: kOdomMonoInitMinFlow (). c_str ());
_ui -> doubleSpinBox_minInitTranslation -> setObjectName ( Parameters :: kOdomMonoInitMinTranslation (). c_str ());
_ui -> doubleSpinBox_minTranslation -> setObjectName ( Parameters :: kOdomMonoMinTranslation (). c_str ());
_ui -> doubleSpinBox_maxVariance -> setObjectName ( Parameters :: kOdomMonoMaxVariance (). c_str ());
2015-06-11 16:57:16 -04:00
//Odometry particle filter
2015-12-14 16:50:17 -05:00
_ui -> odom_filteringStrategy -> setObjectName ( Parameters :: kOdomFilteringStrategy (). c_str ());
2015-12-21 17:27:05 -05:00
_ui -> stackedWidget_odometryFiltering -> setCurrentIndex ( _ui -> odom_filteringStrategy -> currentIndex ());
connect ( _ui -> odom_filteringStrategy , SIGNAL ( currentIndexChanged ( int )), _ui -> stackedWidget_odometryFiltering , SLOT ( setCurrentIndex ( int )));
2015-06-11 16:57:16 -04:00
_ui -> spinBox_particleSize -> setObjectName ( Parameters :: kOdomParticleSize (). c_str ());
_ui -> doubleSpinBox_particleNoiseT -> setObjectName ( Parameters :: kOdomParticleNoiseT (). c_str ());
_ui -> doubleSpinBox_particleLambdaT -> setObjectName ( Parameters :: kOdomParticleLambdaT (). c_str ());
_ui -> doubleSpinBox_particleNoiseR -> setObjectName ( Parameters :: kOdomParticleNoiseR (). c_str ());
_ui -> doubleSpinBox_particleLambdaR -> setObjectName ( Parameters :: kOdomParticleLambdaR (). c_str ());
2015-12-14 16:50:17 -05:00
//Odometry Kalman filter
_ui -> doubleSpinBox_kalmanProcessNoise -> setObjectName ( Parameters :: kOdomKalmanProcessNoise (). c_str ());
_ui -> doubleSpinBox_kalmanMeasurementNoise -> setObjectName ( Parameters :: kOdomKalmanMeasurementNoise (). c_str ());
2014-10-16 00:14:23 +00:00
//Stereo
2015-12-11 17:44:15 -05:00
_ui -> stereo_winWidth -> setObjectName ( Parameters :: kStereoWinWidth (). c_str ());
_ui -> stereo_winHeight -> setObjectName ( Parameters :: kStereoWinHeight (). c_str ());
_ui -> stereo_maxLevel -> setObjectName ( Parameters :: kStereoMaxLevel (). c_str ());
_ui -> stereo_iterations -> setObjectName ( Parameters :: kStereoIterations (). c_str ());
_ui -> stereo_minDisparity -> setObjectName ( Parameters :: kStereoMinDisparity (). c_str ());
_ui -> stereo_maxDisparity -> setObjectName ( Parameters :: kStereoMaxDisparity (). c_str ());
_ui -> stereo_ssd -> setObjectName ( Parameters :: kStereoSSD (). c_str ());
2014-11-04 18:58:40 +00:00
_ui -> stereo_flow_eps -> setObjectName ( Parameters :: kStereoEps (). c_str ());
2015-12-11 17:44:15 -05:00
_ui -> stereo_opticalFlow -> setObjectName ( Parameters :: kStereoOpticalFlow (). c_str ());
2014-11-04 18:58:40 +00:00
2015-12-11 17:44:15 -05:00
//StereoBM
_ui -> stereobm_blockSize -> setObjectName ( Parameters :: kStereoBMBlockSize (). c_str ());
_ui -> stereobm_minDisparity -> setObjectName ( Parameters :: kStereoBMMinDisparity (). c_str ());
_ui -> stereobm_numDisparities -> setObjectName ( Parameters :: kStereoBMNumDisparities (). c_str ());
_ui -> stereobm_preFilterCap -> setObjectName ( Parameters :: kStereoBMPreFilterCap (). c_str ());
_ui -> stereobm_preFilterSize -> setObjectName ( Parameters :: kStereoBMPreFilterSize (). c_str ());
_ui -> stereobm_speckleRange -> setObjectName ( Parameters :: kStereoBMSpeckleRange (). c_str ());
_ui -> stereobm_speckleWinSize -> setObjectName ( Parameters :: kStereoBMSpeckleWindowSize (). c_str ());
_ui -> stereobm_tetureThreshold -> setObjectName ( Parameters :: kStereoBMTextureThreshold (). c_str ());
_ui -> stereobm_uniquessRatio -> setObjectName ( Parameters :: kStereoBMUniquenessRatio (). c_str ());
2016-02-15 19:35:24 -05:00
// reset default settings for the gui
resetSettings ( _ui -> groupBox_generalSettingsGui0 );
resetSettings ( _ui -> groupBox_cloudRendering1 );
resetSettings ( _ui -> groupBox_logging1 );
resetSettings ( _ui -> groupBox_source0 );
2014-10-16 00:14:23 +00:00
2011-06-05 14:45:39 +00:00
setupSignals ();
// custom signals
connect ( _ui -> doubleSpinBox_kp_roi0 , SIGNAL ( valueChanged ( double )), this , SLOT ( updateKpROI ()));
connect ( _ui -> doubleSpinBox_kp_roi1 , SIGNAL ( valueChanged ( double )), this , SLOT ( updateKpROI ()));
connect ( _ui -> doubleSpinBox_kp_roi2 , SIGNAL ( valueChanged ( double )), this , SLOT ( updateKpROI ()));
connect ( _ui -> doubleSpinBox_kp_roi3 , SIGNAL ( valueChanged ( double )), this , SLOT ( updateKpROI ()));
2016-02-15 19:35:24 -05:00
connect ( _ui -> graphOptimization_type , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( updateG2oVisibility ()));
2016-02-22 17:57:40 -05:00
connect ( _ui -> checkBox_useOdomFeatures , SIGNAL ( toggled ( bool )), this , SLOT ( useOdomFeatures ()));
2011-06-05 14:45:39 +00:00
//Create a model from the stacked widgets
// This will add all parameters to the parameters Map
_ui -> stackedWidget -> setCurrentIndex ( 0 );
this -> setupTreeView ();
_obsoletePanels = kPanelAll ;
}
PreferencesDialog ::~ PreferencesDialog () {
2015-02-13 16:50:32 -05:00
// remove tmp ini file
QFile :: remove ( getTmpIniFilePath ());
2011-06-05 14:45:39 +00:00
delete _ui ;
}
2011-06-09 12:51:13 +00:00
void PreferencesDialog :: init ()
{
2015-11-22 18:08:32 -05:00
UDEBUG ( "" );
2014-11-21 23:37:23 +00:00
//First set all default values
const ParametersMap & defaults = Parameters :: getDefaultParameters ();
for ( ParametersMap :: const_iterator iter = defaults . begin (); iter != defaults . end (); ++ iter )
{
this -> setParameter ( iter -> first , iter -> second );
}
2011-06-09 12:51:13 +00:00
this -> readSettings ();
2015-02-13 16:50:32 -05:00
this -> writeSettings ( getTmpIniFilePath ());
2011-06-09 12:51:13 +00:00
_initialized = true ;
}
2015-06-26 18:21:32 -04:00
void PreferencesDialog :: setCurrentPanelToSource ()
{
QList < QGroupBox *> boxes = this -> getGroupBoxes ();
for ( int i = 0 ; i < boxes . size (); ++ i )
{
if ( boxes [ i ] == _ui -> groupBox_source0 )
{
_ui -> stackedWidget -> setCurrentIndex ( i );
_ui -> treeView -> setCurrentIndex ( _indexModel -> index ( i - 2 , 0 ));
break ;
}
}
}
2015-02-13 16:50:32 -05:00
void PreferencesDialog :: saveSettings ()
{
writeSettings ();
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: setupTreeView ()
{
2012-03-03 01:46:30 +00:00
if ( _indexModel )
2011-06-05 14:45:39 +00:00
{
2012-03-03 01:46:30 +00:00
_ui -> treeView -> setModel ( 0 );
delete _indexModel ;
}
_indexModel = new QStandardItemModel ( this );
// Parse the model
QList < QGroupBox *> boxes = this -> getGroupBoxes ();
if ( _ui -> radioButton_basic -> isChecked ())
{
2013-12-11 00:12:44 +00:00
boxes = boxes . mid ( 0 , 5 );
2012-03-03 01:46:30 +00:00
}
else // Advanced
{
2013-12-11 00:12:44 +00:00
boxes . removeAt ( 4 );
2012-03-03 01:46:30 +00:00
}
QStandardItem * parentItem = _indexModel -> invisibleRootItem ();
int index = 0 ;
this -> parseModel ( boxes , parentItem , 0 , index ); // recursive method
if ( _ui -> radioButton_advanced -> isChecked () && index != _ui -> stackedWidget -> count () - 1 )
{
ULOGGER_ERROR ( "The tree model is not the same size of the stacked widgets...%d vs %d advanced stacks" , index , _ui -> stackedWidget -> count () - 1 );
}
2013-12-11 00:12:44 +00:00
int currentIndex = _ui -> stackedWidget -> currentIndex ();
2012-03-03 01:46:30 +00:00
if ( _ui -> radioButton_basic -> isChecked ())
{
2013-12-11 00:12:44 +00:00
if ( currentIndex >= 4 )
2011-06-05 14:45:39 +00:00
{
2013-12-11 00:12:44 +00:00
_ui -> stackedWidget -> setCurrentIndex ( 4 );
currentIndex = 4 ;
2011-06-05 14:45:39 +00:00
}
}
2012-03-03 01:46:30 +00:00
else // Advanced
2011-06-05 14:45:39 +00:00
{
2013-12-11 00:12:44 +00:00
if ( currentIndex == 4 )
2012-03-03 01:46:30 +00:00
{
2013-12-11 00:12:44 +00:00
_ui -> stackedWidget -> setCurrentIndex ( 5 );
2012-03-03 01:46:30 +00:00
}
2011-06-05 14:45:39 +00:00
}
2012-03-03 01:46:30 +00:00
_ui -> treeView -> setModel ( _indexModel );
2013-12-11 00:12:44 +00:00
if ( currentIndex == 0 ) // GUI
{
_ui -> treeView -> setCurrentIndex ( _indexModel -> index ( 0 , 0 ));
}
else if ( currentIndex == 1 ) //3d rendering
{
_ui -> treeView -> setCurrentIndex ( _indexModel -> index ( 0 , 0 ). child ( 0 , 0 ));
}
else if ( currentIndex == 2 ) // logging
{
_ui -> treeView -> setCurrentIndex ( _indexModel -> index ( 0 , 0 ). child ( 1 , 0 ));
}
else // source, rtabmap
{
_ui -> treeView -> setCurrentIndex ( _indexModel -> index ( currentIndex - 2 , 0 ));
}
2015-12-11 17:44:15 -05:00
_ui -> treeView -> expandToDepth ( 1 );
// should be after setModel()
connect ( _ui -> treeView -> selectionModel (), SIGNAL ( currentChanged ( const QModelIndex & , const QModelIndex & )), this , SLOT ( clicked ( const QModelIndex & , const QModelIndex & )));
2011-06-05 14:45:39 +00:00
}
// recursive...
bool PreferencesDialog :: parseModel ( QList < QGroupBox *> & boxes , QStandardItem * parentItem , int currentLevel , int & absoluteIndex )
{
if ( parentItem == 0 )
{
ULOGGER_ERROR ( "Parent item is null !" );
return false ;
}
QStandardItem * currentItem = 0 ;
while ( absoluteIndex < boxes . size ())
{
2012-03-03 01:46:30 +00:00
QString objectName = boxes . at ( absoluteIndex ) -> objectName ();
2011-06-05 14:45:39 +00:00
QString title = boxes . at ( absoluteIndex ) -> title ();
bool ok = false ;
2012-03-03 01:46:30 +00:00
int lvl = QString ( objectName . at ( objectName . size () - 1 )). toInt ( & ok );
2011-06-05 14:45:39 +00:00
if ( ! ok )
{
2012-03-03 01:46:30 +00:00
ULOGGER_ERROR ( "Error while parsing the first number of the QGroupBox title (%s), the first character must be the number in the hierarchy" , title . toStdString (). c_str ());
2011-06-05 14:45:39 +00:00
return false ;
}
if ( lvl == currentLevel )
{
QStandardItem * item = new QStandardItem ( title );
item -> setData ( absoluteIndex );
currentItem = item ;
//ULOGGER_DEBUG("PreferencesDialog::parseModel() lvl(%d) Added %s", currentLevel, title.toStdString().c_str());
parentItem -> appendRow ( item );
++ absoluteIndex ;
}
else if ( lvl > currentLevel )
{
if ( lvl > currentLevel + 1 )
{
ULOGGER_ERROR ( "Intermediary lvl doesn't exist, lvl %d to %d, indexes %d and %d" , currentLevel , lvl , absoluteIndex - 1 , absoluteIndex );
return false ;
}
else
{
parseModel ( boxes , currentItem , currentLevel + 1 , absoluteIndex ); // recursive
}
}
else
{
return false ;
}
}
return true ;
}
void PreferencesDialog :: setupSignals ()
{
const rtabmap :: ParametersMap & parameters = Parameters :: getDefaultParameters ();
for ( rtabmap :: ParametersMap :: const_iterator iter = parameters . begin (); iter != parameters . end (); ++ iter )
{
2015-04-27 02:43:06 -04:00
QWidget * obj = _ui -> stackedWidget -> findChild < QWidget *> (( * iter ). first . c_str ());
2011-06-05 14:45:39 +00:00
if ( obj )
{
2015-04-27 02:43:06 -04:00
// set tooltip as the parameter name
2015-05-04 16:00:21 -04:00
obj -> setToolTip ( tr ( "%1 (Default= \" %2 \" )" ). arg ( iter -> first . c_str ()). arg ( iter -> second . c_str ()));
2015-04-27 02:43:06 -04:00
2011-06-05 14:45:39 +00:00
QSpinBox * spin = qobject_cast < QSpinBox *> ( obj );
QDoubleSpinBox * doubleSpin = qobject_cast < QDoubleSpinBox *> ( obj );
QComboBox * combo = qobject_cast < QComboBox *> ( obj );
QCheckBox * check = qobject_cast < QCheckBox *> ( obj );
2013-12-11 00:12:44 +00:00
QRadioButton * radio = qobject_cast < QRadioButton *> ( obj );
2011-06-05 14:45:39 +00:00
QLineEdit * lineEdit = qobject_cast < QLineEdit *> ( obj );
2014-01-22 19:49:28 +00:00
QGroupBox * groupBox = qobject_cast < QGroupBox *> ( obj );
2011-06-05 14:45:39 +00:00
if ( spin )
{
connect ( spin , SIGNAL ( valueChanged ( int )), this , SLOT ( addParameter ( int )));
}
else if ( doubleSpin )
{
connect ( doubleSpin , SIGNAL ( valueChanged ( double )), this , SLOT ( addParameter ( double )));
}
else if ( combo )
{
connect ( combo , SIGNAL ( currentIndexChanged ( int )), this , SLOT ( addParameter ( int )));
}
else if ( check )
{
2013-12-11 00:12:44 +00:00
connect ( check , SIGNAL ( toggled ( bool )), this , SLOT ( addParameter ( bool )));
}
else if ( radio )
{
connect ( radio , SIGNAL ( toggled ( bool )), this , SLOT ( addParameter ( bool )));
2011-06-05 14:45:39 +00:00
}
else if ( lineEdit )
{
connect ( lineEdit , SIGNAL ( textChanged ( const QString & )), this , SLOT ( addParameter ( const QString & )));
}
2014-01-22 19:49:28 +00:00
else if ( groupBox )
{
connect ( groupBox , SIGNAL ( clicked ( bool )), this , SLOT ( addParameter ( bool )));
}
2011-06-05 14:45:39 +00:00
else
{
2015-04-27 02:43:06 -04:00
ULOGGER_WARN ( "QWidget called %s can't be cast to a supported widget" , ( * iter ). first . c_str ());
2011-06-05 14:45:39 +00:00
}
}
else
{
2015-04-27 02:43:06 -04:00
ULOGGER_WARN ( "Can't find the related QWidget for parameter %s" , ( * iter ). first . c_str ());
2011-06-05 14:45:39 +00:00
}
}
}
2015-12-11 17:44:15 -05:00
void PreferencesDialog :: clicked ( const QModelIndex & current , const QModelIndex & previous )
2011-06-05 14:45:39 +00:00
{
2015-12-11 17:44:15 -05:00
QStandardItem * item = _indexModel -> itemFromIndex ( current );
2013-01-28 18:13:56 +00:00
if ( item && item -> isEnabled ())
2011-06-05 14:45:39 +00:00
{
2012-03-03 01:46:30 +00:00
int index = item -> data (). toInt ();
2013-12-11 00:12:44 +00:00
if ( _ui -> radioButton_advanced -> isChecked () && index >= 4 )
2012-03-03 01:46:30 +00:00
{
++ index ;
}
_ui -> stackedWidget -> setCurrentIndex ( index );
2012-12-11 18:05:05 +00:00
_ui -> scrollArea -> horizontalScrollBar () -> setValue ( 0 );
_ui -> scrollArea -> verticalScrollBar () -> setValue ( 0 );
2011-06-05 14:45:39 +00:00
}
}
2013-12-11 00:12:44 +00:00
void PreferencesDialog :: closeEvent ( QCloseEvent * event )
{
UDEBUG ( "" );
2016-01-07 19:39:21 -05:00
_modifiedParameters . clear ();
2013-12-11 00:12:44 +00:00
_obsoletePanels = kPanelDummy ;
2015-02-13 16:50:32 -05:00
this -> readGuiSettings ( getTmpIniFilePath ());
this -> readCameraSettings ( getTmpIniFilePath ());
2013-12-11 00:12:44 +00:00
event -> accept ();
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: closeDialog ( QAbstractButton * button )
{
2013-12-11 00:12:44 +00:00
UDEBUG ( "" );
2011-06-05 14:45:39 +00:00
QDialogButtonBox :: ButtonRole role = _ui -> buttonBox_global -> buttonRole ( button );
switch ( role )
{
case QDialogButtonBox :: RejectRole :
2016-01-07 19:39:21 -05:00
_modifiedParameters . clear ();
2011-06-05 14:45:39 +00:00
_obsoletePanels = kPanelDummy ;
2015-02-13 16:50:32 -05:00
this -> readGuiSettings ( getTmpIniFilePath ());
this -> readCameraSettings ( getTmpIniFilePath ());
2011-06-05 14:45:39 +00:00
this -> reject ();
break ;
case QDialogButtonBox :: AcceptRole :
2012-06-24 17:19:34 +00:00
updateBasicParameter (); // make that changes without editing finished signal are updated.
2016-01-07 19:39:21 -05:00
if (( _obsoletePanels & kPanelAll ) || _modifiedParameters . size ())
2011-06-05 14:45:39 +00:00
{
if ( validateForm ())
{
2015-02-13 16:50:32 -05:00
writeSettings ( getTmpIniFilePath ());
2011-06-05 14:45:39 +00:00
this -> accept ();
}
}
else
{
this -> accept ();
}
break ;
default :
break ;
}
}
void PreferencesDialog :: resetApply ( QAbstractButton * button )
{
QDialogButtonBox :: ButtonRole role = _ui -> buttonBox_local -> buttonRole ( button );
switch ( role )
{
case QDialogButtonBox :: ApplyRole :
2012-06-24 17:19:34 +00:00
updateBasicParameter (); // make that changes without editing finished signal are updated.
2011-06-05 14:45:39 +00:00
if ( validateForm ())
{
2015-02-13 16:50:32 -05:00
writeSettings ( getTmpIniFilePath ());
2011-06-05 14:45:39 +00:00
}
break ;
case QDialogButtonBox :: ResetRole :
resetSettings ( _ui -> stackedWidget -> currentIndex ());
break ;
default :
break ;
}
}
2013-12-11 00:12:44 +00:00
void PreferencesDialog :: resetSettings ( QGroupBox * groupBox )
{
if ( groupBox -> objectName () == _ui -> groupBox_generalSettingsGui0 -> objectName ())
{
_ui -> general_checkBox_imagesKept -> setChecked ( true );
2016-06-12 17:53:35 -04:00
_ui -> general_checkBox_cloudsKept -> setChecked ( true );
2013-12-11 00:12:44 +00:00
_ui -> checkBox_beep -> setChecked ( false );
2015-05-05 17:38:38 -04:00
_ui -> checkBox_notifyWhenNewGlobalPathIsReceived -> setChecked ( false );
2014-06-05 18:56:15 +00:00
_ui -> checkBox_verticalLayoutUsed -> setChecked ( true );
2013-12-11 00:12:44 +00:00
_ui -> checkBox_imageRejectedShown -> setChecked ( true );
_ui -> checkBox_imageHighestHypShown -> setChecked ( false );
2014-06-06 18:06:49 +00:00
_ui -> spinBox_odomQualityWarnThr -> setValue ( 50 );
2015-01-07 17:30:20 -05:00
_ui -> checkBox_posteriorGraphView -> setChecked ( true );
2013-12-11 00:12:44 +00:00
}
else if ( groupBox -> objectName () == _ui -> groupBox_cloudRendering1 -> objectName ())
{
2014-07-29 00:52:35 +00:00
for ( int i = 0 ; i < 2 ; ++ i )
2013-12-11 00:12:44 +00:00
{
_3dRenderingShowClouds [ i ] -> setChecked ( true );
2016-05-26 12:13:59 -04:00
_3dRenderingDecimation [ i ] -> setValue ( 4 );
2015-10-21 09:27:25 -04:00
_3dRenderingMaxDepth [ i ] -> setValue ( 0.0 );
2016-04-12 15:14:04 -04:00
_3dRenderingMinDepth [ i ] -> setValue ( 0.0 );
2013-12-11 00:12:44 +00:00
_3dRenderingShowScans [ i ] -> setChecked ( true );
2016-03-10 09:07:44 -05:00
_3dRenderingShowFeatures [ i ] -> setChecked ( i == 0 ? false : true );
2013-12-11 00:12:44 +00:00
2016-01-08 19:15:49 -05:00
_3dRenderingDownsamplingScan [ i ] -> setValue ( 1 );
2015-11-22 18:08:32 -05:00
_3dRenderingVoxelSizeScan [ i ] -> setValue ( 0.0 );
2016-02-15 19:35:24 -05:00
_3dRenderingOpacity [ i ] -> setValue ( i == 0 ? 1.0 : 0.75 );
2015-08-24 16:06:08 -04:00
_3dRenderingPtSize [ i ] -> setValue ( 2 );
_3dRenderingOpacityScan [ i ] -> setValue ( i == 0 ? 1.0 : 0.5 );
_3dRenderingPtSizeScan [ i ] -> setValue ( 2 );
2016-03-01 17:33:27 -05:00
_3dRenderingPtSizeFeatures [ i ] -> setValue ( 3 );
2013-12-11 00:12:44 +00:00
}
2016-06-10 20:12:13 -04:00
_ui -> doubleSpinBox_voxel -> setValue ( 0 );
_ui -> doubleSpinBox_noiseRadius -> setValue ( 0 );
_ui -> spinBox_noiseMinNeighbors -> setValue ( 5 );
2014-10-30 19:38:58 +00:00
_ui -> checkBox_showGraphs -> setChecked ( true );
2016-02-15 19:35:24 -05:00
_ui -> checkBox_showLabels -> setChecked ( false );
2014-10-30 19:38:58 +00:00
2016-02-15 19:35:24 -05:00
_ui -> radioButton_noFiltering -> setChecked ( true );
_ui -> radioButton_nodeFiltering -> setChecked ( false );
_ui -> radioButton_subtractFiltering -> setChecked ( false );
2014-12-03 22:27:31 -05:00
_ui -> doubleSpinBox_cloudFilterRadius -> setValue ( 0.1 );
2014-02-13 21:32:46 +00:00
_ui -> doubleSpinBox_cloudFilterAngle -> setValue ( 30 );
2016-02-15 19:35:24 -05:00
_ui -> spinBox_subtractFilteringMinPts -> setValue ( 5 );
_ui -> doubleSpinBox_subtractFilteringRadius -> setValue ( 0.02 );
2016-06-12 13:51:49 -04:00
_ui -> doubleSpinBox_subtractFilteringAngle -> setValue ( 0 );
_ui -> spinBox_normalKSearch -> setValue ( 10 );
2014-07-29 21:48:37 +00:00
_ui -> checkBox_map_shown -> setChecked ( false );
_ui -> doubleSpinBox_map_resolution -> setValue ( 0.05 );
2015-03-20 14:03:09 -04:00
_ui -> checkBox_map_erode -> setChecked ( false );
2014-07-29 21:48:37 +00:00
_ui -> doubleSpinBox_map_opacity -> setValue ( 0.75 );
2016-06-10 20:12:13 -04:00
_ui -> groupBox_map_occupancyFrom3DCloud -> setChecked ( false );
_ui -> checkBox_projMapFrame -> setChecked ( true );
_ui -> doubleSpinBox_projMaxGroundAngle -> setValue ( 30 );
_ui -> doubleSpinBox_projMaxGroundHeight -> setValue ( 0 );
_ui -> spinBox_projMinClusterSize -> setValue ( 20 );
_ui -> doubleSpinBox_projMaxObstaclesHeight -> setValue ( 0 );
_ui -> checkBox_projFlatObstaclesDetected -> setChecked ( true );
2016-02-15 19:35:24 -05:00
_ui -> doubleSpinBox_mesh_angleTolerance -> setValue ( 15.0 );
2016-02-17 16:01:14 -05:00
#if PCL_VERSION_COMPARE(>=, 1, 7, 2)
2016-03-02 18:11:19 -05:00
_ui -> groupBox_organized -> setChecked ( false );
2016-02-15 19:35:24 -05:00
_ui -> checkBox_mesh_quad -> setChecked ( true );
2016-02-17 16:01:14 -05:00
#else
_ui -> groupBox_organized -> setChecked ( false );
_ui -> checkBox_mesh_quad -> setChecked ( false );
#endif
2016-02-15 19:35:24 -05:00
_ui -> spinBox_mesh_triangleSize -> setValue ( 2 );
2013-12-11 00:12:44 +00:00
}
else if ( groupBox -> objectName () == _ui -> groupBox_logging1 -> objectName ())
{
_ui -> comboBox_loggerLevel -> setCurrentIndex ( 2 );
_ui -> comboBox_loggerEventLevel -> setCurrentIndex ( 3 );
_ui -> comboBox_loggerPauseLevel -> setCurrentIndex ( 3 );
_ui -> checkBox_logger_printTime -> setChecked ( true );
2016-01-05 13:55:21 -05:00
_ui -> checkBox_logger_printThreadId -> setChecked ( false );
2013-12-11 00:12:44 +00:00
_ui -> comboBox_loggerType -> setCurrentIndex ( 1 );
}
else if ( groupBox -> objectName () == _ui -> groupBox_source0 -> objectName ())
{
2015-06-26 18:21:32 -04:00
_ui -> general_doubleSpinBox_imgRate -> setValue ( 0.0 );
2015-02-28 18:09:22 -05:00
_ui -> source_mirroring -> setChecked ( false );
2015-11-22 18:08:32 -05:00
_ui -> lineEdit_calibrationFile -> clear ();
2015-06-26 18:21:32 -04:00
_ui -> comboBox_sourceType -> setCurrentIndex ( kSrcRGBD );
_ui -> lineEdit_sourceDevice -> setText ( "" );
2015-11-22 18:08:32 -05:00
_ui -> lineEdit_sourceLocalTransform -> setText ( "0 0 1 -1 0 0 0 -1 0" );
2013-12-11 00:12:44 +00:00
2015-06-26 18:21:32 -04:00
_ui -> source_comboBox_image_type -> setCurrentIndex ( kSrcUsbDevice - kSrcUsbDevice );
2015-12-17 14:13:19 -05:00
_ui -> source_images_spinBox_startPos -> setValue ( 0 );
2013-12-11 00:12:44 +00:00
_ui -> source_images_refreshDir -> setChecked ( false );
2015-07-16 14:44:25 -04:00
_ui -> checkBox_rgbImages_rectify -> setChecked ( false );
2016-01-19 17:43:33 -05:00
_ui -> comboBox_cameraImages_bayerMode -> setCurrentIndex ( 0 );
2015-07-16 14:44:25 -04:00
_ui -> checkBox_rgbVideo_rectify -> setChecked ( false );
2013-12-11 00:12:44 +00:00
_ui -> source_checkBox_ignoreOdometry -> setChecked ( false );
2015-11-04 18:31:52 -05:00
_ui -> source_checkBox_ignoreGoalDelay -> setChecked ( true );
_ui -> source_checkBox_ignoreGoals -> setChecked ( true );
2013-12-11 00:12:44 +00:00
_ui -> source_spinBox_databaseStartPos -> setValue ( 0 );
2015-07-06 17:46:05 -04:00
_ui -> source_checkBox_useDbStamps -> setChecked ( true );
2013-12-11 00:12:44 +00:00
2015-02-20 15:32:39 -05:00
#ifdef _WIN32
2015-07-06 17:25:38 -04:00
_ui -> comboBox_cameraRGBD -> setCurrentIndex ( kSrcOpenNI2 - kSrcRGBD ); // openni2
2015-02-20 15:32:39 -05:00
#else
2015-04-06 00:28:04 -04:00
if ( CameraFreenect :: available ())
{
2015-07-06 17:25:38 -04:00
_ui -> comboBox_cameraRGBD -> setCurrentIndex ( kSrcFreenect - kSrcRGBD ); // freenect
2015-04-06 00:28:04 -04:00
}
2015-04-07 12:00:10 -04:00
else if ( CameraOpenNI2 :: available ())
{
2015-07-06 17:25:38 -04:00
_ui -> comboBox_cameraRGBD -> setCurrentIndex ( kSrcOpenNI2 - kSrcRGBD ); // openni2
2015-04-07 12:00:10 -04:00
}
2015-04-06 00:28:04 -04:00
else
{
2015-07-06 17:25:38 -04:00
_ui -> comboBox_cameraRGBD -> setCurrentIndex ( kSrcOpenNI_PCL - kSrcRGBD ); // openni-pcl
2015-04-06 00:28:04 -04:00
}
2015-02-20 15:32:39 -05:00
#endif
2015-07-06 17:25:38 -04:00
if ( CameraStereoDC1394 :: available ())
{
_ui -> comboBox_cameraStereo -> setCurrentIndex ( kSrcDC1394 - kSrcStereo ); // dc1394
}
else if ( CameraStereoFlyCapture2 :: available ())
{
_ui -> comboBox_cameraStereo -> setCurrentIndex ( kSrcFlyCapture2 - kSrcStereo ); // flycapture
}
else
{
_ui -> comboBox_cameraStereo -> setCurrentIndex ( kSrcStereoImages - kSrcStereo ); // stereo images
}
2015-06-26 18:21:32 -04:00
_ui -> checkbox_rgbd_colorOnly -> setChecked ( false );
2016-01-08 19:15:49 -05:00
_ui -> spinBox_source_imageDecimation -> setValue ( 1 );
2015-08-27 17:16:12 -04:00
_ui -> checkbox_stereo_depthGenerated -> setChecked ( false );
2014-11-20 22:00:47 +00:00
_ui -> openni2_autoWhiteBalance -> setChecked ( true );
_ui -> openni2_autoExposure -> setChecked ( true );
_ui -> openni2_exposure -> setValue ( 0 );
_ui -> openni2_gain -> setValue ( 100 );
2015-02-20 15:32:39 -05:00
_ui -> openni2_mirroring -> setChecked ( false );
2015-10-15 16:40:49 -04:00
_ui -> openni2_stampsIdsUsed -> setChecked ( false );
2015-05-05 18:21:43 -04:00
_ui -> comboBox_freenect2Format -> setCurrentIndex ( 0 );
2015-11-04 18:31:52 -05:00
_ui -> doubleSpinBox_freenect2MinDepth -> setValue ( 0.3 );
_ui -> doubleSpinBox_freenect2MaxDepth -> setValue ( 12.0 );
_ui -> checkBox_freenect2BilateralFiltering -> setChecked ( true );
_ui -> checkBox_freenect2EdgeAwareFiltering -> setChecked ( true );
_ui -> checkBox_freenect2NoiseFiltering -> setChecked ( true );
2015-06-26 18:21:32 -04:00
_ui -> lineEdit_openniOniPath -> clear ();
_ui -> lineEdit_openni2OniPath -> clear ();
2015-07-30 14:17:29 -04:00
_ui -> lineEdit_cameraRGBDImages_path_rgb -> setText ( "" );
_ui -> lineEdit_cameraRGBDImages_path_depth -> setText ( "" );
_ui -> doubleSpinBox_cameraRGBDImages_scale -> setValue ( 1.0 );
2015-06-26 18:21:32 -04:00
_ui -> source_comboBox_image_type -> setCurrentIndex ( kSrcDC1394 - kSrcDC1394 );
2015-07-30 14:17:29 -04:00
_ui -> lineEdit_cameraStereoImages_path_left -> setText ( "" );
_ui -> lineEdit_cameraStereoImages_path_right -> setText ( "" );
2015-07-16 14:44:25 -04:00
_ui -> checkBox_stereoImages_rectify -> setChecked ( false );
_ui -> lineEdit_cameraStereoVideo_path -> setText ( "" );
_ui -> checkBox_stereoVideo_rectify -> setChecked ( false );
2016-06-02 17:27:12 -04:00
_ui -> comboBox_stereoZed_resolution -> setCurrentIndex ( 2 );
_ui -> comboBox_stereoZed_quality -> setCurrentIndex ( 1 );
_ui -> comboBox_stereoZed_sensingMode -> setCurrentIndex ( 1 );
_ui -> spinBox_stereoZed_confidenceThr -> setValue ( 100 );
_ui -> lineEdit_zedSvoPath -> clear ();
2016-01-06 17:26:55 -05:00
_ui -> checkBox_cameraImages_timestamps -> setChecked ( false );
2016-01-13 18:13:44 -05:00
_ui -> checkBox_cameraImages_syncTimeStamps -> setChecked ( true );
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_timestamps -> setText ( "" );
_ui -> lineEdit_cameraImages_path_scans -> setText ( "" );
_ui -> lineEdit_cameraImages_laser_transform -> setText ( "0 0 0 0 0 0" );
_ui -> spinBox_cameraImages_max_scan_pts -> setValue ( 0 );
2016-01-08 19:15:49 -05:00
_ui -> spinBox_cameraImages_scanDownsampleStep -> setValue ( 1 );
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> setValue ( 0.0f );
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_gt -> setText ( "" );
_ui -> comboBox_cameraImages_gtFormat -> setCurrentIndex ( 0 );
_ui -> groupBox_scanFromDepth -> setChecked ( false );
_ui -> spinBox_cameraScanFromDepth_decimation -> setValue ( 8 );
_ui -> doubleSpinBox_cameraSCanFromDepth_maxDepth -> setValue ( 4.0 );
2016-03-11 16:54:54 -05:00
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> setValue ( 0.025f );
_ui -> spinBox_cameraImages_scanNormalsK -> setValue ( 20 );
2016-01-11 17:21:06 -05:00
_ui -> groupBox_depthFromScan -> setChecked ( false );
2016-03-10 12:31:22 -05:00
_ui -> groupBox_depthFromScan_fillHoles -> setChecked ( true );
_ui -> radioButton_depthFromScan_vertical -> setChecked ( true );
_ui -> radioButton_depthFromScan_horizontal -> setChecked ( false );
2016-01-11 17:21:06 -05:00
_ui -> checkBox_depthFromScan_fillBorders -> setChecked ( false );
2013-12-11 00:12:44 +00:00
}
else if ( groupBox -> objectName () == _ui -> groupBox_rtabmap_basic0 -> objectName ())
{
_ui -> general_doubleSpinBox_timeThr_2 -> setValue ( Parameters :: defaultRtabmapTimeThr ());
_ui -> general_doubleSpinBox_hardThr_2 -> setValue ( Parameters :: defaultRtabmapLoopThr ());
_ui -> doubleSpinBox_similarityThreshold_2 -> setValue ( Parameters :: defaultMemRehearsalSimilarity ());
_ui -> general_spinBox_imagesBufferSize_2 -> setValue ( Parameters :: defaultRtabmapImageBufferSize ());
_ui -> general_spinBox_maxStMemSize_2 -> setValue ( Parameters :: defaultMemSTMSize ());
_ui -> general_checkBox_publishStats_2 -> setChecked ( Parameters :: defaultRtabmapPublishStats ());
_ui -> general_checkBox_activateRGBD_2 -> setChecked ( Parameters :: defaultRGBDEnabled ());
_ui -> general_checkBox_SLAM_mode_2 -> setChecked ( Parameters :: defaultMemIncrementalMemory ());
_ui -> general_doubleSpinBox_detectionRate_2 -> setValue ( Parameters :: defaultRtabmapDetectionRate ());
// match the advanced (spin and doubleSpin boxes)
_ui -> general_doubleSpinBox_timeThr -> setValue ( Parameters :: defaultRtabmapTimeThr ());
_ui -> general_doubleSpinBox_hardThr -> setValue ( Parameters :: defaultRtabmapLoopThr ());
_ui -> doubleSpinBox_similarityThreshold -> setValue ( Parameters :: defaultMemRehearsalSimilarity ());
_ui -> general_spinBox_imagesBufferSize -> setValue ( Parameters :: defaultRtabmapImageBufferSize ());
_ui -> general_spinBox_maxStMemSize -> setValue ( Parameters :: defaultMemSTMSize ());
_ui -> general_doubleSpinBox_detectionRate -> setValue ( Parameters :: defaultRtabmapDetectionRate ());
}
else
{
QObjectList children = groupBox -> children ();
rtabmap :: ParametersMap defaults = Parameters :: getDefaultParameters ();
std :: string key ;
for ( int i = 0 ; i < children . size (); ++ i )
{
key = children . at ( i ) -> objectName (). toStdString ();
if ( uContains ( defaults , key ))
{
2016-02-15 19:35:24 -05:00
if ( key . compare ( Parameters :: kRtabmapWorkingDirectory (). c_str ()) == 0 )
{
this -> setParameter ( key , Parameters :: createDefaultWorkingDirectory ());
}
else
{
this -> setParameter ( key , defaults . at ( key ));
}
2015-01-07 17:51:15 -05:00
if ( qobject_cast < const QGroupBox *> ( children . at ( i )))
{
this -> resetSettings (( QGroupBox * ) children . at ( i ));
}
2013-12-11 00:12:44 +00:00
}
else if ( qobject_cast < const QGroupBox *> ( children . at ( i )))
{
this -> resetSettings (( QGroupBox * ) children . at ( i ));
}
2014-06-22 03:33:56 +00:00
else if ( qobject_cast < const QStackedWidget *> ( children . at ( i )))
{
QStackedWidget * stackedWidget = ( QStackedWidget * ) children . at ( i );
for ( int j = 0 ; j < stackedWidget -> count (); ++ j )
{
const QObjectList & children2 = stackedWidget -> widget ( j ) -> children ();
for ( int k = 0 ; k < children2 . size (); ++ k )
{
if ( qobject_cast < QGroupBox *> ( children2 . at ( k )))
{
this -> resetSettings (( QGroupBox * ) children2 . at ( k ));
}
}
}
}
2013-12-11 00:12:44 +00:00
}
if ( groupBox -> findChild < QLineEdit *> ( _ui -> lineEdit_kp_roi -> objectName ()))
{
this -> setupKpRoiPanel ();
}
}
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: resetSettings ( int panelNumber )
{
QList < QGroupBox *> boxes = this -> getGroupBoxes ();
if ( panelNumber >= 0 && panelNumber < boxes . size ())
{
2013-12-11 00:12:44 +00:00
this -> resetSettings ( boxes . at ( panelNumber ));
2011-06-05 14:45:39 +00:00
}
2014-01-22 19:49:28 +00:00
else if ( panelNumber == - 1 )
{
for ( QList < QGroupBox *>:: iterator iter = boxes . begin (); iter != boxes . end (); ++ iter )
{
this -> resetSettings ( * iter );
}
}
2011-06-05 14:45:39 +00:00
else
{
ULOGGER_WARN ( "panel number and the number of stacked widget doesn't match" );
}
}
2013-12-11 00:12:44 +00:00
QString PreferencesDialog :: getWorkingDirectory () const
2011-06-05 14:45:39 +00:00
{
return _ui -> lineEdit_workingDirectory -> text ();
}
2013-12-11 00:12:44 +00:00
QString PreferencesDialog :: getIniFilePath () const
2011-06-05 14:45:39 +00:00
{
2013-01-10 20:29:01 +00:00
QString privatePath = QDir :: homePath () + "/.rtabmap" ;
if ( ! QDir ( privatePath ). exists ())
{
QDir :: home (). mkdir ( ".rtabmap" );
}
return privatePath + "/rtabmap.ini" ;
2011-06-05 14:45:39 +00:00
}
2015-02-13 16:50:32 -05:00
QString PreferencesDialog :: getTmpIniFilePath () const
{
return getIniFilePath () + ".tmp" ;
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: loadConfigFrom ()
{
2014-01-22 19:49:28 +00:00
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Load settings..." ), this -> getWorkingDirectory (), "*.ini" );
2011-06-05 14:45:39 +00:00
if ( ! path . isEmpty ())
{
2016-06-12 17:53:35 -04:00
_ui -> checkBox_useOdomFeatures -> blockSignals ( true );
2011-06-05 14:45:39 +00:00
this -> readSettings ( path );
2016-06-12 17:53:35 -04:00
_ui -> checkBox_useOdomFeatures -> blockSignals ( false );
2011-06-05 14:45:39 +00:00
}
}
void PreferencesDialog :: readSettings ( const QString & filePath )
{
2015-11-22 18:08:32 -05:00
ULOGGER_DEBUG ( "%s" , filePath . toStdString (). c_str ());
2011-06-05 14:45:39 +00:00
readGuiSettings ( filePath );
readCameraSettings ( filePath );
2012-06-26 14:57:31 +00:00
if ( ! readCoreSettings ( filePath ))
{
2016-01-07 19:39:21 -05:00
_modifiedParameters . clear ();
2012-06-26 14:57:31 +00:00
_obsoletePanels = kPanelDummy ;
2013-01-28 18:13:56 +00:00
// only keep GUI settings
QStandardItem * parentItem = _indexModel -> invisibleRootItem ();
if ( parentItem )
{
for ( int i = 1 ; i < parentItem -> rowCount (); ++ i )
{
parentItem -> child ( i ) -> setEnabled ( false );
}
}
_ui -> radioButton_basic -> setEnabled ( false );
_ui -> radioButton_advanced -> setEnabled ( false );
}
else
{
// enable settings
QStandardItem * parentItem = _indexModel -> invisibleRootItem ();
if ( parentItem )
{
for ( int i = 0 ; i < parentItem -> rowCount (); ++ i )
{
parentItem -> child ( i ) -> setEnabled ( true );
}
}
_ui -> radioButton_basic -> setEnabled ( true );
_ui -> radioButton_advanced -> setEnabled ( true );
2012-06-26 14:57:31 +00:00
}
2011-06-05 14:45:39 +00:00
}
void PreferencesDialog :: readGuiSettings ( const QString & filePath )
{
QString path = getIniFilePath ();
if ( ! filePath . isEmpty ())
{
path = filePath ;
}
QSettings settings ( path , QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( "General" );
_ui -> general_checkBox_imagesKept -> setChecked ( settings . value ( "imagesKept" , _ui -> general_checkBox_imagesKept -> isChecked ()). toBool ());
2016-06-12 17:53:35 -04:00
_ui -> general_checkBox_cloudsKept -> setChecked ( settings . value ( "cloudsKept" , _ui -> general_checkBox_cloudsKept -> isChecked ()). toBool ());
2011-06-05 14:45:39 +00:00
_ui -> comboBox_loggerLevel -> setCurrentIndex ( settings . value ( "loggerLevel" , _ui -> comboBox_loggerLevel -> currentIndex ()). toInt ());
_ui -> comboBox_loggerEventLevel -> setCurrentIndex ( settings . value ( "loggerEventLevel" , _ui -> comboBox_loggerEventLevel -> currentIndex ()). toInt ());
_ui -> comboBox_loggerPauseLevel -> setCurrentIndex ( settings . value ( "loggerPauseLevel" , _ui -> comboBox_loggerPauseLevel -> currentIndex ()). toInt ());
_ui -> comboBox_loggerType -> setCurrentIndex ( settings . value ( "loggerType" , _ui -> comboBox_loggerType -> currentIndex ()). toInt ());
_ui -> checkBox_logger_printTime -> setChecked ( settings . value ( "loggerPrintTime" , _ui -> checkBox_logger_printTime -> isChecked ()). toBool ());
2016-01-05 13:55:21 -05:00
_ui -> checkBox_logger_printThreadId -> setChecked ( settings . value ( "loggerPrintThreadId" , _ui -> checkBox_logger_printThreadId -> isChecked ()). toBool ());
2011-06-05 14:45:39 +00:00
_ui -> checkBox_verticalLayoutUsed -> setChecked ( settings . value ( "verticalLayoutUsed" , _ui -> checkBox_verticalLayoutUsed -> isChecked ()). toBool ());
_ui -> checkBox_imageRejectedShown -> setChecked ( settings . value ( "imageRejectedShown" , _ui -> checkBox_imageRejectedShown -> isChecked ()). toBool ());
2011-06-10 14:04:06 +00:00
_ui -> checkBox_imageHighestHypShown -> setChecked ( settings . value ( "imageHighestHypShown" , _ui -> checkBox_imageHighestHypShown -> isChecked ()). toBool ());
2011-06-05 14:45:39 +00:00
_ui -> checkBox_beep -> setChecked ( settings . value ( "beep" , _ui -> checkBox_beep -> isChecked ()). toBool ());
2015-05-05 17:38:38 -04:00
_ui -> checkBox_notifyWhenNewGlobalPathIsReceived -> setChecked ( settings . value ( "notifyNewGlobalPath" , _ui -> checkBox_notifyWhenNewGlobalPathIsReceived -> isChecked ()). toBool ());
2014-09-25 17:37:11 +00:00
_ui -> spinBox_odomQualityWarnThr -> setValue ( settings . value ( "odomQualityThr" , _ui -> spinBox_odomQualityWarnThr -> value ()). toInt ());
2015-01-07 17:30:20 -05:00
_ui -> checkBox_posteriorGraphView -> setChecked ( settings . value ( "posteriorGraphView" , _ui -> checkBox_posteriorGraphView -> isChecked ()). toBool ());
2011-06-05 14:45:39 +00:00
2014-07-29 00:52:35 +00:00
for ( int i = 0 ; i < 2 ; ++ i )
2013-12-11 00:12:44 +00:00
{
2014-07-29 00:52:35 +00:00
_3dRenderingShowClouds [ i ] -> setChecked ( settings . value ( QString ( "showClouds%1" ). arg ( i ), _3dRenderingShowClouds [ i ] -> isChecked ()). toBool ());
_3dRenderingDecimation [ i ] -> setValue ( settings . value ( QString ( "decimation%1" ). arg ( i ), _3dRenderingDecimation [ i ] -> value ()). toInt ());
_3dRenderingMaxDepth [ i ] -> setValue ( settings . value ( QString ( "maxDepth%1" ). arg ( i ), _3dRenderingMaxDepth [ i ] -> value ()). toDouble ());
2016-04-12 15:14:04 -04:00
_3dRenderingMinDepth [ i ] -> setValue ( settings . value ( QString ( "minDepth%1" ). arg ( i ), _3dRenderingMinDepth [ i ] -> value ()). toDouble ());
2014-07-29 00:52:35 +00:00
_3dRenderingShowScans [ i ] -> setChecked ( settings . value ( QString ( "showScans%1" ). arg ( i ), _3dRenderingShowScans [ i ] -> isChecked ()). toBool ());
2016-03-01 17:33:27 -05:00
_3dRenderingShowFeatures [ i ] -> setChecked ( settings . value ( QString ( "showFeatures%1" ). arg ( i ), _3dRenderingShowFeatures [ i ] -> isChecked ()). toBool ());
2013-12-11 00:12:44 +00:00
2015-11-22 18:08:32 -05:00
_3dRenderingDownsamplingScan [ i ] -> setValue ( settings . value ( QString ( "downsamplingScan%1" ). arg ( i ), _3dRenderingDownsamplingScan [ i ] -> value ()). toInt ());
_3dRenderingVoxelSizeScan [ i ] -> setValue ( settings . value ( QString ( "voxelSizeScan%1" ). arg ( i ), _3dRenderingVoxelSizeScan [ i ] -> value ()). toDouble ());
2014-07-29 00:52:35 +00:00
_3dRenderingOpacity [ i ] -> setValue ( settings . value ( QString ( "opacity%1" ). arg ( i ), _3dRenderingOpacity [ i ] -> value ()). toDouble ());
_3dRenderingPtSize [ i ] -> setValue ( settings . value ( QString ( "ptSize%1" ). arg ( i ), _3dRenderingPtSize [ i ] -> value ()). toInt ());
_3dRenderingOpacityScan [ i ] -> setValue ( settings . value ( QString ( "opacityScan%1" ). arg ( i ), _3dRenderingOpacityScan [ i ] -> value ()). toDouble ());
_3dRenderingPtSizeScan [ i ] -> setValue ( settings . value ( QString ( "ptSizeScan%1" ). arg ( i ), _3dRenderingPtSizeScan [ i ] -> value ()). toInt ());
2016-03-01 17:33:27 -05:00
_3dRenderingPtSizeFeatures [ i ] -> setValue ( settings . value ( QString ( "ptSizeFeatures%1" ). arg ( i ), _3dRenderingPtSizeFeatures [ i ] -> value ()). toInt ());
2013-12-11 00:12:44 +00:00
}
2016-06-10 20:12:13 -04:00
_ui -> doubleSpinBox_voxel -> setValue ( settings . value ( "cloudVoxel" , _ui -> doubleSpinBox_voxel -> value ()). toDouble ());
_ui -> doubleSpinBox_noiseRadius -> setValue ( settings . value ( "cloudNoiseRadius" , _ui -> doubleSpinBox_noiseRadius -> value ()). toDouble ());
_ui -> spinBox_noiseMinNeighbors -> setValue ( settings . value ( "cloudNoiseMinNeighbors" , _ui -> spinBox_noiseMinNeighbors -> value ()). toInt ());
2014-10-30 19:38:58 +00:00
_ui -> checkBox_showGraphs -> setChecked ( settings . value ( "showGraphs" , _ui -> checkBox_showGraphs -> isChecked ()). toBool ());
2015-07-26 15:50:39 -04:00
_ui -> checkBox_showLabels -> setChecked ( settings . value ( "showLabels" , _ui -> checkBox_showLabels -> isChecked ()). toBool ());
2014-10-30 19:38:58 +00:00
2016-02-15 19:35:24 -05:00
_ui -> radioButton_noFiltering -> setChecked ( settings . value ( "noFiltering" , _ui -> radioButton_noFiltering -> isChecked ()). toBool ());
_ui -> radioButton_nodeFiltering -> setChecked ( settings . value ( "cloudFiltering" , _ui -> radioButton_nodeFiltering -> isChecked ()). toBool ());
2014-02-13 21:32:46 +00:00
_ui -> doubleSpinBox_cloudFilterRadius -> setValue ( settings . value ( "cloudFilteringRadius" , _ui -> doubleSpinBox_cloudFilterRadius -> value ()). toDouble ());
_ui -> doubleSpinBox_cloudFilterAngle -> setValue ( settings . value ( "cloudFilteringAngle" , _ui -> doubleSpinBox_cloudFilterAngle -> value ()). toDouble ());
2016-02-15 19:35:24 -05:00
_ui -> radioButton_subtractFiltering -> setChecked ( settings . value ( "subtractFiltering" , _ui -> radioButton_subtractFiltering -> isChecked ()). toBool ());
_ui -> spinBox_subtractFilteringMinPts -> setValue ( settings . value ( "subtractFilteringMinPts" , _ui -> spinBox_subtractFilteringMinPts -> value ()). toInt ());
_ui -> doubleSpinBox_subtractFilteringRadius -> setValue ( settings . value ( "subtractFilteringRadius" , _ui -> doubleSpinBox_subtractFilteringRadius -> value ()). toDouble ());
_ui -> doubleSpinBox_subtractFilteringAngle -> setValue ( settings . value ( "subtractFilteringAngle" , _ui -> doubleSpinBox_subtractFilteringAngle -> value ()). toDouble ());
2016-06-12 13:51:49 -04:00
_ui -> spinBox_normalKSearch -> setValue ( settings . value ( "normalKSearch" , _ui -> spinBox_normalKSearch -> value ()). toInt ());
2014-02-13 21:32:46 +00:00
2014-07-29 21:48:37 +00:00
_ui -> checkBox_map_shown -> setChecked ( settings . value ( "gridMapShown" , _ui -> checkBox_map_shown -> isChecked ()). toBool ());
_ui -> doubleSpinBox_map_resolution -> setValue ( settings . value ( "gridMapResolution" , _ui -> doubleSpinBox_map_resolution -> value ()). toDouble ());
2015-03-20 14:03:09 -04:00
_ui -> checkBox_map_erode -> setChecked ( settings . value ( "gridMapEroded" , _ui -> checkBox_map_erode -> isChecked ()). toBool ());
2014-07-29 21:48:37 +00:00
_ui -> doubleSpinBox_map_opacity -> setValue ( settings . value ( "gridMapOpacity" , _ui -> doubleSpinBox_map_opacity -> value ()). toDouble ());
2016-06-10 20:12:13 -04:00
_ui -> groupBox_map_occupancyFrom3DCloud -> setChecked ( settings . value ( "gridMapOccupancyFrom3DCloud" , _ui -> groupBox_map_occupancyFrom3DCloud -> isChecked ()). toBool ());
_ui -> checkBox_projMapFrame -> setChecked ( settings . value ( "projMapFrame" , _ui -> checkBox_projMapFrame -> isChecked ()). toBool ());
_ui -> doubleSpinBox_projMaxGroundAngle -> setValue ( settings . value ( "projMaxGroundAngle" , _ui -> doubleSpinBox_projMaxGroundAngle -> value ()). toDouble ());
_ui -> doubleSpinBox_projMaxGroundHeight -> setValue ( settings . value ( "projMaxGroundHeight" , _ui -> doubleSpinBox_projMaxGroundHeight -> value ()). toDouble ());
_ui -> spinBox_projMinClusterSize -> setValue ( settings . value ( "projMinClusterSize" , _ui -> spinBox_projMinClusterSize -> value ()). toInt ());
_ui -> doubleSpinBox_projMaxObstaclesHeight -> setValue ( settings . value ( "projMaxObstaclesHeight" , _ui -> doubleSpinBox_projMaxObstaclesHeight -> value ()). toDouble ());
_ui -> checkBox_projFlatObstaclesDetected -> setChecked ( settings . value ( "projFlatObstaclesDetected" , _ui -> checkBox_projFlatObstaclesDetected -> isChecked ()). toBool ());
2014-07-29 21:48:37 +00:00
2016-02-15 19:35:24 -05:00
_ui -> groupBox_organized -> setChecked ( settings . value ( "meshing" , _ui -> groupBox_organized -> isChecked ()). toBool ());
_ui -> doubleSpinBox_mesh_angleTolerance -> setValue ( settings . value ( "meshing_angle" , _ui -> doubleSpinBox_mesh_angleTolerance -> value ()). toDouble ());
_ui -> checkBox_mesh_quad -> setChecked ( settings . value ( "meshing_quad" , _ui -> checkBox_mesh_quad -> isChecked ()). toBool ());
_ui -> spinBox_mesh_triangleSize -> setValue ( settings . value ( "meshing_triangle_size" , _ui -> spinBox_mesh_triangleSize -> value ()). toInt ());
2011-06-05 14:45:39 +00:00
settings . endGroup (); // General
settings . endGroup (); // rtabmap
}
void PreferencesDialog :: readCameraSettings ( const QString & filePath )
{
QString path = getIniFilePath ();
if ( ! filePath . isEmpty ())
{
path = filePath ;
}
QSettings settings ( path , QSettings :: IniFormat );
settings . beginGroup ( "Camera" );
_ui -> general_doubleSpinBox_imgRate -> setValue ( settings . value ( "imgRate" , _ui -> general_doubleSpinBox_imgRate -> value ()). toDouble ());
2015-02-28 18:09:22 -05:00
_ui -> source_mirroring -> setChecked ( settings . value ( "mirroring" , _ui -> source_mirroring -> isChecked ()). toBool ());
2015-11-22 18:08:32 -05:00
_ui -> lineEdit_calibrationFile -> setText ( settings . value ( "calibrationName" , _ui -> lineEdit_calibrationFile -> text ()). toString ());
2015-06-26 18:21:32 -04:00
_ui -> comboBox_sourceType -> setCurrentIndex ( settings . value ( "type" , _ui -> comboBox_sourceType -> currentIndex ()). toInt ());
_ui -> lineEdit_sourceDevice -> setText ( settings . value ( "device" , _ui -> lineEdit_sourceDevice -> text ()). toString ());
_ui -> lineEdit_sourceLocalTransform -> setText ( settings . value ( "localTransform" , _ui -> lineEdit_sourceLocalTransform -> text ()). toString ());
2016-01-08 19:15:49 -05:00
_ui -> spinBox_source_imageDecimation -> setValue ( settings . value ( "imageDecimation" , _ui -> spinBox_source_imageDecimation -> value ()). toInt ());
2015-06-26 18:21:32 -04:00
settings . beginGroup ( "rgbd" );
_ui -> comboBox_cameraRGBD -> setCurrentIndex ( settings . value ( "driver" , _ui -> comboBox_cameraRGBD -> currentIndex ()). toInt ());
_ui -> checkbox_rgbd_colorOnly -> setChecked ( settings . value ( "rgbdColorOnly" , _ui -> checkbox_rgbd_colorOnly -> isChecked ()). toBool ());
settings . endGroup (); // rgbd
settings . beginGroup ( "stereo" );
_ui -> comboBox_cameraStereo -> setCurrentIndex ( settings . value ( "driver" , _ui -> comboBox_cameraStereo -> currentIndex ()). toInt ());
2015-08-27 17:16:12 -04:00
_ui -> checkbox_stereo_depthGenerated -> setChecked ( settings . value ( "depthGenerated" , _ui -> checkbox_stereo_depthGenerated -> isChecked ()). toBool ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // stereo
settings . beginGroup ( "rgb" );
_ui -> source_comboBox_image_type -> setCurrentIndex ( settings . value ( "driver" , _ui -> source_comboBox_image_type -> currentIndex ()). toInt ());
settings . endGroup (); // rgb
settings . beginGroup ( "Openni" );
_ui -> lineEdit_openniOniPath -> setText ( settings . value ( "oniPath" , _ui -> lineEdit_openniOniPath -> text ()). toString ());
settings . endGroup (); // Openni
settings . beginGroup ( "Openni2" );
_ui -> openni2_autoWhiteBalance -> setChecked ( settings . value ( "autoWhiteBalance" , _ui -> openni2_autoWhiteBalance -> isChecked ()). toBool ());
_ui -> openni2_autoExposure -> setChecked ( settings . value ( "autoExposure" , _ui -> openni2_autoExposure -> isChecked ()). toBool ());
_ui -> openni2_exposure -> setValue ( settings . value ( "exposure" , _ui -> openni2_exposure -> value ()). toInt ());
_ui -> openni2_gain -> setValue ( settings . value ( "gain" , _ui -> openni2_gain -> value ()). toInt ());
_ui -> openni2_mirroring -> setChecked ( settings . value ( "mirroring" , _ui -> openni2_mirroring -> isChecked ()). toBool ());
2015-10-15 16:40:49 -04:00
_ui -> openni2_stampsIdsUsed -> setChecked ( settings . value ( "stampsIdsUsed" , _ui -> openni2_stampsIdsUsed -> isChecked ()). toBool ());
2015-06-26 18:21:32 -04:00
_ui -> lineEdit_openni2OniPath -> setText ( settings . value ( "oniPath" , _ui -> lineEdit_openni2OniPath -> text ()). toString ());
settings . endGroup (); // Openni2
settings . beginGroup ( "Freenect2" );
_ui -> comboBox_freenect2Format -> setCurrentIndex ( settings . value ( "format" , _ui -> comboBox_freenect2Format -> currentIndex ()). toInt ());
2015-11-04 18:31:52 -05:00
_ui -> doubleSpinBox_freenect2MinDepth -> setValue ( settings . value ( "minDepth" , _ui -> doubleSpinBox_freenect2MinDepth -> value ()). toDouble ());
_ui -> doubleSpinBox_freenect2MaxDepth -> setValue ( settings . value ( "maxDepth" , _ui -> doubleSpinBox_freenect2MaxDepth -> value ()). toDouble ());
_ui -> checkBox_freenect2BilateralFiltering -> setChecked ( settings . value ( "bilateralFiltering" , _ui -> checkBox_freenect2BilateralFiltering -> isChecked ()). toBool ());
_ui -> checkBox_freenect2EdgeAwareFiltering -> setChecked ( settings . value ( "edgeAwareFiltering" , _ui -> checkBox_freenect2EdgeAwareFiltering -> isChecked ()). toBool ());
_ui -> checkBox_freenect2NoiseFiltering -> setChecked ( settings . value ( "noiseFiltering" , _ui -> checkBox_freenect2NoiseFiltering -> isChecked ()). toBool ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // Freenect2
2015-07-30 14:17:29 -04:00
settings . beginGroup ( "RGBDImages" );
_ui -> lineEdit_cameraRGBDImages_path_rgb -> setText ( settings . value ( "path_rgb" , _ui -> lineEdit_cameraRGBDImages_path_rgb -> text ()). toString ());
_ui -> lineEdit_cameraRGBDImages_path_depth -> setText ( settings . value ( "path_depth" , _ui -> lineEdit_cameraRGBDImages_path_depth -> text ()). toString ());
_ui -> doubleSpinBox_cameraRGBDImages_scale -> setValue ( settings . value ( "scale" , _ui -> doubleSpinBox_cameraRGBDImages_scale -> value ()). toDouble ());
settings . endGroup (); // RGBDImages
2015-06-26 18:21:32 -04:00
settings . beginGroup ( "StereoImages" );
2015-07-30 14:17:29 -04:00
_ui -> lineEdit_cameraStereoImages_path_left -> setText ( settings . value ( "path_left" , _ui -> lineEdit_cameraStereoImages_path_left -> text ()). toString ());
_ui -> lineEdit_cameraStereoImages_path_right -> setText ( settings . value ( "path_right" , _ui -> lineEdit_cameraStereoImages_path_right -> text ()). toString ());
2015-07-16 14:44:25 -04:00
_ui -> checkBox_stereoImages_rectify -> setChecked ( settings . value ( "rectify" , _ui -> checkBox_stereoImages_rectify -> isChecked ()). toBool ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // StereoImages
2015-07-16 14:44:25 -04:00
settings . beginGroup ( "StereoVideo" );
_ui -> lineEdit_cameraStereoVideo_path -> setText ( settings . value ( "path" , _ui -> lineEdit_cameraStereoVideo_path -> text ()). toString ());
_ui -> checkBox_stereoVideo_rectify -> setChecked ( settings . value ( "rectify" , _ui -> checkBox_stereoVideo_rectify -> isChecked ()). toBool ());
settings . endGroup (); // StereoVideo
2016-05-31 19:09:49 -04:00
settings . beginGroup ( "StereoZed" );
2016-06-02 17:27:12 -04:00
_ui -> comboBox_stereoZed_resolution -> setCurrentIndex ( settings . value ( "resolution" , _ui -> comboBox_stereoZed_resolution -> currentIndex ()). toInt ());
_ui -> comboBox_stereoZed_quality -> setCurrentIndex ( settings . value ( "quality" , _ui -> comboBox_stereoZed_quality -> currentIndex ()). toInt ());
_ui -> comboBox_stereoZed_sensingMode -> setCurrentIndex ( settings . value ( "sensing_mode" , _ui -> comboBox_stereoZed_sensingMode -> currentIndex ()). toInt ());
_ui -> spinBox_stereoZed_confidenceThr -> setValue ( settings . value ( "confidence_thr" , _ui -> spinBox_stereoZed_confidenceThr -> value ()). toInt ());
_ui -> lineEdit_zedSvoPath -> setText ( settings . value ( "svo_path" , _ui -> lineEdit_zedSvoPath -> text ()). toString ());
2016-05-31 19:09:49 -04:00
settings . endGroup (); // StereoZed
2015-06-26 18:21:32 -04:00
settings . beginGroup ( "Images" );
2011-06-05 14:45:39 +00:00
_ui -> source_images_lineEdit_path -> setText ( settings . value ( "path" , _ui -> source_images_lineEdit_path -> text ()). toString ());
_ui -> source_images_spinBox_startPos -> setValue ( settings . value ( "startPos" , _ui -> source_images_spinBox_startPos -> value ()). toInt ());
_ui -> source_images_refreshDir -> setChecked ( settings . value ( "refreshDir" , _ui -> source_images_refreshDir -> isChecked ()). toBool ());
2015-07-16 14:44:25 -04:00
_ui -> checkBox_rgbImages_rectify -> setChecked ( settings . value ( "rectify" , _ui -> checkBox_rgbImages_rectify -> isChecked ()). toBool ());
2016-01-19 17:43:33 -05:00
_ui -> comboBox_cameraImages_bayerMode -> setCurrentIndex ( settings . value ( "bayerMode" , _ui -> comboBox_cameraImages_bayerMode -> currentIndex ()). toInt ());
2016-01-06 17:26:55 -05:00
_ui -> checkBox_cameraImages_timestamps -> setChecked ( settings . value ( "filenames_as_stamps" , _ui -> checkBox_cameraImages_timestamps -> isChecked ()). toBool ());
2016-01-13 18:13:44 -05:00
_ui -> checkBox_cameraImages_syncTimeStamps -> setChecked ( settings . value ( "sync_stamps" , _ui -> checkBox_cameraImages_syncTimeStamps -> isChecked ()). toBool ());
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_timestamps -> setText ( settings . value ( "stamps" , _ui -> lineEdit_cameraImages_timestamps -> text ()). toString ());
_ui -> lineEdit_cameraImages_path_scans -> setText ( settings . value ( "path_scans" , _ui -> lineEdit_cameraImages_path_scans -> text ()). toString ());
_ui -> lineEdit_cameraImages_laser_transform -> setText ( settings . value ( "scan_transform" , _ui -> lineEdit_cameraImages_laser_transform -> text ()). toString ());
_ui -> spinBox_cameraImages_max_scan_pts -> setValue ( settings . value ( "scan_max_pts" , _ui -> spinBox_cameraImages_max_scan_pts -> value ()). toInt ());
2016-01-08 19:15:49 -05:00
_ui -> spinBox_cameraImages_scanDownsampleStep -> setValue ( settings . value ( "scan_downsample_step" , _ui -> spinBox_cameraImages_scanDownsampleStep -> value ()). toInt ());
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> setValue ( settings . value ( "scan_voxel_size" , _ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value ()). toDouble ());
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_gt -> setText ( settings . value ( "gt_path" , _ui -> lineEdit_cameraImages_gt -> text ()). toString ());
_ui -> comboBox_cameraImages_gtFormat -> setCurrentIndex ( settings . value ( "gt_format" , _ui -> comboBox_cameraImages_gtFormat -> currentIndex ()). toInt ());
2011-06-05 14:45:39 +00:00
settings . endGroup (); // images
2015-06-26 18:21:32 -04:00
settings . beginGroup ( "Video" );
2011-06-05 14:45:39 +00:00
_ui -> source_video_lineEdit_path -> setText ( settings . value ( "path" , _ui -> source_video_lineEdit_path -> text ()). toString ());
2015-07-16 14:44:25 -04:00
_ui -> checkBox_rgbVideo_rectify -> setChecked ( settings . value ( "rectify" , _ui -> checkBox_rgbVideo_rectify -> isChecked ()). toBool ());
2011-06-05 14:45:39 +00:00
settings . endGroup (); // video
2012-06-24 17:19:34 +00:00
2016-01-06 17:26:55 -05:00
settings . beginGroup ( "ScanFromDepth" );
_ui -> groupBox_scanFromDepth -> setChecked ( settings . value ( "enabled" , _ui -> groupBox_scanFromDepth -> isChecked ()). toBool ());
_ui -> spinBox_cameraScanFromDepth_decimation -> setValue ( settings . value ( "decimation" , _ui -> spinBox_cameraScanFromDepth_decimation -> value ()). toInt ());
_ui -> doubleSpinBox_cameraSCanFromDepth_maxDepth -> setValue ( settings . value ( "maxDepth" , _ui -> doubleSpinBox_cameraSCanFromDepth_maxDepth -> value ()). toDouble ());
2016-01-08 19:15:49 -05:00
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> setValue ( settings . value ( "voxelSize" , _ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value ()). toDouble ());
_ui -> spinBox_cameraImages_scanNormalsK -> setValue ( settings . value ( "normalsK" , _ui -> spinBox_cameraImages_scanNormalsK -> value ()). toInt ());
2016-01-06 17:26:55 -05:00
settings . endGroup (); //ScanFromDepth
2016-01-11 17:21:06 -05:00
settings . beginGroup ( "DepthFromScan" );
_ui -> groupBox_depthFromScan -> setChecked ( settings . value ( "depthFromScan" , _ui -> groupBox_depthFromScan -> isChecked ()). toBool ());
2016-03-10 12:31:22 -05:00
_ui -> groupBox_depthFromScan_fillHoles -> setChecked ( settings . value ( "depthFromScanFillHoles" , _ui -> groupBox_depthFromScan_fillHoles -> isChecked ()). toBool ());
_ui -> radioButton_depthFromScan_vertical -> setChecked ( settings . value ( "depthFromScanVertical" , _ui -> radioButton_depthFromScan_vertical -> isChecked ()). toBool ());
_ui -> radioButton_depthFromScan_horizontal -> setChecked ( settings . value ( "depthFromScanHorizontal" , _ui -> radioButton_depthFromScan_horizontal -> isChecked ()). toBool ());
2016-01-11 17:21:06 -05:00
_ui -> checkBox_depthFromScan_fillBorders -> setChecked ( settings . value ( "depthFromScanFillBorders" , _ui -> checkBox_depthFromScan_fillBorders -> isChecked ()). toBool ());
settings . endGroup ();
2012-06-24 17:19:34 +00:00
settings . beginGroup ( "Database" );
_ui -> source_database_lineEdit_path -> setText ( settings . value ( "path" , _ui -> source_database_lineEdit_path -> text ()). toString ());
2013-12-11 00:12:44 +00:00
_ui -> source_checkBox_ignoreOdometry -> setChecked ( settings . value ( "ignoreOdometry" , _ui -> source_checkBox_ignoreOdometry -> isChecked ()). toBool ());
2015-04-27 02:43:06 -04:00
_ui -> source_checkBox_ignoreGoalDelay -> setChecked ( settings . value ( "ignoreGoalDelay" , _ui -> source_checkBox_ignoreGoalDelay -> isChecked ()). toBool ());
2015-10-13 12:50:25 -04:00
_ui -> source_checkBox_ignoreGoals -> setChecked ( settings . value ( "ignoreGoals" , _ui -> source_checkBox_ignoreGoals -> isChecked ()). toBool ());
2012-12-11 18:05:05 +00:00
_ui -> source_spinBox_databaseStartPos -> setValue ( settings . value ( "startPos" , _ui -> source_spinBox_databaseStartPos -> value ()). toInt ());
2015-05-01 07:30:09 -04:00
_ui -> source_checkBox_useDbStamps -> setChecked ( settings . value ( "useDatabaseStamps" , _ui -> source_checkBox_useDbStamps -> isChecked ()). toBool ());
2012-06-24 17:19:34 +00:00
settings . endGroup (); // Database
2013-12-11 00:12:44 +00:00
2015-06-26 18:21:32 -04:00
settings . endGroup (); // Camera
2015-04-06 00:28:04 -04:00
_calibrationDialog -> loadSettings ( settings , "CalibrationDialog" );
2015-06-26 18:21:32 -04:00
2011-06-05 14:45:39 +00:00
}
2012-06-26 14:57:31 +00:00
bool PreferencesDialog :: readCoreSettings ( const QString & filePath )
2011-06-05 14:45:39 +00:00
{
QString path = getIniFilePath ();
if ( ! filePath . isEmpty ())
{
path = filePath ;
}
2012-06-26 14:57:31 +00:00
2015-11-22 18:08:32 -05:00
UDEBUG ( "%s" , path . toStdString (). c_str ());
2012-06-26 14:57:31 +00:00
if ( ! QFile :: exists ( path ))
{
QMessageBox :: information ( this , tr ( "INI file doesn't exist..." ), tr ( "The configuration file \" %1 \" does not exist, it will be created with default parameters." ). arg ( path ));
}
2011-06-05 14:45:39 +00:00
QSettings settings ( path , QSettings :: IniFormat );
2012-12-11 18:05:05 +00:00
2011-06-05 14:45:39 +00:00
settings . beginGroup ( "Core" );
2014-10-02 15:12:56 +00:00
// Compare version in ini with the current RTAB-Map version
QStringList version = settings . value ( "Version" , "" ). toString (). split ( '.' );
if ( version . size () == 3 )
{
if ( ! RTABMAP_VERSION_COMPARE ( version [ 0 ]. toInt (), version [ 1 ]. toInt (), version [ 2 ]. toInt ()))
{
if ( path . contains ( ".rtabmap" ))
{
UWARN ( "Version in the config file \" %s \" is more recent ( \" %s \" ) than "
"current RTAB-Map version used ( \" %s \" ). The config file will be upgraded "
"to new version." ,
path . toStdString (). c_str (),
settings . value ( "Version" , "" ). toString (). toStdString (). c_str (),
RTABMAP_VERSION );
}
else
{
UERROR ( "Version in the config file \" %s \" is more recent ( \" %s \" ) than "
"current RTAB-Map version used ( \" %s \" ). New parameters (if there are some) will "
"be ignored." ,
path . toStdString (). c_str (),
settings . value ( "Version" , "" ). toString (). toStdString (). c_str (),
RTABMAP_VERSION );
}
}
}
2011-06-05 14:45:39 +00:00
QStringList keys = settings . allKeys ();
2012-12-11 18:05:05 +00:00
// Get profile
const rtabmap :: ParametersMap & parameters = Parameters :: getDefaultParameters ();
2011-06-05 14:45:39 +00:00
for ( rtabmap :: ParametersMap :: const_iterator iter = parameters . begin (); iter != parameters . end (); ++ iter )
{
2015-11-22 18:08:32 -05:00
QString key ( iter -> first . c_str ());
2011-06-05 14:45:39 +00:00
QString value = settings . value ( key , "" ). toString ();
2015-11-22 18:08:32 -05:00
if ( value . isEmpty ())
{
// look for old parameter name
rtabmap :: ParametersMap :: const_iterator oldIter = Parameters :: getBackwardCompatibilityMap (). find ( iter -> first );
if ( oldIter != Parameters :: getBackwardCompatibilityMap (). end ())
{
value = settings . value ( QString ( oldIter -> second . c_str ()), "" ). toString ();
if ( ! value . isEmpty ())
{
UWARN ( "Parameter migration from \" %s \" to \" %s \" (value=%s)." ,
oldIter -> second . c_str (), oldIter -> first . c_str (), value . toStdString (). c_str ());
}
}
}
2011-06-05 14:45:39 +00:00
if ( ! value . isEmpty ())
{
2015-03-30 10:47:38 -04:00
if ( key . toStdString (). compare ( Parameters :: kRtabmapWorkingDirectory ()) == 0 )
{
// The directory should exist if not the default one
2016-02-15 19:35:24 -05:00
if ( ! QDir ( value ). exists () && value . compare ( Parameters :: createDefaultWorkingDirectory (). c_str ()) != 0 )
2015-03-30 10:47:38 -04:00
{
if ( QDir ( this -> getWorkingDirectory (). toStdString (). c_str ()). exists ())
{
UWARN ( "Reading config: Not existing working directory \" %s \" . Keeping old one ( \" %s \" )." ,
value . toStdString (). c_str (),
this -> getWorkingDirectory (). toStdString (). c_str ());
value = this -> getWorkingDirectory ();
}
else
{
UWARN ( "Reading config: Not existing working directory \" %s \" . Using default one ( \" %s \" )." ,
value . toStdString (). c_str (),
( * iter ). second . c_str ());
value = ( * iter ). second . c_str ();
}
}
}
2011-06-05 14:45:39 +00:00
this -> setParameter ( key . toStdString (), value . toStdString ());
}
else
{
// Add information about the working directory if not in the config file
if ( key . toStdString (). compare ( Parameters :: kRtabmapWorkingDirectory ()) == 0 )
{
if ( ! _initialized )
{
QMessageBox :: information ( this ,
tr ( "Working directory" ),
tr ( "RTAB-Map needs a working directory to put the database. \n\n "
"By default, the directory \" %1 \" is used. \n\n "
"The working directory can be changed any time in the "
"preferences menu." ). arg (
2016-02-15 19:35:24 -05:00
Parameters :: createDefaultWorkingDirectory (). c_str ()));
2011-06-05 14:45:39 +00:00
}
2016-02-15 19:35:24 -05:00
this -> setParameter ( key . toStdString (), Parameters :: createDefaultWorkingDirectory ());
UDEBUG ( "key.toStdString()=%s" , Parameters :: createDefaultWorkingDirectory (). c_str ());
}
else
{
// Use the default value if the key doesn't exist yet
this -> setParameter ( key . toStdString (), ( * iter ). second );
UDEBUG ( "key.toStdString()=%s" , key . toStdString (). c_str ());
2011-06-05 14:45:39 +00:00
}
}
}
settings . endGroup (); // Core
2012-06-26 14:57:31 +00:00
return true ;
2011-06-05 14:45:39 +00:00
}
2014-01-22 19:49:28 +00:00
bool PreferencesDialog :: saveConfigTo ()
2011-06-05 14:45:39 +00:00
{
2014-10-28 05:00:10 +00:00
QString path = QFileDialog :: getSaveFileName ( this , tr ( "Save settings..." ), this -> getWorkingDirectory () + QDir :: separator () + "config.ini" , "*.ini" );
2011-06-05 14:45:39 +00:00
if ( ! path . isEmpty ())
{
2015-02-13 16:50:32 -05:00
writeGuiSettings ( path );
writeCameraSettings ( path );
writeCoreSettings ( path );
2014-01-22 19:49:28 +00:00
return true ;
}
return false ;
}
void PreferencesDialog :: resetConfig ()
{
int button = QMessageBox :: warning ( this ,
tr ( "Reset settings..." ),
tr ( "This will reset all settings. Restore all settings to default without saving them first?" ),
QMessageBox :: Cancel | QMessageBox :: Yes | QMessageBox :: Save ,
QMessageBox :: Cancel );
if ( button == QMessageBox :: Yes ||
( button == QMessageBox :: Save && saveConfigTo ()))
{
this -> resetSettings ( - 1 );
2016-02-18 14:12:12 -05:00
_calibrationDialog -> resetSettings ();
2011-06-05 14:45:39 +00:00
}
}
void PreferencesDialog :: writeSettings ( const QString & filePath )
{
writeGuiSettings ( filePath );
writeCameraSettings ( filePath );
writeCoreSettings ( filePath );
2016-01-07 19:39:21 -05:00
UDEBUG ( "_obsoletePanels=%d modified parameters=%d" , ( int ) _obsoletePanels , ( int ) _modifiedParameters . size ());
2015-01-07 17:30:20 -05:00
2016-01-07 19:39:21 -05:00
if ( _modifiedParameters . size ())
2011-06-05 14:45:39 +00:00
{
2016-01-07 19:39:21 -05:00
emit settingsChanged ( _modifiedParameters );
2011-06-05 14:45:39 +00:00
}
if ( _obsoletePanels )
{
emit settingsChanged ( _obsoletePanels );
}
2016-01-14 15:30:52 -05:00
for ( ParametersMap :: iterator iter = _modifiedParameters . begin (); iter != _modifiedParameters . end (); ++ iter )
{
if ( _parameters . at ( iter -> first ). compare ( iter -> second ) != 0 )
{
UINFO ( "modified %s = %s->%s" , iter -> first . c_str (), _parameters . at ( iter -> first ). c_str (), iter -> second . c_str ());
}
}
2016-01-07 19:39:21 -05:00
2016-01-14 15:30:52 -05:00
uInsert ( _parameters , _modifiedParameters ); // update cached parameters
2016-01-07 19:39:21 -05:00
_modifiedParameters . clear ();
2011-06-05 14:45:39 +00:00
_obsoletePanels = kPanelDummy ;
}
2015-02-13 16:50:32 -05:00
void PreferencesDialog :: writeGuiSettings ( const QString & filePath ) const
2011-06-05 14:45:39 +00:00
{
QString path = getIniFilePath ();
if ( ! filePath . isEmpty ())
{
path = filePath ;
}
QSettings settings ( path , QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( "General" );
2016-01-05 16:57:13 -05:00
settings . remove ( "" );
2015-07-30 14:17:29 -04:00
settings . setValue ( "imagesKept" , _ui -> general_checkBox_imagesKept -> isChecked ());
2016-06-12 17:53:35 -04:00
settings . setValue ( "cloudsKept" , _ui -> general_checkBox_cloudsKept -> isChecked ());
2015-07-30 14:17:29 -04:00
settings . setValue ( "loggerLevel" , _ui -> comboBox_loggerLevel -> currentIndex ());
settings . setValue ( "loggerEventLevel" , _ui -> comboBox_loggerEventLevel -> currentIndex ());
settings . setValue ( "loggerPauseLevel" , _ui -> comboBox_loggerPauseLevel -> currentIndex ());
settings . setValue ( "loggerType" , _ui -> comboBox_loggerType -> currentIndex ());
settings . setValue ( "loggerPrintTime" , _ui -> checkBox_logger_printTime -> isChecked ());
2016-01-05 13:55:21 -05:00
settings . setValue ( "loggerPrintThreadId" , _ui -> checkBox_logger_printThreadId -> isChecked ());
2015-07-30 14:17:29 -04:00
settings . setValue ( "verticalLayoutUsed" , _ui -> checkBox_verticalLayoutUsed -> isChecked ());
settings . setValue ( "imageRejectedShown" , _ui -> checkBox_imageRejectedShown -> isChecked ());
2011-06-10 14:04:06 +00:00
settings . setValue ( "imageHighestHypShown" , _ui -> checkBox_imageHighestHypShown -> isChecked ());
2015-07-30 14:17:29 -04:00
settings . setValue ( "beep" , _ui -> checkBox_beep -> isChecked ());
settings . setValue ( "notifyNewGlobalPath" , _ui -> checkBox_notifyWhenNewGlobalPathIsReceived -> isChecked ());
settings . setValue ( "odomQualityThr" , _ui -> spinBox_odomQualityWarnThr -> value ());
settings . setValue ( "posteriorGraphView" , _ui -> checkBox_posteriorGraphView -> isChecked ());
2013-12-11 00:12:44 +00:00
2014-07-29 00:52:35 +00:00
for ( int i = 0 ; i < 2 ; ++ i )
2013-12-11 00:12:44 +00:00
{
2014-07-29 00:52:35 +00:00
settings . setValue ( QString ( "showClouds%1" ). arg ( i ), _3dRenderingShowClouds [ i ] -> isChecked ());
settings . setValue ( QString ( "decimation%1" ). arg ( i ), _3dRenderingDecimation [ i ] -> value ());
settings . setValue ( QString ( "maxDepth%1" ). arg ( i ), _3dRenderingMaxDepth [ i ] -> value ());
2016-04-12 15:14:04 -04:00
settings . setValue ( QString ( "minDepth%1" ). arg ( i ), _3dRenderingMinDepth [ i ] -> value ());
2014-07-29 00:52:35 +00:00
settings . setValue ( QString ( "showScans%1" ). arg ( i ), _3dRenderingShowScans [ i ] -> isChecked ());
2016-03-01 17:33:27 -05:00
settings . setValue ( QString ( "showFeatures%1" ). arg ( i ), _3dRenderingShowFeatures [ i ] -> isChecked ());
2013-12-11 00:12:44 +00:00
2015-11-22 18:08:32 -05:00
settings . setValue ( QString ( "downsamplingScan%1" ). arg ( i ), _3dRenderingDownsamplingScan [ i ] -> value ());
settings . setValue ( QString ( "voxelSizeScan%1" ). arg ( i ), _3dRenderingVoxelSizeScan [ i ] -> value ());
2014-07-29 00:52:35 +00:00
settings . setValue ( QString ( "opacity%1" ). arg ( i ), _3dRenderingOpacity [ i ] -> value ());
settings . setValue ( QString ( "ptSize%1" ). arg ( i ), _3dRenderingPtSize [ i ] -> value ());
settings . setValue ( QString ( "opacityScan%1" ). arg ( i ), _3dRenderingOpacityScan [ i ] -> value ());
settings . setValue ( QString ( "ptSizeScan%1" ). arg ( i ), _3dRenderingPtSizeScan [ i ] -> value ());
2016-03-01 17:33:27 -05:00
settings . setValue ( QString ( "ptSizeFeatures%1" ). arg ( i ), _3dRenderingPtSizeFeatures [ i ] -> value ());
2013-12-11 00:12:44 +00:00
}
2016-06-10 20:12:13 -04:00
settings . setValue ( "cloudVoxel" , _ui -> doubleSpinBox_voxel -> value ());
settings . setValue ( "cloudNoiseRadius" , _ui -> doubleSpinBox_noiseRadius -> value ());
settings . setValue ( "cloudNoiseMinNeighbors" , _ui -> spinBox_noiseMinNeighbors -> value ());
2014-10-30 19:38:58 +00:00
settings . setValue ( "showGraphs" , _ui -> checkBox_showGraphs -> isChecked ());
2015-07-26 15:50:39 -04:00
settings . setValue ( "showLabels" , _ui -> checkBox_showLabels -> isChecked ());
2014-10-30 19:38:58 +00:00
2016-02-15 19:35:24 -05:00
settings . setValue ( "noFiltering" , _ui -> radioButton_noFiltering -> isChecked ());
settings . setValue ( "cloudFiltering" , _ui -> radioButton_nodeFiltering -> isChecked ());
2015-07-30 14:17:29 -04:00
settings . setValue ( "cloudFilteringRadius" , _ui -> doubleSpinBox_cloudFilterRadius -> value ());
settings . setValue ( "cloudFilteringAngle" , _ui -> doubleSpinBox_cloudFilterAngle -> value ());
2016-02-15 19:35:24 -05:00
settings . setValue ( "subtractFiltering" , _ui -> radioButton_subtractFiltering -> isChecked ());
settings . setValue ( "subtractFilteringMinPts" , _ui -> spinBox_subtractFilteringMinPts -> value ());
settings . setValue ( "subtractFilteringRadius" , _ui -> doubleSpinBox_subtractFilteringRadius -> value ());
2016-06-10 20:12:13 -04:00
settings . setValue ( "subtractFilteringAngle" , _ui -> doubleSpinBox_subtractFilteringAngle -> value ());
2016-06-12 13:51:49 -04:00
settings . setValue ( "normalKSearch" , _ui -> spinBox_normalKSearch -> value ());
2013-12-11 00:12:44 +00:00
2015-07-30 14:17:29 -04:00
settings . setValue ( "gridMapShown" , _ui -> checkBox_map_shown -> isChecked ());
settings . setValue ( "gridMapResolution" , _ui -> doubleSpinBox_map_resolution -> value ());
settings . setValue ( "gridMapEroded" , _ui -> checkBox_map_erode -> isChecked ());
settings . setValue ( "gridMapOpacity" , _ui -> doubleSpinBox_map_opacity -> value ());
2016-02-15 19:35:24 -05:00
2016-06-10 20:12:13 -04:00
settings . setValue ( "gridMapOccupancyFrom3DCloud" , _ui -> groupBox_map_occupancyFrom3DCloud -> isChecked ());
settings . setValue ( "projMapFrame" , _ui -> checkBox_projMapFrame -> isChecked ());
settings . setValue ( "projMaxGroundAngle" , _ui -> doubleSpinBox_projMaxGroundAngle -> value ());
settings . setValue ( "projMaxGroundHeight" , _ui -> doubleSpinBox_projMaxGroundHeight -> value ());
settings . setValue ( "projMinClusterSize" , _ui -> spinBox_projMinClusterSize -> value ());
settings . setValue ( "projMaxObstaclesHeight" , _ui -> doubleSpinBox_projMaxObstaclesHeight -> value ());
settings . setValue ( "projFlatObstaclesDetected" , _ui -> checkBox_projFlatObstaclesDetected -> isChecked ());
2016-02-15 19:35:24 -05:00
settings . setValue ( "meshing" , _ui -> groupBox_organized -> isChecked ());
settings . setValue ( "meshing_angle" , _ui -> doubleSpinBox_mesh_angleTolerance -> value ());
settings . setValue ( "meshing_quad" , _ui -> checkBox_mesh_quad -> isChecked ());
settings . setValue ( "meshing_triangle_size" , _ui -> spinBox_mesh_triangleSize -> value ());
2011-06-05 14:45:39 +00:00
settings . endGroup (); // General
settings . endGroup (); // rtabmap
}
2015-02-13 16:50:32 -05:00
void PreferencesDialog :: writeCameraSettings ( const QString & filePath ) const
2011-06-05 14:45:39 +00:00
{
QString path = getIniFilePath ();
if ( ! filePath . isEmpty ())
{
path = filePath ;
}
QSettings settings ( path , QSettings :: IniFormat );
2015-06-26 18:21:32 -04:00
2011-06-05 14:45:39 +00:00
settings . beginGroup ( "Camera" );
2016-01-05 16:57:13 -05:00
settings . remove ( "" );
2015-07-30 14:17:29 -04:00
settings . setValue ( "imgRate" , _ui -> general_doubleSpinBox_imgRate -> value ());
settings . setValue ( "mirroring" , _ui -> source_mirroring -> isChecked ());
2015-11-22 18:08:32 -05:00
settings . setValue ( "calibrationName" , _ui -> lineEdit_calibrationFile -> text ());
2015-07-30 14:17:29 -04:00
settings . setValue ( "type" , _ui -> comboBox_sourceType -> currentIndex ());
settings . setValue ( "device" , _ui -> lineEdit_sourceDevice -> text ());
settings . setValue ( "localTransform" , _ui -> lineEdit_sourceLocalTransform -> text ());
2016-01-08 19:15:49 -05:00
settings . setValue ( "imageDecimation" , _ui -> spinBox_source_imageDecimation -> value ());
2015-06-26 18:21:32 -04:00
settings . beginGroup ( "rgbd" );
2015-07-30 14:17:29 -04:00
settings . setValue ( "driver" , _ui -> comboBox_cameraRGBD -> currentIndex ());
2015-06-26 18:21:32 -04:00
settings . setValue ( "rgbdColorOnly" , _ui -> checkbox_rgbd_colorOnly -> isChecked ());
settings . endGroup (); // rgbd
settings . beginGroup ( "stereo" );
settings . setValue ( "driver" , _ui -> comboBox_cameraStereo -> currentIndex ());
2015-08-27 17:16:12 -04:00
settings . setValue ( "depthGenerated" , _ui -> checkbox_stereo_depthGenerated -> isChecked ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // stereo
settings . beginGroup ( "rgb" );
settings . setValue ( "driver" , _ui -> source_comboBox_image_type -> currentIndex ());
settings . endGroup (); // rgb
settings . beginGroup ( "Openni" );
settings . setValue ( "oniPath" , _ui -> lineEdit_openniOniPath -> text ());
settings . endGroup (); // Openni
settings . beginGroup ( "Openni2" );
settings . setValue ( "autoWhiteBalance" , _ui -> openni2_autoWhiteBalance -> isChecked ());
2015-07-30 14:17:29 -04:00
settings . setValue ( "autoExposure" , _ui -> openni2_autoExposure -> isChecked ());
settings . setValue ( "exposure" , _ui -> openni2_exposure -> value ());
settings . setValue ( "gain" , _ui -> openni2_gain -> value ());
settings . setValue ( "mirroring" , _ui -> openni2_mirroring -> isChecked ());
2015-10-15 16:40:49 -04:00
settings . setValue ( "stampsIdsUsed" , _ui -> openni2_stampsIdsUsed -> isChecked ());
2015-07-30 14:17:29 -04:00
settings . setValue ( "oniPath" , _ui -> lineEdit_openni2OniPath -> text ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // Openni2
settings . beginGroup ( "Freenect2" );
2015-11-04 18:31:52 -05:00
settings . setValue ( "format" , _ui -> comboBox_freenect2Format -> currentIndex ());
settings . setValue ( "minDepth" , _ui -> doubleSpinBox_freenect2MinDepth -> value ());
settings . setValue ( "maxDepth" , _ui -> doubleSpinBox_freenect2MaxDepth -> value ());
settings . setValue ( "bilateralFiltering" , _ui -> checkBox_freenect2BilateralFiltering -> isChecked ());
settings . setValue ( "edgeAwareFiltering" , _ui -> checkBox_freenect2EdgeAwareFiltering -> isChecked ());
settings . setValue ( "noiseFiltering" , _ui -> checkBox_freenect2NoiseFiltering -> isChecked ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // Freenect2
2015-07-30 14:17:29 -04:00
settings . beginGroup ( "RGBDImages" );
settings . setValue ( "path_rgb" , _ui -> lineEdit_cameraRGBDImages_path_rgb -> text ());
settings . setValue ( "path_depth" , _ui -> lineEdit_cameraRGBDImages_path_depth -> text ());
settings . setValue ( "scale" , _ui -> doubleSpinBox_cameraRGBDImages_scale -> value ());
settings . endGroup (); // RGBDImages
2015-06-26 18:21:32 -04:00
settings . beginGroup ( "StereoImages" );
2015-07-30 14:17:29 -04:00
settings . setValue ( "path_left" , _ui -> lineEdit_cameraStereoImages_path_left -> text ());
settings . setValue ( "path_right" , _ui -> lineEdit_cameraStereoImages_path_right -> text ());
2015-07-16 14:44:25 -04:00
settings . setValue ( "rectify" , _ui -> checkBox_stereoImages_rectify -> isChecked ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // StereoImages
2015-07-16 14:44:25 -04:00
settings . beginGroup ( "StereoVideo" );
settings . setValue ( "path" , _ui -> lineEdit_cameraStereoVideo_path -> text ());
settings . setValue ( "rectify" , _ui -> checkBox_stereoVideo_rectify -> isChecked ());
settings . endGroup (); // StereoVideo
2016-05-31 19:09:49 -04:00
settings . beginGroup ( "StereoZed" );
2016-06-02 17:27:12 -04:00
settings . setValue ( "resolution" , _ui -> comboBox_stereoZed_resolution -> currentIndex ());
settings . setValue ( "quality" , _ui -> comboBox_stereoZed_quality -> currentIndex ());
settings . setValue ( "sensing_mode" , _ui -> comboBox_stereoZed_sensingMode -> currentIndex ());
settings . setValue ( "confidence_thr" , _ui -> spinBox_stereoZed_confidenceThr -> value ());
settings . setValue ( "svo_path" , _ui -> lineEdit_zedSvoPath -> text ());
2016-05-31 19:09:49 -04:00
settings . endGroup (); // StereoZed
2015-06-26 18:21:32 -04:00
settings . beginGroup ( "Images" );
2011-06-05 14:45:39 +00:00
settings . setValue ( "path" , _ui -> source_images_lineEdit_path -> text ());
settings . setValue ( "startPos" , _ui -> source_images_spinBox_startPos -> value ());
settings . setValue ( "refreshDir" , _ui -> source_images_refreshDir -> isChecked ());
2015-07-16 14:44:25 -04:00
settings . setValue ( "rectify" , _ui -> checkBox_rgbImages_rectify -> isChecked ());
2016-01-19 17:43:33 -05:00
settings . setValue ( "bayerMode" , _ui -> comboBox_cameraImages_bayerMode -> currentIndex ());
2016-01-06 17:26:55 -05:00
settings . setValue ( "filenames_as_stamps" , _ui -> checkBox_cameraImages_timestamps -> isChecked ());
2016-01-13 18:13:44 -05:00
settings . setValue ( "sync_stamps" , _ui -> checkBox_cameraImages_syncTimeStamps -> isChecked ());
2016-01-06 17:26:55 -05:00
settings . setValue ( "stamps" , _ui -> lineEdit_cameraImages_timestamps -> text ());
settings . setValue ( "path_scans" , _ui -> lineEdit_cameraImages_path_scans -> text ());
settings . setValue ( "scan_transform" , _ui -> lineEdit_cameraImages_laser_transform -> text ());
settings . setValue ( "scan_max_pts" , _ui -> spinBox_cameraImages_max_scan_pts -> value ());
2016-01-08 19:15:49 -05:00
settings . setValue ( "scan_downsample_step" , _ui -> spinBox_cameraImages_scanDownsampleStep -> value ());
settings . setValue ( "scan_voxel_size" , _ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value ());
2016-01-06 17:26:55 -05:00
settings . setValue ( "gt_path" , _ui -> lineEdit_cameraImages_gt -> text ());
settings . setValue ( "gt_format" , _ui -> comboBox_cameraImages_gtFormat -> currentIndex ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // images
2011-06-05 14:45:39 +00:00
2015-06-26 18:21:32 -04:00
settings . beginGroup ( "Video" );
settings . setValue ( "path" , _ui -> source_video_lineEdit_path -> text ());
2015-07-16 14:44:25 -04:00
settings . setValue ( "rectify" , _ui -> checkBox_rgbVideo_rectify -> isChecked ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // video
2012-06-24 17:19:34 +00:00
2016-01-06 17:26:55 -05:00
settings . beginGroup ( "ScanFromDepth" );
settings . setValue ( "enabled" , _ui -> groupBox_scanFromDepth -> isChecked ());
settings . setValue ( "decimation" , _ui -> spinBox_cameraScanFromDepth_decimation -> value ());
settings . setValue ( "maxDepth" , _ui -> doubleSpinBox_cameraSCanFromDepth_maxDepth -> value ());
2016-01-08 19:15:49 -05:00
settings . setValue ( "voxelSize" , _ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value ());
settings . setValue ( "normalsK" , _ui -> spinBox_cameraImages_scanNormalsK -> value ());
2016-01-06 17:26:55 -05:00
settings . endGroup ();
2016-01-11 17:21:06 -05:00
settings . beginGroup ( "DepthFromScan" );
settings . setValue ( "depthFromScan" , _ui -> groupBox_depthFromScan -> isChecked ());
2016-03-10 12:31:22 -05:00
settings . setValue ( "depthFromScanFillHoles" , _ui -> groupBox_depthFromScan_fillHoles -> isChecked ());
settings . setValue ( "depthFromScanVertical" , _ui -> radioButton_depthFromScan_vertical -> isChecked ());
settings . setValue ( "depthFromScanHorizontal" , _ui -> radioButton_depthFromScan_horizontal -> isChecked ());
2016-01-11 17:21:06 -05:00
settings . setValue ( "depthFromScanFillBorders" , _ui -> checkBox_depthFromScan_fillBorders -> isChecked ());
settings . endGroup ();
2012-06-24 17:19:34 +00:00
settings . beginGroup ( "Database" );
2015-07-30 14:17:29 -04:00
settings . setValue ( "path" , _ui -> source_database_lineEdit_path -> text ());
settings . setValue ( "ignoreOdometry" , _ui -> source_checkBox_ignoreOdometry -> isChecked ());
settings . setValue ( "ignoreGoalDelay" , _ui -> source_checkBox_ignoreGoalDelay -> isChecked ());
2015-10-13 12:50:25 -04:00
settings . setValue ( "ignoreGoals" , _ui -> source_checkBox_ignoreGoals -> isChecked ());
2015-07-30 14:17:29 -04:00
settings . setValue ( "startPos" , _ui -> source_spinBox_databaseStartPos -> value ());
2015-05-01 07:30:09 -04:00
settings . setValue ( "useDatabaseStamps" , _ui -> source_checkBox_useDbStamps -> isChecked ());
2015-06-26 18:21:32 -04:00
settings . endGroup (); // Database
settings . endGroup (); // Camera
2013-12-11 00:12:44 +00:00
2015-04-06 00:28:04 -04:00
_calibrationDialog -> saveSettings ( settings , "CalibrationDialog" );
2011-06-05 14:45:39 +00:00
}
2015-02-13 16:50:32 -05:00
void PreferencesDialog :: writeCoreSettings ( const QString & filePath ) const
2011-06-05 14:45:39 +00:00
{
QString path = getIniFilePath ();
if ( ! filePath . isEmpty ())
{
path = filePath ;
}
QSettings settings ( path , QSettings :: IniFormat );
settings . beginGroup ( "Core" );
2016-01-05 16:57:13 -05:00
settings . remove ( "" );
2011-06-05 14:45:39 +00:00
2014-10-02 15:12:56 +00:00
// save current RTAB-Map version
settings . setValue ( "Version" , QString ( RTABMAP_VERSION ));
2011-06-05 14:45:39 +00:00
const rtabmap :: ParametersMap & parameters = Parameters :: getDefaultParameters ();
for ( rtabmap :: ParametersMap :: const_iterator iter = parameters . begin (); iter != parameters . end (); ++ iter )
{
QObject * obj = _ui -> stackedWidget -> findChild < QObject *> (( * iter ). first . c_str ());
if ( obj )
{
QSpinBox * spin = qobject_cast < QSpinBox *> ( obj );
QDoubleSpinBox * doubleSpin = qobject_cast < QDoubleSpinBox *> ( obj );
QComboBox * combo = qobject_cast < QComboBox *> ( obj );
QCheckBox * check = qobject_cast < QCheckBox *> ( obj );
2013-12-11 00:12:44 +00:00
QRadioButton * radio = qobject_cast < QRadioButton *> ( obj );
2011-06-05 14:45:39 +00:00
QLineEdit * lineEdit = qobject_cast < QLineEdit *> ( obj );
2014-01-22 19:49:28 +00:00
QGroupBox * groupBox = qobject_cast < QGroupBox *> ( obj );
2011-06-05 14:45:39 +00:00
if ( spin )
{
settings . setValue ( obj -> objectName (), spin -> value ());
}
else if ( doubleSpin )
{
settings . setValue ( obj -> objectName (), doubleSpin -> value ());
}
else if ( combo )
{
settings . setValue ( obj -> objectName (), combo -> currentIndex ());
}
else if ( check )
{
2012-03-03 01:46:30 +00:00
settings . setValue ( obj -> objectName (), uBool2Str ( check -> isChecked ()). c_str ());
2011-06-05 14:45:39 +00:00
}
2013-12-11 00:12:44 +00:00
else if ( radio )
{
settings . setValue ( obj -> objectName (), uBool2Str ( radio -> isChecked ()). c_str ());
}
2011-06-05 14:45:39 +00:00
else if ( lineEdit )
{
settings . setValue ( obj -> objectName (), lineEdit -> text ());
}
2014-01-22 19:49:28 +00:00
else if ( groupBox )
{
settings . setValue ( obj -> objectName (), uBool2Str ( groupBox -> isChecked ()). c_str ());
}
2011-06-05 14:45:39 +00:00
else
{
ULOGGER_WARN ( "QObject called %s can't be cast to a supported widget" , ( * iter ). first . c_str ());
}
}
else
{
ULOGGER_WARN ( "Can't find the related QObject for parameter %s" , ( * iter ). first . c_str ());
}
}
settings . endGroup (); // Core
}
bool PreferencesDialog :: validateForm ()
{
2016-03-01 14:25:00 -05:00
#ifndef RTABMAP_NONFREE
// verify that SURF/SIFT cannot be selected if not built with OpenCV nonfree module
// BOW dictionary type
if ( _ui -> comboBox_detector_strategy -> currentIndex () <= 1 )
2014-11-21 23:37:23 +00:00
{
2016-03-01 14:25:00 -05:00
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Selected feature type (SURF/SIFT) is not available. RTAB-Map is not built "
"with the nonfree module from OpenCV. ORB is set instead for the bag-of-words dictionary." ));
_ui -> comboBox_detector_strategy -> setCurrentIndex ( Feature2D :: kFeatureOrb );
2014-11-21 23:37:23 +00:00
}
2016-03-01 14:25:00 -05:00
// BOW Reextract features type
if ( _ui -> reextract_type -> currentIndex () <= 1 )
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Selected feature type (SURF/SIFT) is not available. RTAB-Map is not built "
"with the nonfree module from OpenCV. Fast/Brief is set instead for the re-extraction "
"of features on loop closure." ));
_ui -> reextract_type -> setCurrentIndex ( Feature2D :: kFeatureFastBrief );
}
#endif
2014-09-09 21:54:32 +00:00
2015-03-12 17:00:56 -04:00
// optimization strategy
2016-03-01 14:25:00 -05:00
if ( _ui -> graphOptimization_type -> currentIndex () == 0 && ! Optimizer :: isAvailable ( Optimizer :: kTypeTORO ))
2015-03-12 17:00:56 -04:00
{
2016-03-01 14:25:00 -05:00
if ( Optimizer :: isAvailable ( Optimizer :: kTypeGTSAM ))
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Selected graph optimization strategy (TORO) is not available. RTAB-Map is not built "
"with TORO. GTSAM is set instead for graph optimization strategy." ));
_ui -> graphOptimization_type -> setCurrentIndex ( Optimizer :: kTypeGTSAM );
}
else if ( Optimizer :: isAvailable ( Optimizer :: kTypeG2O ))
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Selected graph optimization strategy (TORO) is not available. RTAB-Map is not built "
"with TORO. g2o is set instead for graph optimization strategy." ));
_ui -> graphOptimization_type -> setCurrentIndex ( Optimizer :: kTypeG2O );
}
}
if ( _ui -> graphOptimization_type -> currentIndex () == 1 && ! Optimizer :: isAvailable ( Optimizer :: kTypeG2O ))
{
if ( Optimizer :: isAvailable ( Optimizer :: kTypeGTSAM ))
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Selected graph optimization strategy (g2o) is not available. RTAB-Map is not built "
"with g2o. GTSAM is set instead for graph optimization strategy." ));
_ui -> graphOptimization_type -> setCurrentIndex ( Optimizer :: kTypeGTSAM );
}
else if ( Optimizer :: isAvailable ( Optimizer :: kTypeTORO ))
2015-03-12 17:00:56 -04:00
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Selected graph optimization strategy (g2o) is not available. RTAB-Map is not built "
"with g2o. TORO is set instead for graph optimization strategy." ));
2015-11-27 11:09:39 -05:00
_ui -> graphOptimization_type -> setCurrentIndex ( Optimizer :: kTypeTORO );
2015-03-12 17:00:56 -04:00
}
}
2016-03-01 14:25:00 -05:00
if ( _ui -> graphOptimization_type -> currentIndex () == 2 && ! Optimizer :: isAvailable ( Optimizer :: kTypeGTSAM ))
2015-09-02 17:51:43 -04:00
{
2016-03-01 14:25:00 -05:00
if ( Optimizer :: isAvailable ( Optimizer :: kTypeG2O ))
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Selected graph optimization strategy (GTSAM) is not available. RTAB-Map is not built "
"with GTSAM. g2o is set instead for graph optimization strategy." ));
_ui -> graphOptimization_type -> setCurrentIndex ( Optimizer :: kTypeG2O );
}
else if ( Optimizer :: isAvailable ( Optimizer :: kTypeTORO ))
2015-09-02 17:51:43 -04:00
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Selected graph optimization strategy (GTSAM) is not available. RTAB-Map is not built "
"with GTSAM. TORO is set instead for graph optimization strategy." ));
2015-11-27 11:09:39 -05:00
_ui -> graphOptimization_type -> setCurrentIndex ( Optimizer :: kTypeTORO );
2015-09-02 17:51:43 -04:00
}
}
2015-03-12 17:00:56 -04:00
2016-03-01 14:25:00 -05:00
// verify that Robust and Reject threshold are not set at the same time
2016-03-01 17:33:27 -05:00
if ( _ui -> graphOptimization_robust -> isChecked () && _ui -> graphOptimization_maxError -> value () > 0.0 )
2016-03-01 14:25:00 -05:00
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Robust graph optimization and maximum optimization error threshold cannot be "
"both used at the same time. Disabling robust optimization." ));
_ui -> graphOptimization_robust -> setChecked ( false );
}
2014-11-21 23:37:23 +00:00
//verify binary features and nearest neighbor
2014-09-09 21:54:32 +00:00
// BOW dictionary type
if ( _ui -> comboBox_dictionary_strategy -> currentIndex () == VWDictionary :: kNNFlannLSH && _ui -> comboBox_detector_strategy -> currentIndex () <= 1 )
2014-06-22 03:33:56 +00:00
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
2014-09-09 21:54:32 +00:00
tr ( "With the selected feature type (SURF or SIFT), parameter \" Visual word->Nearest Neighbor \" "
2014-11-21 23:37:23 +00:00
"cannot be LSH (used for binary descriptor). KD-tree is set instead for the bag-of-words dictionary." ));
2014-06-22 03:33:56 +00:00
_ui -> comboBox_dictionary_strategy -> setCurrentIndex ( VWDictionary :: kNNFlannKdTree );
}
2014-09-21 16:51:51 +00:00
// BOW Reextract features type
if ( _ui -> reextract_nn -> currentIndex () == VWDictionary :: kNNFlannLSH && _ui -> reextract_type -> currentIndex () <= 1 )
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "With the selected feature type (SURF or SIFT), parameter \" Visual word->Nearest Neighbor \" "
2014-11-21 23:37:23 +00:00
"cannot be LSH (used for binary descriptor). KD-tree is set instead for the re-extraction "
"of features on loop closure." ));
2014-09-21 16:51:51 +00:00
_ui -> reextract_nn -> setCurrentIndex ( VWDictionary :: kNNFlannKdTree );
}
2015-11-04 18:31:52 -05:00
if ( _ui -> doubleSpinBox_freenect2MinDepth -> value () >= _ui -> doubleSpinBox_freenect2MaxDepth -> value ())
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Freenect2 minimum depth (%1 m) should be lower than maximum depth (%2 m). Setting maximum depth to %3 m." )
. arg ( _ui -> doubleSpinBox_freenect2MinDepth -> value ())
. arg ( _ui -> doubleSpinBox_freenect2MaxDepth -> value ())
. arg ( _ui -> doubleSpinBox_freenect2MaxDepth -> value () + 1 ));
_ui -> doubleSpinBox_freenect2MaxDepth -> setValue ( _ui -> doubleSpinBox_freenect2MaxDepth -> value () + 1 );
}
2015-11-22 18:08:32 -05:00
if ( _ui -> surf_doubleSpinBox_maxDepth -> value () > 0.0 &&
_ui -> surf_doubleSpinBox_minDepth -> value () >= _ui -> surf_doubleSpinBox_maxDepth -> value ())
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Visual word minimum depth (%1 m) should be lower than maximum depth (%2 m). Setting maximum depth to %3 m." )
. arg ( _ui -> surf_doubleSpinBox_minDepth -> value ())
. arg ( _ui -> surf_doubleSpinBox_maxDepth -> value ())
. arg ( _ui -> surf_doubleSpinBox_maxDepth -> value () + 1 ));
_ui -> doubleSpinBox_freenect2MinDepth -> setValue ( 0 );
}
if ( _ui -> loopClosure_bowMaxDepth -> value () > 0.0 &&
_ui -> loopClosure_bowMinDepth -> value () >= _ui -> loopClosure_bowMaxDepth -> value ())
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "Visual registration word minimum depth (%1 m) should be lower than maximum depth (%2 m). Setting maximum depth to %3 m." )
. arg ( _ui -> loopClosure_bowMinDepth -> value ())
. arg ( _ui -> loopClosure_bowMaxDepth -> value ())
. arg ( _ui -> loopClosure_bowMaxDepth -> value () + 1 ));
_ui -> loopClosure_bowMinDepth -> setValue ( 0 );
}
2015-11-25 19:56:14 -05:00
if ( _ui -> fastThresholdMax -> value () < _ui -> fastThresholdMin -> value ())
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "FAST minimum threshold cannot be lower than maximum threshold. Setting minimum to 1." ));
_ui -> fastThresholdMin -> setValue ( 1 );
}
if ( _ui -> fastThreshold -> value () > _ui -> fastThresholdMax -> value ())
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "FAST threshold cannot be higher than maximum threshold. Maximum value set to current threshold." ));
_ui -> fastThresholdMax -> setValue ( _ui -> fastThreshold -> value ());
}
if ( _ui -> fastThreshold -> value () < _ui -> fastThresholdMin -> value ())
{
QMessageBox :: warning ( this , tr ( "Parameter warning" ),
tr ( "FAST threshold cannot be lower than minimum threshold. Minimum value set to current threshold." ));
_ui -> fastThresholdMin -> setValue ( _ui -> fastThreshold -> value ());
}
2011-06-05 14:45:39 +00:00
return true ;
}
QString PreferencesDialog :: getParamMessage ()
{
return tr ( "Reading parameters from the configuration file..." );
}
void PreferencesDialog :: showEvent ( QShowEvent * event )
{
2013-12-11 00:12:44 +00:00
if ( _monitoringState )
{
// In monitoring state, you cannot change remote paths
_ui -> lineEdit_dictionaryPath -> setEnabled ( false );
_ui -> toolButton_dictionaryPath -> setEnabled ( false );
_ui -> label_dictionaryPath -> setEnabled ( false );
_ui -> groupBox_source0 -> setEnabled ( false );
2015-12-11 17:44:15 -05:00
_ui -> groupBox_odometry1 -> setEnabled ( false );
2013-12-11 00:12:44 +00:00
2016-02-22 17:57:40 -05:00
_ui -> checkBox_useOdomFeatures -> setChecked ( false );
_ui -> checkBox_useOdomFeatures -> setEnabled ( false );
2013-12-11 00:12:44 +00:00
this -> setWindowTitle ( tr ( "Preferences [Monitoring mode]" ));
}
else
{
_ui -> lineEdit_dictionaryPath -> setEnabled ( true );
_ui -> toolButton_dictionaryPath -> setEnabled ( true );
_ui -> label_dictionaryPath -> setEnabled ( true );
2014-02-13 21:32:46 +00:00
2013-12-11 00:12:44 +00:00
_ui -> groupBox_source0 -> setEnabled ( true );
2015-12-11 17:44:15 -05:00
_ui -> groupBox_odometry1 -> setEnabled ( true );
2013-12-11 00:12:44 +00:00
2016-02-22 17:57:40 -05:00
_ui -> checkBox_useOdomFeatures -> setEnabled ( true );
2013-12-11 00:12:44 +00:00
this -> setWindowTitle ( tr ( "Preferences" ));
}
2011-06-09 13:57:01 +00:00
this -> readSettingsBegin ();
}
void PreferencesDialog :: readSettingsBegin ()
{
_progressDialog -> setLabelText ( this -> getParamMessage ());
_progressDialog -> show ();
// this will let the MainThread to display the progress dialog before reading the parameters...
QTimer :: singleShot ( 10 , this , SLOT ( readSettingsEnd ()));
}
void PreferencesDialog :: readSettingsEnd ()
{
QApplication :: processEvents ();
2011-06-05 14:45:39 +00:00
2015-02-13 16:50:32 -05:00
this -> readSettings ( getTmpIniFilePath ());
2011-06-09 13:57:01 +00:00
_progressDialog -> setValue ( 1 );
2012-06-26 14:57:31 +00:00
if ( this -> isVisible ())
{
_progressDialog -> setLabelText ( tr ( "Setup dialog..." ));
2011-06-09 13:57:01 +00:00
2012-06-26 14:57:31 +00:00
this -> updatePredictionPlot ();
this -> setupKpRoiPanel ();
}
2011-06-09 13:57:01 +00:00
_progressDialog -> setValue ( 2 ); // this will make closing...
2011-06-05 14:45:39 +00:00
}
2015-01-23 11:17:42 -05:00
void PreferencesDialog :: saveWindowGeometry ( const QWidget * window )
2011-06-05 14:45:39 +00:00
{
2015-01-30 15:30:57 -05:00
if ( ! window -> objectName (). isNull () && ! window -> isMaximized ())
2015-01-23 11:17:42 -05:00
{
2015-01-30 15:30:57 -05:00
QSettings settings ( getIniFilePath (), QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( window -> objectName ());
settings . setValue ( "geometry" , window -> saveGeometry ());
settings . endGroup (); // "windowName"
settings . endGroup (); // rtabmap
2015-01-23 11:17:42 -05:00
}
2011-06-05 14:45:39 +00:00
}
2015-01-23 11:17:42 -05:00
void PreferencesDialog :: loadWindowGeometry ( QWidget * window )
2011-06-05 14:45:39 +00:00
{
2015-01-23 11:17:42 -05:00
if ( ! window -> objectName (). isNull ())
2011-06-05 14:45:39 +00:00
{
2015-01-23 11:17:42 -05:00
QByteArray bytes ;
QSettings settings ( getIniFilePath (), QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( window -> objectName ());
bytes = settings . value ( "geometry" , QByteArray ()). toByteArray ();
if ( ! bytes . isEmpty ())
{
window -> restoreGeometry ( bytes );
}
settings . endGroup (); // "windowName"
settings . endGroup (); // rtabmap
2011-06-05 14:45:39 +00:00
}
}
void PreferencesDialog :: saveMainWindowState ( const QMainWindow * mainWindow )
{
2015-01-23 11:17:42 -05:00
if ( ! mainWindow -> objectName (). isNull ())
{
saveWindowGeometry ( mainWindow );
2011-06-05 14:45:39 +00:00
2015-01-23 11:17:42 -05:00
QSettings settings ( getIniFilePath (), QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( mainWindow -> objectName ());
settings . setValue ( "state" , mainWindow -> saveState ());
2015-01-30 15:30:57 -05:00
settings . setValue ( "maximized" , mainWindow -> isMaximized ());
2015-09-04 13:46:37 -04:00
settings . setValue ( "status_bar" , mainWindow -> statusBar () -> isVisible ());
2015-01-23 11:17:42 -05:00
settings . endGroup (); // "MainWindow"
settings . endGroup (); // rtabmap
}
2011-06-05 14:45:39 +00:00
}
2015-09-04 13:46:37 -04:00
void PreferencesDialog :: loadMainWindowState ( QMainWindow * mainWindow , bool & maximized , bool & statusBarShown )
2011-06-05 14:45:39 +00:00
{
2015-01-23 11:17:42 -05:00
if ( ! mainWindow -> objectName (). isNull ())
2011-06-05 14:45:39 +00:00
{
2015-01-23 11:17:42 -05:00
loadWindowGeometry ( mainWindow );
2011-06-05 14:45:39 +00:00
2015-01-23 11:17:42 -05:00
QByteArray bytes ;
QSettings settings ( getIniFilePath (), QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( mainWindow -> objectName ());
bytes = settings . value ( "state" , QByteArray ()). toByteArray ();
if ( ! bytes . isEmpty ())
{
mainWindow -> restoreState ( bytes );
}
2015-01-30 15:30:57 -05:00
maximized = settings . value ( "maximized" , false ). toBool ();
2015-09-04 13:46:37 -04:00
statusBarShown = settings . value ( "status_bar" , false ). toBool ();
mainWindow -> statusBar () -> setVisible ( statusBarShown );
2015-01-23 11:17:42 -05:00
settings . endGroup (); // "MainWindow"
settings . endGroup (); // rtabmap
}
2011-06-05 14:45:39 +00:00
}
2015-01-23 11:17:42 -05:00
void PreferencesDialog :: saveWidgetState ( const QWidget * widget )
2015-01-13 18:11:34 -05:00
{
2015-01-23 11:17:42 -05:00
if ( ! widget -> objectName (). isNull ())
2015-01-13 18:11:34 -05:00
{
2015-01-23 11:17:42 -05:00
QSettings settings ( getIniFilePath (), QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( widget -> objectName ());
const CloudViewer * cloudViewer = qobject_cast < const CloudViewer *> ( widget );
const ImageView * imageView = qobject_cast < const ImageView *> ( widget );
const ExportCloudsDialog * exportCloudsDialog = qobject_cast < const ExportCloudsDialog *> ( widget );
2016-03-14 17:27:53 -04:00
const ExportScansDialog * exportScansDialog = qobject_cast < const ExportScansDialog *> ( widget );
2015-01-23 11:17:42 -05:00
const PostProcessingDialog * postProcessingDialog = qobject_cast < const PostProcessingDialog *> ( widget );
2015-01-30 15:30:57 -05:00
const GraphViewer * graphViewer = qobject_cast < const GraphViewer *> ( widget );
2015-04-06 00:28:04 -04:00
const CalibrationDialog * calibrationDialog = qobject_cast < const CalibrationDialog *> ( widget );
2015-01-23 11:17:42 -05:00
if ( cloudViewer )
2015-01-13 18:11:34 -05:00
{
2015-03-04 17:27:44 -05:00
cloudViewer -> saveSettings ( settings );
2015-01-23 11:17:42 -05:00
}
else if ( imageView )
{
2015-03-04 17:27:44 -05:00
imageView -> saveSettings ( settings );
2015-01-23 11:17:42 -05:00
}
else if ( exportCloudsDialog )
{
2015-03-04 17:27:44 -05:00
exportCloudsDialog -> saveSettings ( settings );
2015-01-23 11:17:42 -05:00
}
2016-03-14 17:27:53 -04:00
else if ( exportScansDialog )
{
exportScansDialog -> saveSettings ( settings );
}
2015-01-23 11:17:42 -05:00
else if ( postProcessingDialog )
{
2015-03-04 17:27:44 -05:00
postProcessingDialog -> saveSettings ( settings );
2015-01-23 11:17:42 -05:00
}
2015-01-30 15:30:57 -05:00
else if ( graphViewer )
{
2015-03-04 17:27:44 -05:00
graphViewer -> saveSettings ( settings );
2015-01-30 15:30:57 -05:00
}
2015-04-06 00:28:04 -04:00
else if ( calibrationDialog )
{
calibrationDialog -> saveSettings ( settings );
}
2015-01-23 11:17:42 -05:00
else
{
UERROR ( "Widget \" %s \" cannot be exported in config file." , widget -> objectName (). toStdString (). c_str ());
2015-01-13 18:11:34 -05:00
}
2015-01-14 11:02:17 -05:00
2015-01-23 11:17:42 -05:00
settings . endGroup (); // "name"
settings . endGroup (); // Gui
2015-01-13 18:11:34 -05:00
}
}
2015-01-23 11:17:42 -05:00
void PreferencesDialog :: loadWidgetState ( QWidget * widget )
2015-01-13 18:11:34 -05:00
{
2015-01-23 11:17:42 -05:00
if ( ! widget -> objectName (). isNull ())
2015-01-14 11:02:17 -05:00
{
2015-01-23 11:17:42 -05:00
QByteArray bytes ;
QSettings settings ( getIniFilePath (), QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( widget -> objectName ());
2015-01-14 11:02:17 -05:00
2015-01-23 11:17:42 -05:00
CloudViewer * cloudViewer = qobject_cast < CloudViewer *> ( widget );
ImageView * imageView = qobject_cast < ImageView *> ( widget );
ExportCloudsDialog * exportCloudsDialog = qobject_cast < ExportCloudsDialog *> ( widget );
2016-03-14 17:27:53 -04:00
ExportScansDialog * exportScansDialog = qobject_cast < ExportScansDialog *> ( widget );
2015-01-23 11:17:42 -05:00
PostProcessingDialog * postProcessingDialog = qobject_cast < PostProcessingDialog *> ( widget );
2015-01-30 15:30:57 -05:00
GraphViewer * graphViewer = qobject_cast < GraphViewer *> ( widget );
2015-04-06 00:28:04 -04:00
CalibrationDialog * calibrationDialog = qobject_cast < CalibrationDialog *> ( widget );
2015-01-14 11:02:17 -05:00
2015-01-23 11:17:42 -05:00
if ( cloudViewer )
2015-01-14 11:02:17 -05:00
{
2015-03-04 17:27:44 -05:00
cloudViewer -> loadSettings ( settings );
2015-01-23 11:17:42 -05:00
}
else if ( imageView )
{
2015-03-04 17:27:44 -05:00
imageView -> loadSettings ( settings );
2015-01-23 11:17:42 -05:00
}
else if ( exportCloudsDialog )
{
2015-03-04 17:27:44 -05:00
exportCloudsDialog -> loadSettings ( settings );
2015-01-23 11:17:42 -05:00
}
2016-03-14 17:27:53 -04:00
else if ( exportScansDialog )
{
exportScansDialog -> loadSettings ( settings );
}
2015-01-23 11:17:42 -05:00
else if ( postProcessingDialog )
{
2015-03-04 17:27:44 -05:00
postProcessingDialog -> loadSettings ( settings );
2015-01-23 11:17:42 -05:00
}
2015-01-30 15:30:57 -05:00
else if ( graphViewer )
{
2015-03-04 17:27:44 -05:00
graphViewer -> loadSettings ( settings );
2015-01-30 15:30:57 -05:00
}
2015-04-06 00:28:04 -04:00
else if ( calibrationDialog )
{
calibrationDialog -> loadSettings ( settings );
}
2015-01-23 11:17:42 -05:00
else
{
UERROR ( "Widget \" %s \" cannot be loaded from config file." , widget -> objectName (). toStdString (). c_str ());
2015-01-14 11:02:17 -05:00
}
2015-01-23 11:17:42 -05:00
settings . endGroup (); //"name"
settings . endGroup (); // Gui
2015-01-14 11:02:17 -05:00
}
2015-01-13 18:11:34 -05:00
}
2015-01-14 11:02:17 -05:00
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: saveCustomConfig ( const QString & section , const QString & key , const QString & value )
{
QSettings settings ( getIniFilePath (), QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( section );
settings . setValue ( key , value );
settings . endGroup (); // "section"
settings . endGroup (); // rtabmap
}
QString PreferencesDialog :: loadCustomConfig ( const QString & section , const QString & key )
{
QString value ;
QSettings settings ( getIniFilePath (), QSettings :: IniFormat );
settings . beginGroup ( "Gui" );
settings . beginGroup ( section );
value = settings . value ( key , QString ()). toString ();
settings . endGroup (); // "section"
settings . endGroup (); // rtabmap
return value ;
}
2016-01-19 17:43:33 -05:00
rtabmap :: ParametersMap PreferencesDialog :: getAllParameters () const
2016-01-07 19:39:21 -05:00
{
2016-01-12 13:54:37 -05:00
UASSERT_MSG ( _parameters . size () == Parameters :: getDefaultParameters (). size (),
2016-01-12 15:41:55 -05:00
uFormat ( "%d vs %d (Is PreferencesDialog::init() called?)" , ( int ) _parameters . size (), ( int ) Parameters :: getDefaultParameters (). size ()). c_str ());
2016-01-19 17:43:33 -05:00
ParametersMap parameters = _parameters ;
uInsert ( parameters , _modifiedParameters );
return parameters ;
2016-01-07 19:39:21 -05:00
}
2015-06-26 18:21:32 -04:00
void PreferencesDialog :: selectSourceDriver ( Src src )
2011-06-05 14:45:39 +00:00
{
2015-06-26 18:21:32 -04:00
if ( src >= kSrcRGBD && src < kSrcStereo )
2011-06-05 14:45:39 +00:00
{
2015-06-26 18:21:32 -04:00
_ui -> comboBox_sourceType -> setCurrentIndex ( 0 );
_ui -> comboBox_cameraRGBD -> setCurrentIndex ( src - kSrcRGBD );
if ( src == kSrcOpenNI_PCL )
2011-06-05 14:45:39 +00:00
{
2015-06-26 18:21:32 -04:00
_ui -> lineEdit_openniOniPath -> clear ();
2011-06-05 14:45:39 +00:00
}
2015-06-26 18:21:32 -04:00
else if ( src == kSrcOpenNI2 )
2011-06-05 14:45:39 +00:00
{
2015-06-26 18:21:32 -04:00
_ui -> lineEdit_openni2OniPath -> clear ();
2011-06-05 14:45:39 +00:00
}
}
2015-06-26 18:21:32 -04:00
else if ( src >= kSrcStereo && src < kSrcRGB )
2011-06-05 14:45:39 +00:00
{
2015-06-26 18:21:32 -04:00
_ui -> comboBox_sourceType -> setCurrentIndex ( 1 );
2016-05-31 19:09:49 -04:00
_ui -> comboBox_cameraStereo -> setCurrentIndex ( src - kSrcStereo );
2011-06-05 14:45:39 +00:00
}
2015-06-26 18:21:32 -04:00
else if ( src >= kSrcRGB && src < kSrcDatabase )
2015-01-12 16:53:18 -05:00
{
2015-06-26 18:21:32 -04:00
_ui -> comboBox_sourceType -> setCurrentIndex ( 2 );
2016-05-31 19:09:49 -04:00
_ui -> source_comboBox_image_type -> setCurrentIndex ( src - kSrcRGB );
2015-03-01 19:41:03 -05:00
}
2015-06-26 18:21:32 -04:00
else if ( src >= kSrcDatabase )
2015-03-01 19:41:03 -05:00
{
2015-06-26 18:21:32 -04:00
_ui -> comboBox_sourceType -> setCurrentIndex ( 3 );
2015-06-11 16:57:16 -04:00
}
2015-01-12 16:53:18 -05:00
if ( validateForm ())
{
// Even if there is no change, MainWindow should be notified
makeObsoleteSourcePanel ();
2015-02-13 16:50:32 -05:00
this -> writeSettings ( getTmpIniFilePath ());
2015-01-12 16:53:18 -05:00
}
else
{
this -> readSettingsBegin ();
2011-06-05 14:45:39 +00:00
}
}
2015-06-26 18:21:32 -04:00
void PreferencesDialog :: selectSourceDatabase ()
{
QString dir = _ui -> source_database_lineEdit_path -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QStringList paths = QFileDialog :: getOpenFileNames ( this , tr ( "Select file" ), dir , tr ( "RTAB-Map database files (*.db)" ));
if ( paths . size ())
{
int r = QMessageBox :: question ( this , tr ( "Odometry in database..." ), tr ( "Use odometry saved in database (if some saved)?" ), QMessageBox :: Yes | QMessageBox :: No , QMessageBox :: Yes );
_ui -> source_checkBox_ignoreOdometry -> setChecked ( r != QMessageBox :: Yes );
_ui -> source_database_lineEdit_path -> setText ( paths . size () == 1 ? paths . front () : paths . join ( ";" ));
_ui -> source_spinBox_databaseStartPos -> setValue ( 0 );
2015-07-06 17:46:05 -04:00
_ui -> source_checkBox_useDbStamps -> setChecked ( true );
2015-06-26 18:21:32 -04:00
}
}
2012-12-11 18:05:05 +00:00
void PreferencesDialog :: openDatabaseViewer ()
{
2015-12-21 17:27:05 -05:00
DatabaseViewer * viewer = new DatabaseViewer ( getIniFilePath (), this );
2012-12-11 18:05:05 +00:00
viewer -> setWindowModality ( Qt :: WindowModal );
2015-04-28 11:52:39 -04:00
viewer -> setAttribute ( Qt :: WA_DeleteOnClose , true );
2015-04-28 13:04:35 -04:00
viewer -> showCloseButton ();
2012-12-11 18:05:05 +00:00
if ( viewer -> openDatabase ( _ui -> source_database_lineEdit_path -> text ()))
{
viewer -> show ();
}
else
{
delete viewer ;
}
}
2015-11-22 18:08:32 -05:00
void PreferencesDialog :: selectCalibrationPath ()
{
QString dir = _ui -> lineEdit_calibrationFile -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory () + "/camera_info" ;
}
2016-01-19 17:43:33 -05:00
else if ( ! dir . contains ( '.' ))
{
dir = getWorkingDirectory () + "/camera_info/" + dir ;
}
2015-11-22 18:08:32 -05:00
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Select file" ), dir , tr ( "Calibration file (*.yaml)" ));
if ( path . size ())
{
_ui -> lineEdit_calibrationFile -> setText ( path );
}
}
2016-01-06 17:26:55 -05:00
void PreferencesDialog :: selectSourceImagesStamps ()
2015-07-30 14:17:29 -04:00
{
2016-01-06 17:26:55 -05:00
QString dir = _ui -> lineEdit_cameraImages_timestamps -> text ();
2015-07-30 14:17:29 -04:00
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Select file" ), dir , tr ( "Timestamps file (*.txt)" ));
if ( path . size ())
{
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_timestamps -> setText ( path );
2015-07-30 14:17:29 -04:00
}
}
void PreferencesDialog :: selectSourceRGBDImagesPathRGB ()
{
QString dir = _ui -> lineEdit_cameraRGBDImages_path_rgb -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getExistingDirectory ( this , tr ( "Select RGB images directory" ), dir );
if ( path . size ())
{
_ui -> lineEdit_cameraRGBDImages_path_rgb -> setText ( path );
}
}
2015-12-17 14:13:19 -05:00
2016-01-06 17:26:55 -05:00
void PreferencesDialog :: selectSourceImagesPathScans ()
2015-12-17 14:13:19 -05:00
{
2016-01-06 17:26:55 -05:00
QString dir = _ui -> lineEdit_cameraImages_path_scans -> text ();
2015-12-17 14:13:19 -05:00
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getExistingDirectory ( this , tr ( "Select scans directory" ), dir );
if ( path . size ())
{
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_path_scans -> setText ( path );
2015-12-17 14:13:19 -05:00
}
}
2015-07-30 14:17:29 -04:00
void PreferencesDialog :: selectSourceRGBDImagesPathDepth ()
{
QString dir = _ui -> lineEdit_cameraRGBDImages_path_depth -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getExistingDirectory ( this , tr ( "Select depth images directory" ), dir );
if ( path . size ())
{
_ui -> lineEdit_cameraRGBDImages_path_depth -> setText ( path );
}
}
2016-01-06 17:26:55 -05:00
void PreferencesDialog :: selectSourceImagesPathGt ()
2015-12-17 14:13:19 -05:00
{
2016-01-06 17:26:55 -05:00
QString dir = _ui -> lineEdit_cameraImages_gt -> text ();
2015-12-17 14:13:19 -05:00
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
2016-01-19 17:43:33 -05:00
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Select file" ), dir , tr ( "Ground Truth (*.txt *.log *.toro *.g2o)" ));
2015-12-17 14:13:19 -05:00
if ( path . size ())
{
QStringList list ;
2016-01-06 17:26:55 -05:00
for ( int i = 0 ; i < _ui -> comboBox_cameraImages_gtFormat -> count (); ++ i )
2015-12-17 14:13:19 -05:00
{
2016-01-06 17:26:55 -05:00
list . push_back ( _ui -> comboBox_cameraImages_gtFormat -> itemText ( i ));
2015-12-17 14:13:19 -05:00
}
2015-12-22 19:32:52 -05:00
QString item = QInputDialog :: getItem ( this , tr ( "Ground Truth Format" ), tr ( "Format:" ), list , 0 , false );
2015-12-17 14:13:19 -05:00
if ( ! item . isEmpty ())
{
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_gt -> setText ( path );
_ui -> comboBox_cameraImages_gtFormat -> setCurrentIndex ( _ui -> comboBox_cameraImages_gtFormat -> findText ( item ));
2015-12-17 14:13:19 -05:00
}
}
}
2015-07-30 14:17:29 -04:00
void PreferencesDialog :: selectSourceStereoImagesPathLeft ()
2015-06-11 16:57:16 -04:00
{
2015-07-30 14:17:29 -04:00
QString dir = _ui -> lineEdit_cameraStereoImages_path_left -> text ();
2015-06-11 16:57:16 -04:00
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
2015-07-30 14:17:29 -04:00
QString path = QFileDialog :: getExistingDirectory ( this , tr ( "Select left images directory" ), dir );
2015-06-11 16:57:16 -04:00
if ( path . size ())
{
2015-07-30 14:17:29 -04:00
_ui -> lineEdit_cameraStereoImages_path_left -> setText ( path );
}
}
void PreferencesDialog :: selectSourceStereoImagesPathRight ()
{
QString dir = _ui -> lineEdit_cameraStereoImages_path_right -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getExistingDirectory ( this , tr ( "Select right images directory" ), dir );
if ( path . size ())
{
_ui -> lineEdit_cameraStereoImages_path_right -> setText ( path );
2015-06-11 16:57:16 -04:00
}
}
2015-06-26 18:21:32 -04:00
void PreferencesDialog :: selectSourceImagesPath ()
{
QString dir = _ui -> source_images_lineEdit_path -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getExistingDirectory ( this , tr ( "Select images directory" ), _ui -> source_images_lineEdit_path -> text ());
if ( ! path . isEmpty ())
{
_ui -> source_images_lineEdit_path -> setText ( path );
2015-12-17 14:13:19 -05:00
_ui -> source_images_spinBox_startPos -> setValue ( 0 );
2015-06-26 18:21:32 -04:00
}
}
void PreferencesDialog :: selectSourceVideoPath ()
{
QString dir = _ui -> source_video_lineEdit_path -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Select file" ), _ui -> source_video_lineEdit_path -> text (), tr ( "Videos (*.avi *.mpg *.mp4)" ));
if ( ! path . isEmpty ())
{
_ui -> source_video_lineEdit_path -> setText ( path );
}
}
2015-07-16 14:44:25 -04:00
void PreferencesDialog :: selectSourceStereoVideoPath ()
{
QString dir = _ui -> lineEdit_cameraStereoVideo_path -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Select file" ), _ui -> lineEdit_cameraStereoVideo_path -> text (), tr ( "Videos (*.avi *.mpg *.mp4)" ));
if ( ! path . isEmpty ())
{
_ui -> lineEdit_cameraStereoVideo_path -> setText ( path );
}
}
2015-06-26 18:21:32 -04:00
void PreferencesDialog :: selectSourceOniPath ()
{
QString dir = _ui -> lineEdit_openniOniPath -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Select file" ), _ui -> lineEdit_openniOniPath -> text (), tr ( "OpenNI (*.oni)" ));
if ( ! path . isEmpty ())
{
_ui -> lineEdit_openniOniPath -> setText ( path );
}
}
void PreferencesDialog :: selectSourceOni2Path ()
{
QString dir = _ui -> lineEdit_openni2OniPath -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Select file" ), _ui -> lineEdit_openni2OniPath -> text (), tr ( "OpenNI (*.oni)" ));
if ( ! path . isEmpty ())
{
_ui -> lineEdit_openni2OniPath -> setText ( path );
}
}
2016-06-02 17:27:12 -04:00
void PreferencesDialog :: selectSourceSvoPath ()
{
QString dir = _ui -> lineEdit_zedSvoPath -> text ();
if ( dir . isEmpty ())
{
dir = getWorkingDirectory ();
}
QString path = QFileDialog :: getOpenFileName ( this , tr ( "Select file" ), _ui -> lineEdit_zedSvoPath -> text (), tr ( "ZED (*.svo)" ));
if ( ! path . isEmpty ())
{
_ui -> lineEdit_zedSvoPath -> setText ( path );
}
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: setParameter ( const std :: string & key , const std :: string & value )
{
2011-06-09 16:00:45 +00:00
UDEBUG ( "%s=%s" , key . c_str (), value . c_str ());
2014-06-22 03:33:56 +00:00
QWidget * obj = _ui -> stackedWidget -> findChild < QWidget *> ( key . c_str ());
2011-06-05 14:45:39 +00:00
if ( obj )
{
2016-06-13 17:34:17 -04:00
uInsert ( _parameters , ParametersPair ( key , value ));
2014-10-14 21:48:50 +00:00
QSpinBox * spin = qobject_cast < QSpinBox *> ( obj );
QDoubleSpinBox * doubleSpin = qobject_cast < QDoubleSpinBox *> ( obj );
QComboBox * combo = qobject_cast < QComboBox *> ( obj );
QCheckBox * check = qobject_cast < QCheckBox *> ( obj );
QRadioButton * radio = qobject_cast < QRadioButton *> ( obj );
QLineEdit * lineEdit = qobject_cast < QLineEdit *> ( obj );
QGroupBox * groupBox = qobject_cast < QGroupBox *> ( obj );
bool ok ;
if ( spin )
2011-06-05 14:45:39 +00:00
{
2014-10-14 21:48:50 +00:00
spin -> setValue ( QString ( value . c_str ()). toInt ( & ok ));
if ( ! ok )
2012-12-11 18:05:05 +00:00
{
2014-10-14 21:48:50 +00:00
UERROR ( "Conversion failed from \" %s \" for parameter %s" , value . c_str (), key . c_str ());
2012-12-11 18:05:05 +00:00
}
2014-10-14 21:48:50 +00:00
}
else if ( doubleSpin )
{
doubleSpin -> setValue ( QString ( value . c_str ()). toDouble ( & ok ));
if ( ! ok )
2012-12-11 18:05:05 +00:00
{
2014-10-14 21:48:50 +00:00
UERROR ( "Conversion failed from \" %s \" for parameter %s" , value . c_str (), key . c_str ());
2012-12-11 18:05:05 +00:00
}
2014-10-14 21:48:50 +00:00
}
else if ( combo )
{
2014-11-21 23:37:23 +00:00
int valueInt = QString ( value . c_str ()). toInt ( & ok );
2014-10-14 21:48:50 +00:00
if ( ! ok )
2012-12-11 18:05:05 +00:00
{
2014-10-14 21:48:50 +00:00
UERROR ( "Conversion failed from \" %s \" for parameter %s" , value . c_str (), key . c_str ());
2012-12-11 18:05:05 +00:00
}
2014-11-21 23:37:23 +00:00
else
{
2016-03-01 14:25:00 -05:00
#ifndef RTABMAP_NONFREE
if ( valueInt <= 1 &&
( combo -> objectName (). toStdString (). compare ( Parameters :: kKpDetectorStrategy ()) == 0 ||
combo -> objectName (). toStdString (). compare ( Parameters :: kVisFeatureType ()) == 0 ))
2014-11-21 23:37:23 +00:00
{
2016-03-01 14:25:00 -05:00
UWARN ( "Trying to set \" %s \" to SIFT/SURF but RTAB-Map isn't built "
"with the nonfree module from OpenCV. Keeping default combo value: %s." ,
combo -> objectName (). toStdString (). c_str (),
combo -> currentText (). toStdString (). c_str ());
ok = false ;
2014-11-21 23:37:23 +00:00
}
2016-03-01 14:25:00 -05:00
#endif
2015-11-27 11:09:39 -05:00
if ( ! Optimizer :: isAvailable ( Optimizer :: kTypeG2O ))
2015-03-12 17:00:56 -04:00
{
2015-11-27 11:09:39 -05:00
if ( valueInt == 1 && combo -> objectName (). toStdString (). compare ( Parameters :: kOptimizerStrategy ()) == 0 )
2015-03-12 17:00:56 -04:00
{
UWARN ( "Trying to set \" %s \" to g2o but RTAB-Map isn't built "
"with g2o. Keeping default combo value: %s." ,
combo -> objectName (). toStdString (). c_str (),
combo -> currentText (). toStdString (). c_str ());
ok = false ;
}
}
2015-11-27 11:09:39 -05:00
if ( ! Optimizer :: isAvailable ( Optimizer :: kTypeGTSAM ))
2015-09-02 17:51:43 -04:00
{
2015-11-27 11:09:39 -05:00
if ( valueInt == 2 && combo -> objectName (). toStdString (). compare ( Parameters :: kOptimizerStrategy ()) == 0 )
2015-09-02 17:51:43 -04:00
{
UWARN ( "Trying to set \" %s \" to GTSAM but RTAB-Map isn't built "
"with GTSAM. Keeping default combo value: %s." ,
combo -> objectName (). toStdString (). c_str (),
combo -> currentText (). toStdString (). c_str ());
ok = false ;
}
}
2015-03-12 17:00:56 -04:00
if ( ok )
2014-11-21 23:37:23 +00:00
{
combo -> setCurrentIndex ( valueInt );
}
}
2014-01-22 19:49:28 +00:00
}
2014-10-14 21:48:50 +00:00
else if ( check )
{
check -> setChecked ( uStr2Bool ( value . c_str ()));
}
else if ( radio )
{
radio -> setChecked ( uStr2Bool ( value . c_str ()));
}
else if ( lineEdit )
{
lineEdit -> setText ( value . c_str ());
}
else if ( groupBox )
{
groupBox -> setChecked ( uStr2Bool ( value . c_str ()));
}
2011-06-05 14:45:39 +00:00
else
{
2014-10-14 21:48:50 +00:00
ULOGGER_WARN ( "QObject called %s can't be cast to a supported widget" , key . c_str ());
2011-06-05 14:45:39 +00:00
}
}
else
{
ULOGGER_WARN ( "Can't find the related QObject for parameter %s" , key . c_str ());
}
}
void PreferencesDialog :: addParameter ( int value )
{
if ( sender ())
{
this -> addParameter ( sender (), value );
}
else
{
ULOGGER_ERROR ( "This slot must be triggered by a signal, not a direct call..." );
}
}
2013-12-11 00:12:44 +00:00
void PreferencesDialog :: addParameter ( bool value )
{
if ( sender ())
{
this -> addParameter ( sender (), value );
}
else
{
ULOGGER_ERROR ( "This slot must be triggered by a signal, not a direct call..." );
}
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: addParameter ( double value )
{
if ( sender ())
{
this -> addParameter ( sender (), value );
}
else
{
ULOGGER_ERROR ( "This slot must be triggered by a signal, not a direct call..." );
}
}
void PreferencesDialog :: addParameter ( const QString & value )
{
if ( sender ())
{
this -> addParameter ( sender (), value );
}
else
{
ULOGGER_ERROR ( "This slot must be triggered by a signal, not a direct call..." );
}
}
void PreferencesDialog :: addParameter ( const QObject * object , int value )
{
if ( object )
{
2012-03-03 01:46:30 +00:00
const QComboBox * comboBox = qobject_cast < const QComboBox *> ( object );
const QSpinBox * spinbox = qobject_cast < const QSpinBox *> ( object );
if ( comboBox || spinbox )
{
2016-01-14 15:30:52 -05:00
// Add parameter
UDEBUG ( "modify param %s=%s" , object -> objectName (). toStdString (). c_str (), uNumber2Str ( value ). c_str ());
uInsert ( _modifiedParameters , rtabmap :: ParametersPair ( object -> objectName (). toStdString (), QString :: number ( value ). toStdString ()));
2012-03-03 01:46:30 +00:00
}
2013-12-11 00:12:44 +00:00
else
{
UWARN ( "Undefined object \" %s \" " , object -> objectName (). toStdString (). c_str ());
}
}
else
{
ULOGGER_ERROR ( "Object is null" );
}
}
void PreferencesDialog :: addParameter ( const QObject * object , bool value )
{
if ( object )
{
const QCheckBox * checkbox = qobject_cast < const QCheckBox *> ( object );
const QRadioButton * radio = qobject_cast < const QRadioButton *> ( object );
2014-01-22 19:49:28 +00:00
const QGroupBox * groupBox = qobject_cast < const QGroupBox *> ( object );
if ( checkbox || radio || groupBox )
2012-03-03 01:46:30 +00:00
{
// Add parameter
2016-01-14 15:30:52 -05:00
UDEBUG ( "modify param %s=%s" , object -> objectName (). toStdString (). c_str (), uBool2Str ( value ). c_str ());
2016-01-07 19:39:21 -05:00
uInsert ( _modifiedParameters , rtabmap :: ParametersPair ( object -> objectName (). toStdString (), uBool2Str ( value )));
2012-03-03 01:46:30 +00:00
}
else
{
UWARN ( "Undefined object \" %s \" " , object -> objectName (). toStdString (). c_str ());
}
2011-06-05 14:45:39 +00:00
}
else
{
ULOGGER_ERROR ( "Object is null" );
}
}
void PreferencesDialog :: addParameter ( const QObject * object , double value )
{
if ( object )
{
2016-01-14 15:30:52 -05:00
UDEBUG ( "modify param %s=%s" , object -> objectName (). toStdString (). c_str (), uBool2Str ( value ). c_str ());
2016-01-07 19:39:21 -05:00
uInsert ( _modifiedParameters , rtabmap :: ParametersPair ( object -> objectName (). toStdString (), QString :: number ( value ). toStdString ()));
2011-06-05 14:45:39 +00:00
}
else
{
ULOGGER_ERROR ( "Object is null" );
}
}
void PreferencesDialog :: addParameter ( const QObject * object , const QString & value )
{
if ( object )
{
2016-01-14 15:30:52 -05:00
UDEBUG ( "modify param %s=%s" , object -> objectName (). toStdString (). c_str (), value . toStdString (). c_str ());
2016-01-07 19:39:21 -05:00
uInsert ( _modifiedParameters , rtabmap :: ParametersPair ( object -> objectName (). toStdString (), value . toStdString ()));
2011-06-05 14:45:39 +00:00
}
else
{
ULOGGER_ERROR ( "Object is null" );
}
}
2013-12-11 00:12:44 +00:00
void PreferencesDialog :: addParameters ( const QObjectList & children )
{
//ULOGGER_DEBUG("PreferencesDialog::addParameters(QGroupBox) box %s has %d children", box->objectName().toStdString().c_str(), children.size());
for ( int i = 0 ; i < children . size (); ++ i )
{
const QSpinBox * spin = qobject_cast < const QSpinBox *> ( children [ i ]);
const QDoubleSpinBox * doubleSpin = qobject_cast < const QDoubleSpinBox *> ( children [ i ]);
const QComboBox * combo = qobject_cast < const QComboBox *> ( children [ i ]);
const QCheckBox * check = qobject_cast < const QCheckBox *> ( children [ i ]);
const QRadioButton * radio = qobject_cast < const QRadioButton *> ( children [ i ]);
const QLineEdit * lineEdit = qobject_cast < const QLineEdit *> ( children [ i ]);
const QGroupBox * groupBox = qobject_cast < const QGroupBox *> ( children [ i ]);
const QStackedWidget * stackedWidget = qobject_cast < const QStackedWidget *> ( children [ i ]);
if ( spin )
{
this -> addParameter ( spin , spin -> value ());
}
else if ( doubleSpin )
{
this -> addParameter ( doubleSpin , doubleSpin -> value ());
}
else if ( combo )
{
this -> addParameter ( combo , combo -> currentIndex ());
}
else if ( check )
{
this -> addParameter ( check , check -> isChecked ());
}
else if ( radio )
{
this -> addParameter ( radio , radio -> isChecked ());
}
else if ( lineEdit )
{
this -> addParameter ( lineEdit , lineEdit -> text ());
}
else if ( groupBox )
{
2014-01-22 19:49:28 +00:00
if ( groupBox -> isCheckable ())
{
this -> addParameter ( groupBox , groupBox -> isChecked ());
}
else
{
this -> addParameters ( groupBox );
}
2013-12-11 00:12:44 +00:00
}
else if ( stackedWidget )
{
this -> addParameters ( stackedWidget );
}
}
}
2015-09-02 17:51:43 -04:00
void PreferencesDialog :: addParameters ( const QStackedWidget * stackedWidget , int panel )
2013-12-11 00:12:44 +00:00
{
if ( stackedWidget )
{
2015-09-02 17:51:43 -04:00
if ( panel == - 1 )
2013-12-11 00:12:44 +00:00
{
2015-09-02 17:51:43 -04:00
for ( int i = 0 ; i < stackedWidget -> count (); ++ i )
{
const QObjectList & children = stackedWidget -> widget ( i ) -> children ();
addParameters ( children );
}
}
else
{
UASSERT ( panel < stackedWidget -> count ());
const QObjectList & children = stackedWidget -> widget ( panel ) -> children ();
2013-12-11 00:12:44 +00:00
addParameters ( children );
}
}
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: addParameters ( const QGroupBox * box )
{
if ( box )
{
2013-12-11 00:12:44 +00:00
const QObjectList & children = box -> children ();
addParameters ( children );
2011-06-05 14:45:39 +00:00
}
}
2012-06-24 17:19:34 +00:00
void PreferencesDialog :: updateBasicParameter ()
{
// This method is used to update basic/advanced referred parameters, see above editingFinished()
// basic to advanced (advanced to basic must be done by connecting signal valueChanged())
if ( sender () == _ui -> general_doubleSpinBox_timeThr_2 )
{
_ui -> general_doubleSpinBox_timeThr -> setValue ( _ui -> general_doubleSpinBox_timeThr_2 -> value ());
}
else if ( sender () == _ui -> general_doubleSpinBox_hardThr_2 )
{
_ui -> general_doubleSpinBox_hardThr -> setValue ( _ui -> general_doubleSpinBox_hardThr_2 -> value ());
}
2013-12-11 00:12:44 +00:00
else if ( sender () == _ui -> general_doubleSpinBox_detectionRate_2 )
2012-06-24 17:19:34 +00:00
{
2013-12-11 00:12:44 +00:00
_ui -> general_doubleSpinBox_detectionRate -> setValue ( _ui -> general_doubleSpinBox_detectionRate_2 -> value ());
2012-06-24 17:19:34 +00:00
}
else if ( sender () == _ui -> general_spinBox_imagesBufferSize_2 )
{
_ui -> general_spinBox_imagesBufferSize -> setValue ( _ui -> general_spinBox_imagesBufferSize_2 -> value ());
}
else if ( sender () == _ui -> general_spinBox_maxStMemSize_2 )
{
_ui -> general_spinBox_maxStMemSize -> setValue ( _ui -> general_spinBox_maxStMemSize_2 -> value ());
}
2014-10-18 13:12:45 +00:00
else if ( sender () == _ui -> groupBox_publishing )
2012-06-24 17:19:34 +00:00
{
2014-10-18 13:12:45 +00:00
_ui -> general_checkBox_publishStats_2 -> setChecked ( _ui -> groupBox_publishing -> isChecked ());
2012-06-24 17:19:34 +00:00
}
else if ( sender () == _ui -> general_checkBox_publishStats_2 )
{
2014-10-18 13:12:45 +00:00
_ui -> groupBox_publishing -> setChecked ( _ui -> general_checkBox_publishStats_2 -> isChecked ());
2012-06-24 17:19:34 +00:00
}
2012-12-11 18:05:05 +00:00
else if ( sender () == _ui -> doubleSpinBox_similarityThreshold_2 )
{
_ui -> doubleSpinBox_similarityThreshold -> setValue ( _ui -> doubleSpinBox_similarityThreshold_2 -> value ());
}
2013-12-11 00:12:44 +00:00
else if ( sender () == _ui -> general_checkBox_activateRGBD )
{
_ui -> general_checkBox_activateRGBD_2 -> setChecked ( _ui -> general_checkBox_activateRGBD -> isChecked ());
}
else if ( sender () == _ui -> general_checkBox_activateRGBD_2 )
{
_ui -> general_checkBox_activateRGBD -> setChecked ( _ui -> general_checkBox_activateRGBD_2 -> isChecked ());
}
else if ( sender () == _ui -> general_checkBox_SLAM_mode )
{
_ui -> general_checkBox_SLAM_mode_2 -> setChecked ( _ui -> general_checkBox_SLAM_mode -> isChecked ());
}
else if ( sender () == _ui -> general_checkBox_SLAM_mode_2 )
{
_ui -> general_checkBox_SLAM_mode -> setChecked ( _ui -> general_checkBox_SLAM_mode_2 -> isChecked ());
}
2012-06-24 17:19:34 +00:00
else
{
//update all values (only those using editingFinished signal)
_ui -> general_doubleSpinBox_timeThr -> setValue ( _ui -> general_doubleSpinBox_timeThr_2 -> value ());
_ui -> general_doubleSpinBox_hardThr -> setValue ( _ui -> general_doubleSpinBox_hardThr_2 -> value ());
2013-12-11 00:12:44 +00:00
_ui -> general_doubleSpinBox_detectionRate -> setValue ( _ui -> general_doubleSpinBox_detectionRate_2 -> value ());
2012-06-24 17:19:34 +00:00
_ui -> general_spinBox_imagesBufferSize -> setValue ( _ui -> general_spinBox_imagesBufferSize_2 -> value ());
_ui -> general_spinBox_maxStMemSize -> setValue ( _ui -> general_spinBox_maxStMemSize_2 -> value ());
2012-12-11 18:05:05 +00:00
_ui -> doubleSpinBox_similarityThreshold -> setValue ( _ui -> doubleSpinBox_similarityThreshold_2 -> value ());
2012-06-24 17:19:34 +00:00
}
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: makeObsoleteGeneralPanel ()
{
ULOGGER_DEBUG ( "" );
_obsoletePanels = _obsoletePanels | kPanelGeneral ;
}
2013-12-11 00:12:44 +00:00
void PreferencesDialog :: makeObsoleteCloudRenderingPanel ()
{
ULOGGER_DEBUG ( "" );
_obsoletePanels = _obsoletePanels | kPanelCloudRendering ;
}
void PreferencesDialog :: makeObsoleteLoggingPanel ()
{
ULOGGER_DEBUG ( "" );
_obsoletePanels = _obsoletePanels | kPanelLogging ;
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: makeObsoleteSourcePanel ()
{
_obsoletePanels = _obsoletePanels | kPanelSource ;
}
QList < QGroupBox *> PreferencesDialog :: getGroupBoxes ()
{
QList < QGroupBox *> boxes ;
for ( int i = 0 ; i < _ui -> stackedWidget -> count (); ++ i )
{
QGroupBox * gb = 0 ;
const QObjectList & children = _ui -> stackedWidget -> widget ( i ) -> children ();
for ( int j = 0 ; j < children . size (); ++ j )
{
if (( gb = qobject_cast < QGroupBox *> ( children . at ( j ))))
{
//ULOGGER_DEBUG("PreferencesDialog::setupTreeView() index(%d) Added %s, box name=%s", i, gb->title().toStdString().c_str(), gb->objectName().toStdString().c_str());
break ;
}
}
if ( gb )
{
boxes . append ( gb );
}
else
{
ULOGGER_ERROR ( "A QGroupBox must be included in the first level of children in stacked widget, index=%d" , i );
}
}
return boxes ;
}
2012-03-03 01:46:30 +00:00
void PreferencesDialog :: updatePredictionPlot ()
2011-06-05 14:45:39 +00:00
{
2012-12-11 18:05:05 +00:00
QStringList values = _ui -> lineEdit_bayes_predictionLC -> text (). simplified (). split ( ' ' );
2012-06-26 14:57:31 +00:00
if ( values . size () < 2 )
{
UERROR ( "Error parsing prediction (must have at least 2 items) : %s" ,
_ui -> lineEdit_bayes_predictionLC -> text (). toStdString (). c_str ());
return ;
}
2012-03-03 01:46:30 +00:00
QVector < float > dataX (( values . size () - 2 ) * 2 + 1 );
QVector < float > dataY (( values . size () - 2 ) * 2 + 1 );
double value ;
double sum = 0 ;
int lvl = 1 ;
bool ok = false ;
bool error = false ;
int loopClosureIndex = ( dataX . size () - 1 ) / 2 ;
for ( int i = 0 ; i < values . size (); ++ i )
2011-06-05 14:45:39 +00:00
{
2012-03-03 01:46:30 +00:00
value = values . at ( i ). toDouble ( & ok );
2011-06-05 14:45:39 +00:00
if ( ! ok )
{
2012-12-11 18:05:05 +00:00
UERROR ( "Error parsing prediction : \" %s \" " , values . at ( i ). toStdString (). c_str ());
2012-03-03 01:46:30 +00:00
error = true ;
2011-06-05 14:45:39 +00:00
}
sum += value ;
if ( i == 0 )
{
//do nothing
}
else if ( i == 1 )
{
dataY [ loopClosureIndex ] = value ;
dataX [ loopClosureIndex ] = 0 ;
}
else
{
dataY [ loopClosureIndex - lvl ] = value ;
dataX [ loopClosureIndex - lvl ] = - lvl ;
dataY [ loopClosureIndex + lvl ] = value ;
dataX [ loopClosureIndex + lvl ] = lvl ;
++ lvl ;
}
}
_ui -> label_prediction_sum -> setNum ( sum );
2012-03-03 01:46:30 +00:00
if ( error )
2011-06-05 14:45:39 +00:00
{
_ui -> label_prediction_sum -> setText ( QString ( "<font color=#FF0000>" ) + _ui -> label_prediction_sum -> text () + "</font>" );
}
2012-03-03 01:46:30 +00:00
else if ( sum == 1.0 )
{
_ui -> label_prediction_sum -> setText ( QString ( "<font color=#00FF00>" ) + _ui -> label_prediction_sum -> text () + "</font>" );
}
else if ( sum > 1.0 )
2011-06-05 14:45:39 +00:00
{
_ui -> label_prediction_sum -> setText ( QString ( "<font color=#FFa500>" ) + _ui -> label_prediction_sum -> text () + "</font>" );
}
else
{
_ui -> label_prediction_sum -> setText ( QString ( "<font color=#000000>" ) + _ui -> label_prediction_sum -> text () + "</font>" );
}
_ui -> predictionPlot -> removeCurves ();
2012-06-24 17:19:34 +00:00
_ui -> predictionPlot -> addCurve ( new UPlotCurve ( "Prediction" , dataX , dataY , _ui -> predictionPlot ));
2011-06-05 14:45:39 +00:00
}
void PreferencesDialog :: setupKpRoiPanel ()
{
QStringList strings = _ui -> lineEdit_kp_roi -> text (). split ( ' ' );
if ( strings . size () != 4 )
{
UERROR ( "ROI must have 4 values (%s)" , _ui -> lineEdit_kp_roi -> text (). toStdString (). c_str ());
return ;
}
_ui -> doubleSpinBox_kp_roi0 -> setValue ( strings [ 0 ]. toDouble () * 100.0 );
_ui -> doubleSpinBox_kp_roi1 -> setValue ( strings [ 1 ]. toDouble () * 100.0 );
_ui -> doubleSpinBox_kp_roi2 -> setValue ( strings [ 2 ]. toDouble () * 100.0 );
_ui -> doubleSpinBox_kp_roi3 -> setValue ( strings [ 3 ]. toDouble () * 100.0 );
}
void PreferencesDialog :: updateKpROI ()
{
QStringList strings ;
strings . append ( QString :: number ( _ui -> doubleSpinBox_kp_roi0 -> value () / 100.0 ));
strings . append ( QString :: number ( _ui -> doubleSpinBox_kp_roi1 -> value () / 100.0 ));
strings . append ( QString :: number ( _ui -> doubleSpinBox_kp_roi2 -> value () / 100.0 ));
strings . append ( QString :: number ( _ui -> doubleSpinBox_kp_roi3 -> value () / 100.0 ));
_ui -> lineEdit_kp_roi -> setText ( strings . join ( " " ));
}
2016-02-15 19:35:24 -05:00
void PreferencesDialog :: updateG2oVisibility ()
{
_ui -> groupBox_g2o -> setVisible ( _ui -> graphOptimization_type -> currentIndex () == 1 );
}
2016-02-22 17:57:40 -05:00
void PreferencesDialog :: useOdomFeatures ()
{
if ( this -> isVisible () && _ui -> checkBox_useOdomFeatures -> isChecked ())
{
int r = QMessageBox :: question ( this , tr ( "Using odometry features for vocabulary..." ),
2016-06-12 17:53:35 -04:00
tr ( "Do you want to match vocabulary feature parameters "
"with corresponding ones used for odometry?" ), QMessageBox :: Yes | QMessageBox :: No , QMessageBox :: Yes );
2016-02-22 17:57:40 -05:00
if ( r == QMessageBox :: Yes )
{
_ui -> comboBox_detector_strategy -> setCurrentIndex ( _ui -> reextract_type -> currentIndex ());
_ui -> surf_doubleSpinBox_maxDepth -> setValue ( _ui -> loopClosure_bowMaxDepth -> value ());
_ui -> surf_doubleSpinBox_minDepth -> setValue ( _ui -> loopClosure_bowMinDepth -> value ());
_ui -> surf_spinBox_wordsPerImageTarget -> setValue ( _ui -> reextract_maxFeatures -> value ());
_ui -> lineEdit_kp_roi -> setText ( _ui -> loopClosure_roi -> text ());
_ui -> subpix_winSize_kp -> setValue ( _ui -> subpix_winSize -> value ());
_ui -> subpix_iterations_kp -> setValue ( _ui -> subpix_iterations -> value ());
_ui -> subpix_eps_kp -> setValue ( _ui -> subpix_eps -> value ());
}
}
}
2011-06-05 14:45:39 +00:00
void PreferencesDialog :: changeWorkingDirectory ()
{
QString directory = QFileDialog :: getExistingDirectory ( this , tr ( "Working directory" ), _ui -> lineEdit_workingDirectory -> text ());
if ( ! directory . isEmpty ())
{
ULOGGER_DEBUG ( "New working directory = %s" , directory . toStdString (). c_str ());
_ui -> lineEdit_workingDirectory -> setText ( directory );
}
}
void PreferencesDialog :: changeDictionaryPath ()
{
QString path ;
if ( _ui -> lineEdit_dictionaryPath -> text (). isEmpty ())
{
path = QFileDialog :: getOpenFileName ( this , tr ( "Dictionary" ), this -> getWorkingDirectory ());
}
else
{
path = QFileDialog :: getOpenFileName ( this , tr ( "Dictionary" ), _ui -> lineEdit_dictionaryPath -> text ());
}
if ( ! path . isEmpty ())
{
_ui -> lineEdit_dictionaryPath -> setText ( path );
}
}
2015-06-25 16:04:42 -04:00
void PreferencesDialog :: changeOdomBowFixedLocalMapPath ()
{
QString path ;
if ( _ui -> odom_fixedLocalMapPath -> text (). isEmpty ())
{
path = QFileDialog :: getOpenFileName ( this , tr ( "Database" ), this -> getWorkingDirectory (), tr ( "RTAB-Map database files (*.db)" ));
}
else
{
path = QFileDialog :: getOpenFileName ( this , tr ( "Database" ), _ui -> odom_fixedLocalMapPath -> text (), tr ( "RTAB-Map database files (*.db)" ));
}
if ( ! path . isEmpty ())
{
_ui -> odom_fixedLocalMapPath -> setText ( path );
}
}
2015-06-26 18:21:32 -04:00
void PreferencesDialog :: updateSourceGrpVisibility ()
{
_ui -> groupBox_sourceRGBD -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 0 );
_ui -> groupBox_sourceStereo -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 1 );
_ui -> groupBox_sourceRGB -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 2 );
_ui -> groupBox_sourceDatabase -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 3 );
2016-01-06 17:26:55 -05:00
_ui -> groupBox_scanFromDepth -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () <= 1 );
2015-06-26 18:21:32 -04:00
2016-01-07 14:47:32 -05:00
_ui -> stackedWidget_rgbd -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 0 &&
( _ui -> comboBox_cameraRGBD -> currentIndex () == kSrcOpenNI2 - kSrcRGBD ||
_ui -> comboBox_cameraRGBD -> currentIndex () == kSrcFreenect2 - kSrcRGBD ||
_ui -> comboBox_cameraRGBD -> currentIndex () == kSrcRGBDImages - kSrcRGBD ||
_ui -> comboBox_cameraRGBD -> currentIndex () == kSrcOpenNI_PCL - kSrcRGBD ));
2016-01-06 17:26:55 -05:00
_ui -> groupBox_openni2 -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 0 && _ui -> comboBox_cameraRGBD -> currentIndex () == kSrcOpenNI2 - kSrcRGBD );
_ui -> groupBox_freenect2 -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 0 && _ui -> comboBox_cameraRGBD -> currentIndex () == kSrcFreenect2 - kSrcRGBD );
2016-01-07 14:47:32 -05:00
_ui -> groupBox_cameraRGBDImages -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 0 && _ui -> comboBox_cameraRGBD -> currentIndex () == kSrcRGBDImages - kSrcRGBD );
_ui -> groupBox_openni -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 0 && _ui -> comboBox_cameraRGBD -> currentIndex () == kSrcOpenNI_PCL - kSrcRGBD );
2015-06-26 18:21:32 -04:00
2016-05-31 19:09:49 -04:00
_ui -> stackedWidget_stereo -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 1 &&
( _ui -> comboBox_cameraStereo -> currentIndex () == kSrcStereoVideo - kSrcStereo ||
_ui -> comboBox_cameraStereo -> currentIndex () == kSrcStereoImages - kSrcStereo ||
_ui -> comboBox_cameraStereo -> currentIndex () == kSrcStereoZed - kSrcStereo ));
2016-01-06 17:26:55 -05:00
_ui -> groupBox_cameraStereoImages -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 1 && _ui -> comboBox_cameraStereo -> currentIndex () == kSrcStereoImages - kSrcStereo );
2016-05-31 19:09:49 -04:00
_ui -> groupBox_cameraStereoVideo -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 1 && _ui -> comboBox_cameraStereo -> currentIndex () == kSrcStereoVideo - kSrcStereo );
_ui -> groupBox_cameraStereoZed -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 1 && _ui -> comboBox_cameraStereo -> currentIndex () == kSrcStereoZed - kSrcStereo );
2016-01-06 17:26:55 -05:00
_ui -> stackedWidget_image -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 2 && ( _ui -> source_comboBox_image_type -> currentIndex () == kSrcImages - kSrcRGB || _ui -> source_comboBox_image_type -> currentIndex () == kSrcVideo - kSrcRGB ));
_ui -> source_groupBox_images -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 2 && _ui -> source_comboBox_image_type -> currentIndex () == kSrcImages - kSrcRGB );
_ui -> source_groupBox_video -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 2 && _ui -> source_comboBox_image_type -> currentIndex () == kSrcVideo - kSrcRGB );
_ui -> groupBox_sourceImages_optional -> setVisible (
( _ui -> comboBox_sourceType -> currentIndex () == 0 && _ui -> comboBox_cameraRGBD -> currentIndex () == kSrcRGBDImages - kSrcRGBD ) ||
( _ui -> comboBox_sourceType -> currentIndex () == 1 && _ui -> comboBox_cameraStereo -> currentIndex () == kSrcStereoImages - kSrcStereo ) ||
2016-01-11 17:21:06 -05:00
( _ui -> comboBox_sourceType -> currentIndex () == 2 && _ui -> source_comboBox_image_type -> currentIndex () == kSrcImages - kSrcRGB ));
2016-01-08 19:15:49 -05:00
_ui -> groupBox_scan -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () != 3 );
2016-01-11 17:21:06 -05:00
_ui -> groupBox_depthFromScan -> setVisible ( _ui -> comboBox_sourceType -> currentIndex () == 2 && _ui -> source_comboBox_image_type -> currentIndex () == kSrcImages - kSrcRGB );
2014-11-20 22:00:47 +00:00
}
2011-06-05 14:45:39 +00:00
/*** GETTERS ***/
//General
int PreferencesDialog :: getGeneralLoggerLevel () const
{
return _ui -> comboBox_loggerLevel -> currentIndex ();
}
int PreferencesDialog :: getGeneralLoggerEventLevel () const
{
return _ui -> comboBox_loggerEventLevel -> currentIndex ();
}
int PreferencesDialog :: getGeneralLoggerPauseLevel () const
{
return _ui -> comboBox_loggerPauseLevel -> currentIndex ();
}
int PreferencesDialog :: getGeneralLoggerType () const
{
return _ui -> comboBox_loggerType -> currentIndex ();
}
bool PreferencesDialog :: getGeneralLoggerPrintTime () const
{
return _ui -> checkBox_logger_printTime -> isChecked ();
}
2016-01-05 13:55:21 -05:00
bool PreferencesDialog :: getGeneralLoggerPrintThreadId () const
{
return _ui -> checkBox_logger_printThreadId -> isChecked ();
}
2011-06-05 14:45:39 +00:00
bool PreferencesDialog :: isVerticalLayoutUsed () const
{
return _ui -> checkBox_verticalLayoutUsed -> isChecked ();
}
bool PreferencesDialog :: imageRejectedShown () const
{
return _ui -> checkBox_imageRejectedShown -> isChecked ();
}
2011-06-10 14:04:06 +00:00
bool PreferencesDialog :: imageHighestHypShown () const
{
return _ui -> checkBox_imageHighestHypShown -> isChecked ();
}
2011-06-05 14:45:39 +00:00
bool PreferencesDialog :: beepOnPause () const
{
return _ui -> checkBox_beep -> isChecked ();
}
2015-05-05 17:38:38 -04:00
bool PreferencesDialog :: notifyWhenNewGlobalPathIsReceived () const
{
return _ui -> checkBox_notifyWhenNewGlobalPathIsReceived -> isChecked ();
}
2014-06-06 18:06:49 +00:00
int PreferencesDialog :: getOdomQualityWarnThr () const
{
return _ui -> spinBox_odomQualityWarnThr -> value ();
}
2015-01-07 17:30:20 -05:00
bool PreferencesDialog :: isPosteriorGraphView () const
{
return _ui -> checkBox_posteriorGraphView -> isChecked ();
}
2011-06-05 14:45:39 +00:00
2013-12-11 00:12:44 +00:00
bool PreferencesDialog :: isCloudsShown ( int index ) const
{
2014-07-29 00:52:35 +00:00
UASSERT ( index >= 0 && index <= 1 );
2013-12-11 00:12:44 +00:00
return _3dRenderingShowClouds [ index ] -> isChecked ();
}
2016-06-10 20:12:13 -04:00
double PreferencesDialog :: getMapVoxel () const
{
return _ui -> doubleSpinBox_voxel -> value ();
}
double PreferencesDialog :: getMapNoiseRadius () const
{
return _ui -> doubleSpinBox_noiseRadius -> value ();
}
int PreferencesDialog :: getMapNoiseMinNeighbors () const
{
return _ui -> spinBox_noiseMinNeighbors -> value ();
}
2014-10-30 19:38:58 +00:00
bool PreferencesDialog :: isGraphsShown () const
{
return _ui -> checkBox_showGraphs -> isChecked ();
}
2015-07-26 15:50:39 -04:00
bool PreferencesDialog :: isLabelsShown () const
{
return _ui -> checkBox_showLabels -> isChecked ();
}
2014-07-29 00:52:35 +00:00
bool PreferencesDialog :: isCloudMeshing () const
2013-12-11 00:12:44 +00:00
{
2016-02-15 19:35:24 -05:00
return _ui -> groupBox_organized -> isChecked ();
2013-12-11 00:12:44 +00:00
}
2016-02-15 19:35:24 -05:00
double PreferencesDialog :: getCloudMeshingAngle () const
2013-12-11 00:12:44 +00:00
{
2016-04-12 16:47:55 -04:00
return _ui -> doubleSpinBox_mesh_angleTolerance -> value () * M_PI / 180.0 ;
2016-02-15 19:35:24 -05:00
}
bool PreferencesDialog :: isCloudMeshingQuad () const
{
return _ui -> checkBox_mesh_quad -> isChecked ();
}
int PreferencesDialog :: getCloudMeshingTriangleSize ()
{
return _ui -> spinBox_mesh_triangleSize -> value ();
2013-12-11 00:12:44 +00:00
}
int PreferencesDialog :: getCloudDecimation ( int index ) const
{
2014-07-29 00:52:35 +00:00
UASSERT ( index >= 0 && index <= 1 );
2013-12-11 00:12:44 +00:00
return _3dRenderingDecimation [ index ] -> value ();
}
double PreferencesDialog :: getCloudMaxDepth ( int index ) const
{
2014-07-29 00:52:35 +00:00
UASSERT ( index >= 0 && index <= 1 );
2013-12-11 00:12:44 +00:00
return _3dRenderingMaxDepth [ index ] -> value ();
}
2016-04-12 15:14:04 -04:00
double PreferencesDialog :: getCloudMinDepth ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingMinDepth [ index ] -> value ();
}
2013-12-11 00:12:44 +00:00
double PreferencesDialog :: getCloudOpacity ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingOpacity [ index ] -> value ();
}
int PreferencesDialog :: getCloudPointSize ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingPtSize [ index ] -> value ();
}
bool PreferencesDialog :: isScansShown ( int index ) const
{
2014-07-29 00:52:35 +00:00
UASSERT ( index >= 0 && index <= 1 );
2013-12-11 00:12:44 +00:00
return _3dRenderingShowScans [ index ] -> isChecked ();
}
2015-11-22 18:08:32 -05:00
int PreferencesDialog :: getDownsamplingStepScan ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingDownsamplingScan [ index ] -> value ();
}
double PreferencesDialog :: getCloudVoxelSizeScan ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingVoxelSizeScan [ index ] -> value ();
}
2013-12-11 00:12:44 +00:00
double PreferencesDialog :: getScanOpacity ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingOpacityScan [ index ] -> value ();
}
int PreferencesDialog :: getScanPointSize ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingPtSizeScan [ index ] -> value ();
}
2016-03-01 17:33:27 -05:00
bool PreferencesDialog :: isFeaturesShown ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingShowFeatures [ index ] -> isChecked ();
}
int PreferencesDialog :: getFeaturesPointSize ( int index ) const
{
UASSERT ( index >= 0 && index <= 1 );
return _3dRenderingPtSizeFeatures [ index ] -> value ();
}
2014-02-13 21:32:46 +00:00
bool PreferencesDialog :: isCloudFiltering () const
{
2016-02-15 19:35:24 -05:00
return _ui -> radioButton_nodeFiltering -> isChecked ();
2015-06-29 00:19:45 -04:00
}
bool PreferencesDialog :: isSubtractFiltering () const
{
2016-02-15 19:35:24 -05:00
return _ui -> radioButton_subtractFiltering -> isChecked ();
2014-02-13 21:32:46 +00:00
}
double PreferencesDialog :: getCloudFilteringRadius () const
{
return _ui -> doubleSpinBox_cloudFilterRadius -> value ();
}
double PreferencesDialog :: getCloudFilteringAngle () const
{
return _ui -> doubleSpinBox_cloudFilterAngle -> value ();
}
2016-02-15 19:35:24 -05:00
int PreferencesDialog :: getSubtractFilteringMinPts () const
2015-06-29 00:19:45 -04:00
{
2016-02-15 19:35:24 -05:00
return _ui -> spinBox_subtractFilteringMinPts -> value ();
}
double PreferencesDialog :: getSubtractFilteringRadius () const
{
return _ui -> doubleSpinBox_subtractFilteringRadius -> value ();
}
double PreferencesDialog :: getSubtractFilteringAngle () const
{
return _ui -> doubleSpinBox_subtractFilteringAngle -> value () * M_PI / 180.0 ;
2015-06-29 00:19:45 -04:00
}
2016-06-12 13:51:49 -04:00
int PreferencesDialog :: getNormalKSearch () const
{
return _ui -> spinBox_normalKSearch -> value ();
}
2014-07-29 21:48:37 +00:00
bool PreferencesDialog :: getGridMapShown () const
{
return _ui -> checkBox_map_shown -> isChecked ();
}
double PreferencesDialog :: getGridMapResolution () const
{
return _ui -> doubleSpinBox_map_resolution -> value ();
}
2015-03-20 14:03:09 -04:00
bool PreferencesDialog :: isGridMapEroded () const
{
return _ui -> checkBox_map_erode -> isChecked ();
}
2016-06-10 20:12:13 -04:00
bool PreferencesDialog :: isGridMapFrom3DCloud () const
{
return _ui -> groupBox_map_occupancyFrom3DCloud -> isChecked ();
}
bool PreferencesDialog :: projMapFrame () const
{
return _ui -> checkBox_projMapFrame -> isChecked ();
}
double PreferencesDialog :: projMaxGroundAngle () const
{
return _ui -> doubleSpinBox_projMaxGroundAngle -> value () * M_PI / 180.0 ;
}
double PreferencesDialog :: projMaxGroundHeight () const
{
return _ui -> doubleSpinBox_projMaxGroundHeight -> value ();
}
int PreferencesDialog :: projMinClusterSize () const
{
return _ui -> spinBox_projMinClusterSize -> value ();
}
double PreferencesDialog :: projMaxObstaclesHeight () const
{
return _ui -> doubleSpinBox_projMaxObstaclesHeight -> value ();
}
bool PreferencesDialog :: projFlatObstaclesDetected () const
{
return _ui -> checkBox_projFlatObstaclesDetected -> isChecked ();
}
2014-07-29 21:48:37 +00:00
double PreferencesDialog :: getGridMapOpacity () const
{
return _ui -> doubleSpinBox_map_opacity -> value ();
}
2013-12-11 00:12:44 +00:00
2011-06-05 14:45:39 +00:00
// Source
2012-06-24 17:19:34 +00:00
double PreferencesDialog :: getGeneralInputRate () const
2011-06-05 14:45:39 +00:00
{
return _ui -> general_doubleSpinBox_imgRate -> value ();
}
2015-02-28 18:09:22 -05:00
bool PreferencesDialog :: isSourceMirroring () const
{
return _ui -> source_mirroring -> isChecked ();
}
2015-06-26 18:21:32 -04:00
PreferencesDialog :: Src PreferencesDialog :: getSourceType () const
2012-06-24 17:19:34 +00:00
{
2015-06-26 18:21:32 -04:00
int index = _ui -> comboBox_sourceType -> currentIndex ();
if ( index == 0 )
2015-01-12 16:53:18 -05:00
{
2015-06-26 18:21:32 -04:00
return kSrcRGBD ;
2015-01-12 16:53:18 -05:00
}
2015-06-26 18:21:32 -04:00
else if ( index == 1 )
2015-01-12 16:53:18 -05:00
{
2015-06-26 18:21:32 -04:00
return kSrcStereo ;
2015-01-12 16:53:18 -05:00
}
2015-06-26 18:21:32 -04:00
else if ( index == 2 )
2015-01-12 16:53:18 -05:00
{
2015-06-26 18:21:32 -04:00
return kSrcRGB ;
2015-01-12 16:53:18 -05:00
}
2015-06-26 18:21:32 -04:00
else if ( index == 3 )
{
return kSrcDatabase ;
}
return kSrcUndef ;
2011-06-05 14:45:39 +00:00
}
2015-06-26 18:21:32 -04:00
PreferencesDialog :: Src PreferencesDialog :: getSourceDriver () const
2011-06-05 14:45:39 +00:00
{
2015-06-26 18:21:32 -04:00
PreferencesDialog :: Src type = getSourceType ();
if ( type == kSrcRGBD )
{
return ( PreferencesDialog :: Src )( _ui -> comboBox_cameraRGBD -> currentIndex () + kSrcRGBD );
}
else if ( type == kSrcStereo )
{
return ( PreferencesDialog :: Src )( _ui -> comboBox_cameraStereo -> currentIndex () + kSrcStereo );
}
else if ( type == kSrcRGB )
{
return ( PreferencesDialog :: Src )( _ui -> source_comboBox_image_type -> currentIndex () + kSrcRGB );
}
else if ( type == kSrcDatabase )
{
return kSrcDatabase ;
}
return kSrcUndef ;
2011-06-05 14:45:39 +00:00
}
2015-06-26 18:21:32 -04:00
QString PreferencesDialog :: getSourceDriverStr () const
2011-06-05 14:45:39 +00:00
{
2015-06-26 18:21:32 -04:00
PreferencesDialog :: Src type = getSourceType ();
if ( type == kSrcRGBD )
{
return _ui -> comboBox_cameraRGBD -> currentText ();
}
else if ( type == kSrcStereo )
{
return _ui -> comboBox_cameraStereo -> currentText ();
}
else if ( type == kSrcRGB )
{
return _ui -> source_comboBox_image_type -> currentText ();
}
else if ( type == kSrcDatabase )
{
return "Database" ;
}
return "" ;
2015-05-01 07:30:09 -04:00
}
2014-06-13 03:47:39 +00:00
2015-06-26 18:21:32 -04:00
QString PreferencesDialog :: getSourceDevice () const
2014-06-03 04:42:08 +00:00
{
2015-06-26 18:21:32 -04:00
return _ui -> lineEdit_sourceDevice -> text ();
2014-06-03 04:42:08 +00:00
}
2015-11-22 18:08:32 -05:00
2015-06-26 18:21:32 -04:00
Transform PreferencesDialog :: getSourceLocalTransform () const
2013-12-11 00:12:44 +00:00
{
2015-11-22 18:08:32 -05:00
Transform t = Transform :: fromString ( _ui -> lineEdit_sourceLocalTransform -> text (). replace ( "PI_2" , QString :: number ( 3.141592 / 2.0 )). toStdString ());
if ( t . isNull ())
2013-12-11 00:12:44 +00:00
{
2015-11-22 18:08:32 -05:00
return Transform :: getIdentity ();
2013-12-11 00:12:44 +00:00
}
2015-11-22 18:08:32 -05:00
return t ;
}
2016-01-06 17:26:55 -05:00
Transform PreferencesDialog :: getLaserLocalTransform () const
2015-11-22 18:08:32 -05:00
{
2016-01-06 17:26:55 -05:00
Transform t = Transform :: fromString ( _ui -> lineEdit_cameraImages_laser_transform -> text (). replace ( "PI_2" , QString :: number ( 3.141592 / 2.0 )). toStdString ());
2015-12-17 14:13:19 -05:00
if ( t . isNull ())
{
return Transform :: getIdentity ();
}
return t ;
}
2015-06-26 18:21:32 -04:00
QString PreferencesDialog :: getSourceDatabasePath () const
{
return _ui -> source_database_lineEdit_path -> text ();
}
bool PreferencesDialog :: getSourceDatabaseOdometryIgnored () const
{
return _ui -> source_checkBox_ignoreOdometry -> isChecked ();
}
bool PreferencesDialog :: getSourceDatabaseGoalDelayIgnored () const
{
return _ui -> source_checkBox_ignoreGoalDelay -> isChecked ();
}
2015-10-13 12:50:25 -04:00
bool PreferencesDialog :: getSourceDatabaseGoalsIgnored () const
{
return _ui -> source_checkBox_ignoreGoals -> isChecked ();
}
2015-06-26 18:21:32 -04:00
int PreferencesDialog :: getSourceDatabaseStartPos () const
{
return _ui -> source_spinBox_databaseStartPos -> value ();
}
bool PreferencesDialog :: getSourceDatabaseStampsUsed () const
{
return _ui -> source_checkBox_useDbStamps -> isChecked ();
}
bool PreferencesDialog :: isSourceRGBDColorOnly () const
{
return _ui -> checkbox_rgbd_colorOnly -> isChecked ();
}
2016-01-08 19:15:49 -05:00
int PreferencesDialog :: getSourceImageDecimation () const
{
return _ui -> spinBox_source_imageDecimation -> value ();
}
2015-08-27 17:16:12 -04:00
bool PreferencesDialog :: isSourceStereoDepthGenerated () const
{
return _ui -> checkbox_stereo_depthGenerated -> isChecked ();
}
2016-01-06 17:26:55 -05:00
bool PreferencesDialog :: isSourceScanFromDepth () const
{
return _ui -> groupBox_scanFromDepth -> isChecked ();
}
int PreferencesDialog :: getSourceScanFromDepthDecimation () const
{
return _ui -> spinBox_cameraScanFromDepth_decimation -> value ();
}
double PreferencesDialog :: getSourceScanFromDepthMaxDepth () const
{
return _ui -> doubleSpinBox_cameraSCanFromDepth_maxDepth -> value ();
}
2016-01-08 19:15:49 -05:00
double PreferencesDialog :: getSourceScanVoxelSize () const
{
return _ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value ();
}
int PreferencesDialog :: getSourceScanNormalsK () const
{
return _ui -> spinBox_cameraImages_scanNormalsK -> value ();
}
2015-06-26 18:21:32 -04:00
Camera * PreferencesDialog :: createCamera ( bool useRawImages )
{
Src driver = this -> getSourceDriver ();
Camera * camera = 0 ;
if ( driver == PreferencesDialog :: kSrcOpenNI_PCL )
2015-04-06 00:28:04 -04:00
{
2015-06-26 18:21:32 -04:00
if ( useRawImages )
2015-05-05 18:21:43 -04:00
{
QMessageBox :: warning ( this , tr ( "Calibration" ),
2015-06-26 18:21:32 -04:00
tr ( "Using raw images for \" OpenNI \" driver is not yet supported. "
2015-05-05 18:21:43 -04:00
"Factory calibration loaded from OpenNI is used." ), QMessageBox :: Ok );
return 0 ;
}
else
{
2015-06-26 18:21:32 -04:00
camera = new CameraOpenni (
_ui -> lineEdit_openniOniPath -> text (). isEmpty () ? this -> getSourceDevice (). toStdString () : _ui -> lineEdit_openniOniPath -> text (). toStdString (),
2015-05-05 18:21:43 -04:00
this -> getGeneralInputRate (),
2015-06-26 18:21:32 -04:00
this -> getSourceLocalTransform ());
2015-05-05 18:21:43 -04:00
}
2015-04-06 00:28:04 -04:00
}
2015-06-26 18:21:32 -04:00
else if ( driver == PreferencesDialog :: kSrcOpenNI2 )
2015-04-06 00:28:04 -04:00
{
2015-06-26 18:21:32 -04:00
if ( useRawImages )
2015-05-05 18:21:43 -04:00
{
QMessageBox :: warning ( this , tr ( "Calibration" ),
2015-06-26 18:21:32 -04:00
tr ( "Using raw images for \" OpenNI2 \" driver is not yet supported. "
"Factory calibration loaded from OpenNI2 is used." ), QMessageBox :: Ok );
return 0 ;
}
else
{
camera = new CameraOpenNI2 (
_ui -> lineEdit_openni2OniPath -> text (). isEmpty () ? this -> getSourceDevice (). toStdString () : _ui -> lineEdit_openni2OniPath -> text (). toStdString (),
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
}
}
else if ( driver == PreferencesDialog :: kSrcFreenect )
{
if ( useRawImages )
{
QMessageBox :: warning ( this , tr ( "Calibration" ),
tr ( "Using raw images for \" Freenect \" driver is not yet supported. "
2015-05-05 18:21:43 -04:00
"Factory calibration loaded from Freenect is used." ), QMessageBox :: Ok );
return 0 ;
}
else
{
2015-06-26 18:21:32 -04:00
camera = new CameraFreenect (
this -> getSourceDevice (). isEmpty () ? 0 : atoi ( this -> getSourceDevice (). toStdString (). c_str ()),
2015-05-05 18:21:43 -04:00
this -> getGeneralInputRate (),
2015-06-26 18:21:32 -04:00
this -> getSourceLocalTransform ());
2015-05-05 18:21:43 -04:00
}
2015-04-06 00:28:04 -04:00
}
2015-06-26 18:21:32 -04:00
else if ( driver == PreferencesDialog :: kSrcOpenNI_CV ||
driver == PreferencesDialog :: kSrcOpenNI_CV_ASUS )
2015-04-06 00:28:04 -04:00
{
2015-06-26 18:21:32 -04:00
if ( useRawImages )
2015-05-05 18:21:43 -04:00
{
QMessageBox :: warning ( this , tr ( "Calibration" ),
2015-06-26 18:21:32 -04:00
tr ( "Using raw images for \" OpenNI \" driver is not yet supported. "
2015-05-05 18:21:43 -04:00
"Factory calibration loaded from OpenNI is used." ), QMessageBox :: Ok );
return 0 ;
}
else
{
2015-06-26 18:21:32 -04:00
camera = new CameraOpenNICV (
driver == PreferencesDialog :: kSrcOpenNI_CV_ASUS ,
2015-05-05 18:21:43 -04:00
this -> getGeneralInputRate (),
2015-06-26 18:21:32 -04:00
this -> getSourceLocalTransform ());
2015-05-05 18:21:43 -04:00
}
2015-04-06 00:28:04 -04:00
}
2015-06-26 18:21:32 -04:00
else if ( driver == kSrcFreenect2 )
2015-04-06 00:28:04 -04:00
{
2015-06-26 18:21:32 -04:00
camera = new CameraFreenect2 (
this -> getSourceDevice (). isEmpty () ? 0 : atoi ( this -> getSourceDevice (). toStdString (). c_str ()),
2015-11-03 17:31:07 -05:00
useRawImages ? CameraFreenect2 :: kTypeColorIR :( CameraFreenect2 :: Type ) _ui -> comboBox_freenect2Format -> currentIndex (),
2015-07-30 14:17:29 -04:00
this -> getGeneralInputRate (),
2015-11-04 18:31:52 -05:00
this -> getSourceLocalTransform (),
_ui -> doubleSpinBox_freenect2MinDepth -> value (),
_ui -> doubleSpinBox_freenect2MaxDepth -> value (),
_ui -> checkBox_freenect2BilateralFiltering -> isChecked (),
_ui -> checkBox_freenect2EdgeAwareFiltering -> isChecked (),
_ui -> checkBox_freenect2NoiseFiltering -> isChecked ());
2015-07-30 14:17:29 -04:00
}
else if ( driver == kSrcRGBDImages )
{
camera = new CameraRGBDImages (
_ui -> lineEdit_cameraRGBDImages_path_rgb -> text (). append ( QDir :: separator ()). toStdString (),
_ui -> lineEdit_cameraRGBDImages_path_depth -> text (). append ( QDir :: separator ()). toStdString (),
_ui -> doubleSpinBox_cameraRGBDImages_scale -> value (),
2015-04-06 00:28:04 -04:00
this -> getGeneralInputRate (),
2015-06-26 18:21:32 -04:00
this -> getSourceLocalTransform ());
2016-01-19 17:43:33 -05:00
(( CameraRGBDImages * ) camera ) -> setBayerMode ( _ui -> comboBox_cameraImages_bayerMode -> currentIndex () - 1 );
2016-01-06 17:26:55 -05:00
(( CameraRGBDImages * ) camera ) -> setGroundTruthPath ( _ui -> lineEdit_cameraImages_gt -> text (). toStdString (), _ui -> comboBox_cameraImages_gtFormat -> currentIndex ());
2015-12-17 14:13:19 -05:00
(( CameraRGBDImages * ) camera ) -> setScanPath (
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_path_scans -> text (). isEmpty () ? "" : _ui -> lineEdit_cameraImages_path_scans -> text (). append ( QDir :: separator ()). toStdString (),
_ui -> spinBox_cameraImages_max_scan_pts -> value (),
2016-01-08 19:15:49 -05:00
_ui -> spinBox_cameraImages_scanDownsampleStep -> value (),
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value (),
_ui -> spinBox_cameraImages_scanNormalsK -> value (),
2016-01-06 17:26:55 -05:00
this -> getLaserLocalTransform ());
2016-01-13 18:13:44 -05:00
(( CameraRGBDImages * ) camera ) -> setTimestamps (
_ui -> checkBox_cameraImages_timestamps -> isChecked (),
_ui -> lineEdit_cameraImages_timestamps -> text (). toStdString (),
_ui -> checkBox_cameraImages_syncTimeStamps -> isChecked ());
2015-04-06 00:28:04 -04:00
}
2015-06-26 18:21:32 -04:00
else if ( driver == kSrcDC1394 )
2015-04-06 00:28:04 -04:00
{
2015-06-26 18:21:32 -04:00
camera = new CameraStereoDC1394 (
2015-04-06 00:28:04 -04:00
this -> getGeneralInputRate (),
2015-06-26 18:21:32 -04:00
this -> getSourceLocalTransform ());
2015-04-06 00:28:04 -04:00
}
2015-06-26 18:21:32 -04:00
else if ( driver == kSrcFlyCapture2 )
2015-04-07 12:00:10 -04:00
{
2015-06-26 18:21:32 -04:00
if ( useRawImages )
{
QMessageBox :: warning ( this , tr ( "Calibration" ),
tr ( "Using raw images for \" FlyCapture2 \" driver is not yet supported. "
"Factory calibration loaded from FlyCapture2 is used." ), QMessageBox :: Ok );
return 0 ;
}
else
{
camera = new CameraStereoFlyCapture2 (
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
}
2015-04-07 12:00:10 -04:00
}
2015-06-26 18:21:32 -04:00
else if ( driver == kSrcStereoImages )
2015-06-11 16:57:16 -04:00
{
2015-06-26 18:21:32 -04:00
camera = new CameraStereoImages (
2015-07-30 14:17:29 -04:00
_ui -> lineEdit_cameraStereoImages_path_left -> text (). append ( QDir :: separator ()). toStdString (),
_ui -> lineEdit_cameraStereoImages_path_right -> text (). append ( QDir :: separator ()). toStdString (),
2016-01-19 17:43:33 -05:00
_ui -> checkBox_stereoImages_rectify -> isChecked () && ! useRawImages ,
2015-07-16 14:44:25 -04:00
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
2016-01-19 17:43:33 -05:00
(( CameraStereoImages * ) camera ) -> setBayerMode ( _ui -> comboBox_cameraImages_bayerMode -> currentIndex () - 1 );
2016-01-06 17:26:55 -05:00
(( CameraStereoImages * ) camera ) -> setGroundTruthPath ( _ui -> lineEdit_cameraImages_gt -> text (). toStdString (), _ui -> comboBox_cameraImages_gtFormat -> currentIndex ());
2015-12-17 14:13:19 -05:00
(( CameraStereoImages * ) camera ) -> setScanPath (
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_path_scans -> text (). isEmpty () ? "" : _ui -> lineEdit_cameraImages_path_scans -> text (). append ( QDir :: separator ()). toStdString (),
_ui -> spinBox_cameraImages_max_scan_pts -> value (),
2016-01-08 19:15:49 -05:00
_ui -> spinBox_cameraImages_scanDownsampleStep -> value (),
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value (),
_ui -> spinBox_cameraImages_scanNormalsK -> value (),
2016-01-06 17:26:55 -05:00
this -> getLaserLocalTransform ());
2016-01-13 18:13:44 -05:00
(( CameraStereoImages * ) camera ) -> setTimestamps (
_ui -> checkBox_cameraImages_timestamps -> isChecked (),
_ui -> lineEdit_cameraImages_timestamps -> text (). toStdString (),
_ui -> checkBox_cameraImages_syncTimeStamps -> isChecked ());
2015-07-16 14:44:25 -04:00
}
2016-05-31 19:09:49 -04:00
else if ( driver == kSrcStereoUsb )
{
camera = new CameraStereoVideo (
this -> getSourceDevice (). isEmpty () ? 0 : atoi ( this -> getSourceDevice (). toStdString (). c_str ()),
2016-06-15 11:30:05 -04:00
! useRawImages ,
2016-05-31 19:09:49 -04:00
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
}
2015-07-16 14:44:25 -04:00
else if ( driver == kSrcStereoVideo )
{
camera = new CameraStereoVideo (
_ui -> lineEdit_cameraStereoVideo_path -> text (). toStdString (),
2016-01-19 17:43:33 -05:00
_ui -> checkBox_stereoVideo_rectify -> isChecked () && ! useRawImages ,
2015-06-11 16:57:16 -04:00
this -> getGeneralInputRate (),
2015-06-26 18:21:32 -04:00
this -> getSourceLocalTransform ());
}
2016-05-31 19:09:49 -04:00
else if ( driver == kSrcStereoZed )
{
2016-06-02 17:27:12 -04:00
if ( ! _ui -> lineEdit_zedSvoPath -> text (). isEmpty ())
{
camera = new CameraStereoZed (
_ui -> lineEdit_zedSvoPath -> text (). toStdString (),
_ui -> comboBox_stereoZed_quality -> currentIndex (),
_ui -> comboBox_stereoZed_sensingMode -> currentIndex (),
_ui -> spinBox_stereoZed_confidenceThr -> value (),
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
}
else
{
camera = new CameraStereoZed (
this -> getSourceDevice (). isEmpty () ? 0 : atoi ( this -> getSourceDevice (). toStdString (). c_str ()),
_ui -> comboBox_stereoZed_resolution -> currentIndex (),
_ui -> comboBox_stereoZed_quality -> currentIndex (),
_ui -> comboBox_stereoZed_sensingMode -> currentIndex (),
_ui -> spinBox_stereoZed_confidenceThr -> value (),
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
}
2016-05-31 19:09:49 -04:00
}
2015-06-26 18:21:32 -04:00
else if ( driver == kSrcUsbDevice )
{
camera = new CameraVideo (
this -> getSourceDevice (). isEmpty () ? 0 : atoi ( this -> getSourceDevice (). toStdString (). c_str ()),
2016-06-15 11:30:05 -04:00
! useRawImages ,
2015-06-26 18:21:32 -04:00
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
}
else if ( driver == kSrcVideo )
{
camera = new CameraVideo (
2015-07-30 14:17:29 -04:00
_ui -> source_video_lineEdit_path -> text (). toStdString (),
2016-01-19 17:43:33 -05:00
_ui -> checkBox_rgbVideo_rectify -> isChecked () && ! useRawImages ,
2015-06-26 18:21:32 -04:00
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
}
else if ( driver == kSrcImages )
{
camera = new CameraImages (
2015-07-30 14:17:29 -04:00
_ui -> source_images_lineEdit_path -> text (). toStdString (),
2015-06-26 18:21:32 -04:00
this -> getGeneralInputRate (),
this -> getSourceLocalTransform ());
2015-12-17 14:13:19 -05:00
(( CameraImages * ) camera ) -> setStartIndex ( _ui -> source_images_spinBox_startPos -> value ());
(( CameraImages * ) camera ) -> setDirRefreshed ( _ui -> source_images_refreshDir -> isChecked ());
2016-01-19 17:43:33 -05:00
(( CameraImages * ) camera ) -> setImagesRectified ( _ui -> checkBox_rgbImages_rectify -> isChecked () && ! useRawImages );
2016-01-06 17:26:55 -05:00
2016-01-19 17:43:33 -05:00
(( CameraImages * ) camera ) -> setBayerMode ( _ui -> comboBox_cameraImages_bayerMode -> currentIndex () - 1 );
(( CameraImages * ) camera ) -> setGroundTruthPath (
2016-01-11 17:21:06 -05:00
_ui -> lineEdit_cameraImages_gt -> text (). toStdString (),
_ui -> comboBox_cameraImages_gtFormat -> currentIndex ());
2016-01-19 17:43:33 -05:00
(( CameraImages * ) camera ) -> setScanPath (
2016-01-06 17:26:55 -05:00
_ui -> lineEdit_cameraImages_path_scans -> text (). isEmpty () ? "" : _ui -> lineEdit_cameraImages_path_scans -> text (). append ( QDir :: separator ()). toStdString (),
_ui -> spinBox_cameraImages_max_scan_pts -> value (),
2016-01-08 19:15:49 -05:00
_ui -> spinBox_cameraImages_scanDownsampleStep -> value (),
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value (),
_ui -> spinBox_cameraImages_scanNormalsK -> value (),
2016-01-06 17:26:55 -05:00
this -> getLaserLocalTransform ());
2016-01-19 17:43:33 -05:00
(( CameraImages * ) camera ) -> setDepthFromScan (
2016-01-11 17:21:06 -05:00
_ui -> groupBox_depthFromScan -> isChecked (),
2016-03-10 12:31:22 -05:00
! _ui -> groupBox_depthFromScan_fillHoles -> isChecked () ? 0 : _ui -> radioButton_depthFromScan_vertical -> isChecked () ? 1 :- 1 ,
2016-01-11 17:21:06 -05:00
_ui -> checkBox_depthFromScan_fillBorders -> isChecked ());
2016-01-19 17:43:33 -05:00
(( CameraImages * ) camera ) -> setTimestamps (
2016-01-11 17:21:06 -05:00
_ui -> checkBox_cameraImages_timestamps -> isChecked (),
2016-01-13 18:13:44 -05:00
_ui -> lineEdit_cameraImages_timestamps -> text (). toStdString (),
_ui -> checkBox_cameraImages_syncTimeStamps -> isChecked ());
2015-06-26 18:21:32 -04:00
}
else if ( driver == kSrcDatabase )
{
UERROR ( "Call directly DBReader for kSrcDatabase." );
return 0 ;
2015-06-11 16:57:16 -04:00
}
2015-04-06 00:28:04 -04:00
else
{
2015-06-26 18:21:32 -04:00
UFATAL ( "Source driver undefined (%d)!" , driver );
2015-04-06 00:28:04 -04:00
}
2015-06-26 18:21:32 -04:00
if ( camera )
{
// don't set calibration folder if we want raw images
2015-11-22 18:08:32 -05:00
QString dir = this -> getCameraInfoDir ();
2016-01-11 17:21:06 -05:00
QString calibrationFile = _ui -> lineEdit_calibrationFile -> text ();
if ( ! ( driver >= kSrcRGB && driver <= kSrcVideo ))
{
calibrationFile . remove ( "_left.yaml" ). remove ( "_right.yaml" ). remove ( "_pose.yaml" );
}
QString name = QFileInfo ( calibrationFile . remove ( ".yaml" )). baseName ();
2015-11-22 18:08:32 -05:00
if ( ! _ui -> lineEdit_calibrationFile -> text (). isEmpty ())
{
QDir d = QFileInfo ( _ui -> lineEdit_calibrationFile -> text ()). dir ();
2015-12-02 11:48:07 -05:00
if ( ! _ui -> lineEdit_calibrationFile -> text (). remove ( QFileInfo ( _ui -> lineEdit_calibrationFile -> text ()). baseName ()). isEmpty ())
2015-11-22 18:08:32 -05:00
{
dir = d . absolutePath ();
}
}
2015-12-22 19:32:52 -05:00
2015-11-22 18:08:32 -05:00
if ( ! camera -> init ( useRawImages ? "" : dir . toStdString (), name . toStdString ()))
2015-06-26 18:21:32 -04:00
{
UWARN ( "init camera failed... " );
QMessageBox :: warning ( this ,
tr ( "RTAB-Map" ),
tr ( "Camera initialization failed..." ));
delete camera ;
camera = 0 ;
}
2015-07-25 00:11:39 -04:00
else
2015-06-26 18:21:32 -04:00
{
2015-07-25 00:11:39 -04:00
//should be after initialization
if ( driver == kSrcOpenNI2 )
2015-06-26 18:21:32 -04:00
{
2015-07-30 14:17:29 -04:00
(( CameraOpenNI2 * ) camera ) -> setAutoWhiteBalance ( _ui -> openni2_autoWhiteBalance -> isChecked ());
(( CameraOpenNI2 * ) camera ) -> setAutoExposure ( _ui -> openni2_autoExposure -> isChecked ());
(( CameraOpenNI2 * ) camera ) -> setMirroring ( _ui -> openni2_mirroring -> isChecked ());
2015-10-15 16:40:49 -04:00
(( CameraOpenNI2 * ) camera ) -> setOpenNI2StampsAndIDsUsed ( _ui -> openni2_stampsIdsUsed -> isChecked ());
2015-07-25 00:11:39 -04:00
if ( CameraOpenNI2 :: exposureGainAvailable ())
{
2015-07-30 14:17:29 -04:00
(( CameraOpenNI2 * ) camera ) -> setExposure ( _ui -> openni2_exposure -> value ());
(( CameraOpenNI2 * ) camera ) -> setGain ( _ui -> openni2_gain -> value ());
2015-07-25 00:11:39 -04:00
}
2015-06-26 18:21:32 -04:00
}
}
}
return camera ;
2014-07-14 01:25:28 +00:00
}
2012-06-24 17:19:34 +00:00
bool PreferencesDialog :: isStatisticsPublished () const
{
2014-10-18 13:12:45 +00:00
return _ui -> groupBox_publishing -> isChecked ();
2012-06-24 17:19:34 +00:00
}
2011-06-05 14:45:39 +00:00
double PreferencesDialog :: getLoopThr () const
{
return _ui -> general_doubleSpinBox_hardThr -> value ();
}
double PreferencesDialog :: getVpThr () const
{
return _ui -> general_doubleSpinBox_vp -> value ();
}
2015-08-28 23:05:45 -04:00
double PreferencesDialog :: getSimThr () const
{
return _ui -> doubleSpinBox_similarityThreshold -> value ();
}
2014-10-13 19:10:22 +00:00
int PreferencesDialog :: getOdomStrategy () const
{
return _ui -> odom_strategy -> currentIndex ();
}
2015-06-11 16:57:16 -04:00
int PreferencesDialog :: getOdomBufferSize () const
{
return _ui -> odom_dataBufferSize -> value ();
}
2015-11-22 18:08:32 -05:00
bool PreferencesDialog :: getRegVarianceFromInliersCount () const
2015-09-28 21:45:41 -04:00
{
2015-10-02 10:40:18 -04:00
return _ui -> loopClosure_bowVarianceFromInliersCount -> isChecked ();
2015-09-28 21:45:41 -04:00
}
2011-06-05 14:45:39 +00:00
2015-04-06 00:28:04 -04:00
QString PreferencesDialog :: getCameraInfoDir () const
{
return ( this -> getWorkingDirectory (). isEmpty () ? "." : this -> getWorkingDirectory ()) + "/camera_info" ;
}
2011-06-05 14:45:39 +00:00
bool PreferencesDialog :: isImagesKept () const
{
return _ui -> general_checkBox_imagesKept -> isChecked ();
}
2016-06-12 17:53:35 -04:00
bool PreferencesDialog :: isCloudsKept () const
{
return _ui -> general_checkBox_cloudsKept -> isChecked ();
}
2012-03-03 01:46:30 +00:00
float PreferencesDialog :: getTimeLimit () const
2011-06-05 14:45:39 +00:00
{
return _ui -> general_doubleSpinBox_timeThr -> value ();
}
2013-12-11 00:12:44 +00:00
float PreferencesDialog :: getDetectionRate () const
{
return _ui -> general_doubleSpinBox_detectionRate -> value ();
}
bool PreferencesDialog :: isSLAMMode () const
{
return _ui -> general_checkBox_SLAM_mode -> isChecked ();
}
2011-06-05 14:45:39 +00:00
/*** SETTERS ***/
2012-06-24 17:19:34 +00:00
void PreferencesDialog :: setInputRate ( double value )
2011-06-05 14:45:39 +00:00
{
ULOGGER_DEBUG ( "imgRate=%2.2f" , value );
if ( _ui -> general_doubleSpinBox_imgRate -> value () != value )
{
_ui -> general_doubleSpinBox_imgRate -> setValue ( value );
if ( validateForm ())
{
2015-02-13 16:50:32 -05:00
this -> writeSettings ( getTmpIniFilePath ());
2011-06-05 14:45:39 +00:00
}
else
{
2011-06-09 13:57:01 +00:00
this -> readSettingsBegin ();
2011-06-05 14:45:39 +00:00
}
}
}
2013-12-11 00:12:44 +00:00
void PreferencesDialog :: setDetectionRate ( double value )
{
ULOGGER_DEBUG ( "detectionRate=%2.2f" , value );
if ( _ui -> general_doubleSpinBox_detectionRate -> value () != value )
{
_ui -> general_doubleSpinBox_detectionRate -> setValue ( value );
if ( validateForm ())
{
2015-02-13 16:50:32 -05:00
this -> writeSettings ( getTmpIniFilePath ());
2013-12-11 00:12:44 +00:00
}
else
{
this -> readSettingsBegin ();
}
}
}
2012-03-03 01:46:30 +00:00
void PreferencesDialog :: setTimeLimit ( float value )
2011-06-05 14:45:39 +00:00
{
ULOGGER_DEBUG ( "timeLimit=%fs" , value );
if ( _ui -> general_doubleSpinBox_timeThr -> value () != value )
{
_ui -> general_doubleSpinBox_timeThr -> setValue ( value );
if ( validateForm ())
{
2015-02-13 16:50:32 -05:00
this -> writeSettings ( getTmpIniFilePath ());
2011-06-05 14:45:39 +00:00
}
else
{
2011-06-09 13:57:01 +00:00
this -> readSettingsBegin ();
2011-06-05 14:45:39 +00:00
}
}
}
2013-12-11 00:12:44 +00:00
void PreferencesDialog :: setSLAMMode ( bool enabled )
2012-06-24 17:19:34 +00:00
{
2013-12-11 00:12:44 +00:00
ULOGGER_DEBUG ( "slam mode=%s" , enabled ? "true" : "false" );
if ( _ui -> general_checkBox_SLAM_mode -> isChecked () != enabled )
2012-06-24 17:19:34 +00:00
{
2013-12-11 00:12:44 +00:00
_ui -> general_checkBox_SLAM_mode -> setChecked ( enabled );
2012-06-24 17:19:34 +00:00
if ( validateForm ())
{
2015-02-13 16:50:32 -05:00
this -> writeSettings ( getTmpIniFilePath ());
2012-06-24 17:19:34 +00:00
}
else
{
this -> readSettingsBegin ();
}
}
}
2014-04-02 15:51:02 +00:00
void PreferencesDialog :: testOdometry ()
2013-12-11 00:12:44 +00:00
{
2015-07-30 14:17:29 -04:00
DBReader dbReader ( _ui -> source_database_lineEdit_path -> text (). toStdString (),
_ui -> source_checkBox_useDbStamps -> isChecked () ?- 1 : this -> getGeneralInputRate (),
2015-06-26 18:21:32 -04:00
true ,
true );
Camera * camera = 0 ;
if ( this -> getSourceType () == kSrcDatabase )
{
if ( ! dbReader . init ())
{
QMessageBox :: warning ( this , tr ( "Camera viewer" ), tr ( "Failed to initialize the database reader!" ));
return ;
}
}
else
{
camera = this -> createCamera ();
if ( ! camera )
{
return ;
}
}
2014-06-13 23:44:38 +00:00
2014-06-15 03:31:35 +00:00
2015-04-06 13:35:44 -04:00
ParametersMap parameters = this -> getAllParameters ();
2016-01-05 16:37:14 -05:00
Odometry * odometry = Odometry :: create ( parameters );
2013-12-11 00:12:44 +00:00
2015-06-11 16:57:16 -04:00
OdometryThread odomThread (
odometry , // take ownership of odometry
2015-10-02 10:40:18 -04:00
_ui -> odom_dataBufferSize -> value ());
2015-04-06 13:35:44 -04:00
odomThread . registerToEventsManager ();
OdometryViewer * odomViewer = new OdometryViewer ( 10 ,
_ui -> spinBox_decimation_odom -> value (),
2016-02-15 19:35:24 -05:00
0.0f ,
2015-06-11 16:57:16 -04:00
_ui -> doubleSpinBox_maxDepth_odom -> value (),
2015-04-06 13:35:44 -04:00
this -> getOdomQualityWarnThr (),
2016-05-31 19:09:49 -04:00
this ,
this -> getAllParameters ());
2015-04-06 13:35:44 -04:00
odomViewer -> setWindowTitle ( tr ( "Odometry viewer" ));
odomViewer -> resize ( 1280 , 480 + QPushButton (). minimumHeight ());
odomViewer -> registerToEventsManager ();
2015-06-26 18:21:32 -04:00
if ( camera )
{
2015-12-11 17:44:15 -05:00
CameraThread cameraThread ( camera , this -> getAllParameters ()); // take ownership of camera
2015-06-26 18:21:32 -04:00
cameraThread . setMirroringEnabled ( isSourceMirroring ());
2015-07-30 14:17:29 -04:00
cameraThread . setColorOnly ( _ui -> checkbox_rgbd_colorOnly -> isChecked ());
2016-01-08 19:15:49 -05:00
cameraThread . setImageDecimation ( _ui -> spinBox_source_imageDecimation -> value ());
2015-08-27 17:16:12 -04:00
cameraThread . setStereoToDepth ( _ui -> checkbox_stereo_depthGenerated -> isChecked ());
2016-01-08 19:15:49 -05:00
cameraThread . setScanFromDepth (
_ui -> groupBox_scanFromDepth -> isChecked (),
_ui -> spinBox_cameraScanFromDepth_decimation -> value (),
_ui -> doubleSpinBox_cameraSCanFromDepth_maxDepth -> value (),
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value (),
_ui -> spinBox_cameraImages_scanNormalsK -> value ());
2015-06-26 18:21:32 -04:00
UEventsManager :: createPipe ( & cameraThread , & odomThread , "CameraEvent" );
UEventsManager :: createPipe ( & odomThread , odomViewer , "OdometryEvent" );
UEventsManager :: createPipe ( odomViewer , & odomThread , "OdometryResetEvent" );
2015-04-06 13:35:44 -04:00
2015-06-26 18:21:32 -04:00
odomThread . start ();
cameraThread . start ();
2015-04-06 13:35:44 -04:00
2015-06-26 18:21:32 -04:00
odomViewer -> exec ();
delete odomViewer ;
2015-04-06 13:35:44 -04:00
2015-06-26 18:21:32 -04:00
cameraThread . join ( true );
odomThread . join ( true );
}
else
{
UEventsManager :: createPipe ( & dbReader , & odomThread , "CameraEvent" );
UEventsManager :: createPipe ( & odomThread , odomViewer , "OdometryEvent" );
UEventsManager :: createPipe ( odomViewer , & odomThread , "OdometryResetEvent" );
odomThread . start ();
dbReader . start ();
odomViewer -> exec ();
delete odomViewer ;
dbReader . join ( true );
odomThread . join ( true );
}
2014-10-01 17:30:44 +00:00
}
2015-06-26 18:21:32 -04:00
void PreferencesDialog :: testCamera ()
2014-10-01 17:30:44 +00:00
{
2016-05-31 19:09:49 -04:00
CameraViewer * window = new CameraViewer ( this , this -> getAllParameters ());
2015-06-26 18:21:32 -04:00
window -> setWindowTitle ( tr ( "Camera viewer" ));
2015-04-06 13:35:44 -04:00
window -> resize ( 1280 , 480 + QPushButton (). minimumHeight ());
window -> registerToEventsManager ();
2014-10-01 17:30:44 +00:00
2015-06-26 18:21:32 -04:00
if ( this -> getSourceType () == kSrcDatabase )
{
2015-07-30 14:17:29 -04:00
DBReader dbReader ( _ui -> source_database_lineEdit_path -> text (). toStdString (),
_ui -> source_checkBox_useDbStamps -> isChecked () ?- 1 : this -> getGeneralInputRate (),
2015-06-26 18:21:32 -04:00
true ,
true );
if ( ! dbReader . init ())
{
QMessageBox :: warning ( this , tr ( "Camera viewer" ), tr ( "Failed to initialize the database reader!" ));
delete window ;
}
else
{
UEventsManager :: createPipe ( & dbReader , window , "CameraEvent" );
dbReader . start ();
window -> exec ();
delete window ;
dbReader . join ( true );
}
}
else
{
Camera * camera = this -> createCamera ();
if ( camera )
{
2015-12-11 17:44:15 -05:00
CameraThread cameraThread ( camera , this -> getAllParameters ());
2015-06-26 18:21:32 -04:00
cameraThread . setMirroringEnabled ( isSourceMirroring ());
2015-07-30 14:17:29 -04:00
cameraThread . setColorOnly ( _ui -> checkbox_rgbd_colorOnly -> isChecked ());
2016-01-08 19:15:49 -05:00
cameraThread . setImageDecimation ( _ui -> spinBox_source_imageDecimation -> value ());
2015-08-27 17:16:12 -04:00
cameraThread . setStereoToDepth ( _ui -> checkbox_stereo_depthGenerated -> isChecked ());
2016-01-08 19:15:49 -05:00
cameraThread . setScanFromDepth (
_ui -> groupBox_scanFromDepth -> isChecked (),
_ui -> spinBox_cameraScanFromDepth_decimation -> value (),
_ui -> doubleSpinBox_cameraSCanFromDepth_maxDepth -> value (),
_ui -> doubleSpinBox_cameraImages_scanVoxelSize -> value (),
_ui -> spinBox_cameraImages_scanNormalsK -> value ());
2015-06-26 18:21:32 -04:00
UEventsManager :: createPipe ( & cameraThread , window , "CameraEvent" );
cameraThread . start ();
window -> exec ();
delete window ;
cameraThread . join ( true );
}
else
{
delete window ;
}
}
2014-10-01 17:30:44 +00:00
}
2014-07-26 04:36:00 +00:00
void PreferencesDialog :: calibrate ()
{
2015-06-26 18:21:32 -04:00
if ( this -> getSourceType () == kSrcDatabase )
2014-07-26 04:36:00 +00:00
{
2015-06-26 18:21:32 -04:00
QMessageBox :: warning ( this ,
tr ( "Calibration" ),
tr ( "Cannot calibrate database source!" ));
2015-04-06 13:35:44 -04:00
return ;
2014-07-26 04:36:00 +00:00
}
2015-06-26 18:21:32 -04:00
Camera * camera = this -> createCamera ( true );
if ( ! camera )
2014-11-20 22:00:47 +00:00
{
2015-06-26 18:21:32 -04:00
return ;
2014-11-20 22:00:47 +00:00
}
2014-07-26 04:36:00 +00:00
2015-04-06 13:35:44 -04:00
if ( ! this -> getCameraInfoDir (). isEmpty ())
2014-07-26 04:36:00 +00:00
{
2015-04-06 13:35:44 -04:00
QDir dir ( this -> getCameraInfoDir ());
if ( ! dir . exists ())
2015-04-06 00:28:04 -04:00
{
2015-04-06 13:35:44 -04:00
UINFO ( "Creating camera_info directory: \" %s \" " , this -> getCameraInfoDir (). toStdString (). c_str ());
if ( ! dir . mkpath ( this -> getCameraInfoDir ()))
2015-04-06 00:28:04 -04:00
{
2015-04-06 13:35:44 -04:00
UWARN ( "Could create camera_info directory: \" %s \" " , this -> getCameraInfoDir (). toStdString (). c_str ());
2015-04-06 00:28:04 -04:00
}
}
2014-07-26 04:36:00 +00:00
}
2015-06-26 18:21:32 -04:00
_calibrationDialog -> setStereoMode ( this -> getSourceType () != kSrcRGB ); // RGB+Depth or left+right
2015-05-05 19:43:25 -04:00
_calibrationDialog -> setSwitchedImages ( dynamic_cast < CameraFreenect2 *> ( camera ) != 0 );
2015-04-06 13:35:44 -04:00
_calibrationDialog -> setSavingDirectory ( this -> getCameraInfoDir ());
_calibrationDialog -> registerToEventsManager ();
2015-12-11 17:44:15 -05:00
CameraThread cameraThread ( camera , this -> getAllParameters ());
2015-04-06 13:35:44 -04:00
UEventsManager :: createPipe ( & cameraThread , _calibrationDialog , "CameraEvent" );
cameraThread . start ();
_calibrationDialog -> exec ();
_calibrationDialog -> unregisterFromEventsManager ();
cameraThread . join ( true );
2014-07-26 04:36:00 +00:00
}
2015-07-30 14:17:29 -04:00
void PreferencesDialog :: calibrateSimple ()
{
2016-01-19 17:43:33 -05:00
_createCalibrationDialog -> setCameraInfoDir ( this -> getCameraInfoDir ());
if ( _createCalibrationDialog -> exec () == QMessageBox :: Accepted )
{
_ui -> lineEdit_calibrationFile -> setText ( _createCalibrationDialog -> cameraName ());
}
2015-07-30 14:17:29 -04:00
}
2011-06-05 14:45:39 +00:00
}
2015-06-26 18:21:32 -04:00