mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
LiDAR capture support in standalone library (#1264)
* Working rtabmap_lidar-mapping example (live and pcap) * finalizing merge, added some deprecated * fixed build * Working deskewing for Lidar + Camera/IMU (no camera pose correction yet) and Lidar + Odom Sensor in main UI. * backward compatibility * fixed some not used variable warnings, fixed qt build for lidar mapping example * Refactored CameraMobile, added AREngine background support, fixed LidarVPL16 build error with PCL 1.8 * ARCoreJava: buffer last depth image in case its stamp i higher than pose stamp. CameraMobile: added pose buffer. SensorCaptureThread: to get pose, odomSensor should be explicitly set, but can be same as lidar or camera inputs. * Working external lidar on iOS * util3d::commonFiltering()/adjustNormalsToViewPoint() added organized cloud support. MainWindow: updated odomSensor setup * fixed winsock include order * reverted camera tool * disable imu filtering when odom sensor is used * Updated package version * fixed windows build * fixing more windows build erros
This commit is contained in:
@@ -177,8 +177,28 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
add_definitions(${PCL_DEFINITIONS})
|
||||
|
||||
# Include presets
|
||||
SET(RESOURCES
|
||||
${PROJECT_SOURCE_DIR}/data/presets/camera_tof_icp.ini
|
||||
${PROJECT_SOURCE_DIR}/data/presets/lidar3d_icp.ini
|
||||
)
|
||||
|
||||
foreach(arg ${RESOURCES})
|
||||
get_filename_component(filename ${arg} NAME)
|
||||
string(REPLACE "." "_" output ${filename})
|
||||
set(RESOURCES_HEADERS "${RESOURCES_HEADERS}" "${CMAKE_CURRENT_BINARY_DIR}/${output}.h")
|
||||
set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${output}.h" PROPERTY SKIP_AUTOGEN ON)
|
||||
endforeach(arg ${RESOURCES})
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${RESOURCES_HEADERS}
|
||||
COMMAND res_tool -n rtabmap -p ${CMAKE_CURRENT_BINARY_DIR} ${RESOURCES}
|
||||
COMMENT "[Creating resources]"
|
||||
DEPENDS ${RESOURCES}
|
||||
)
|
||||
|
||||
# create a library from the source files
|
||||
ADD_LIBRARY(rtabmap_gui ${SRC_FILES})
|
||||
ADD_LIBRARY(rtabmap_gui ${SRC_FILES} ${RESOURCES_HEADERS})
|
||||
ADD_LIBRARY(rtabmap::gui ALIAS rtabmap_gui)
|
||||
|
||||
generate_export_header(rtabmap_gui
|
||||
|
||||
@@ -44,7 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include <rtabmap/core/CameraEvent.h>
|
||||
#include <rtabmap/core/SensorEvent.h>
|
||||
#include <rtabmap/utilite/UCv2Qt.h>
|
||||
|
||||
#include <rtabmap/utilite/ULogger.h>
|
||||
@@ -307,10 +307,10 @@ bool CalibrationDialog::handleEvent(UEvent * event)
|
||||
{
|
||||
if(!processingData_)
|
||||
{
|
||||
if(event->getClassName().compare("CameraEvent") == 0)
|
||||
if(event->getClassName().compare("SensorEvent") == 0)
|
||||
{
|
||||
rtabmap::CameraEvent * e = (rtabmap::CameraEvent *)event;
|
||||
if(e->getCode() == rtabmap::CameraEvent::kCodeData)
|
||||
rtabmap::SensorEvent * e = (rtabmap::SensorEvent *)event;
|
||||
if(e->getCode() == rtabmap::SensorEvent::kCodeData)
|
||||
{
|
||||
processingData_ = true;
|
||||
QMetaObject::invokeMethod(this, "processImages",
|
||||
|
||||
@@ -25,9 +25,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <rtabmap/core/SensorEvent.h>
|
||||
#include "rtabmap/gui/CameraViewer.h"
|
||||
|
||||
#include <rtabmap/core/CameraEvent.h>
|
||||
#include <rtabmap/core/util3d.h>
|
||||
#include <rtabmap/core/util2d.h>
|
||||
#include <rtabmap/core/util3d_filtering.h>
|
||||
@@ -58,6 +58,7 @@ CameraViewer::CameraViewer(QWidget * parent, const ParametersMap & parameters) :
|
||||
|
||||
imageView_->setImageDepthShown(true);
|
||||
imageView_->setMinimumSize(320, 240);
|
||||
imageView_->setVisible(false);
|
||||
QHBoxLayout * layout = new QHBoxLayout();
|
||||
layout->setContentsMargins(0,0,0,0);
|
||||
layout->addWidget(imageView_,1);
|
||||
@@ -108,10 +109,16 @@ CameraViewer::~CameraViewer()
|
||||
this->unregisterFromEventsManager();
|
||||
}
|
||||
|
||||
void CameraViewer::setDecimation(int value)
|
||||
{
|
||||
decimationSpin_->setValue(value);
|
||||
}
|
||||
|
||||
void CameraViewer::showImage(const rtabmap::SensorData & data)
|
||||
{
|
||||
processingImages_ = true;
|
||||
QString sizes;
|
||||
imageView_->setVisible(!data.imageRaw().empty() || !data.imageRaw().empty());
|
||||
if(!data.imageRaw().empty())
|
||||
{
|
||||
imageView_->setImage(uCvMat2QImage(data.imageRaw()));
|
||||
@@ -199,10 +206,10 @@ bool CameraViewer::handleEvent(UEvent * event)
|
||||
{
|
||||
if(!pause_->isChecked())
|
||||
{
|
||||
if(event->getClassName().compare("CameraEvent") == 0)
|
||||
if(event->getClassName().compare("SensorEvent") == 0)
|
||||
{
|
||||
CameraEvent * camEvent = (CameraEvent*)event;
|
||||
if(camEvent->getCode() == CameraEvent::kCodeData)
|
||||
SensorEvent * camEvent = (SensorEvent*)event;
|
||||
if(camEvent->getCode() == SensorEvent::kCodeData)
|
||||
{
|
||||
if(camEvent->data().isValid())
|
||||
{
|
||||
|
||||
@@ -30,8 +30,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/utilite/ULogger.h>
|
||||
#include <rtabmap/utilite/UTimer.h>
|
||||
#include <rtabmap/core/Memory.h>
|
||||
#include <rtabmap/core/SensorEvent.h>
|
||||
#include <rtabmap/core/Signature.h>
|
||||
#include <rtabmap/core/CameraEvent.h>
|
||||
#include <rtabmap/core/util3d.h>
|
||||
#include <rtabmap/gui/ImageView.h>
|
||||
#include <rtabmap/utilite/UCv2Qt.h>
|
||||
@@ -172,10 +172,10 @@ bool DataRecorder::handleEvent(UEvent * event)
|
||||
{
|
||||
if(memory_)
|
||||
{
|
||||
if(event->getClassName().compare("CameraEvent") == 0)
|
||||
if(event->getClassName().compare("SensorEvent") == 0)
|
||||
{
|
||||
CameraEvent * camEvent = (CameraEvent*)event;
|
||||
if(camEvent->getCode() == CameraEvent::kCodeData)
|
||||
SensorEvent * camEvent = (SensorEvent*)event;
|
||||
if(camEvent->getCode() == SensorEvent::kCodeData)
|
||||
{
|
||||
if(camEvent->data().isValid())
|
||||
{
|
||||
|
||||
@@ -31,9 +31,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "rtabmap/core/CameraRGB.h"
|
||||
#include "rtabmap/core/CameraStereo.h"
|
||||
#include "rtabmap/core/CameraThread.h"
|
||||
#include "rtabmap/core/Lidar.h"
|
||||
#include "rtabmap/core/IMUThread.h"
|
||||
#include "rtabmap/core/CameraEvent.h"
|
||||
#include "rtabmap/core/DBReader.h"
|
||||
#include "rtabmap/core/Parameters.h"
|
||||
#include "rtabmap/core/ParamEvent.h"
|
||||
@@ -113,6 +112,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/filters/filter.h>
|
||||
#include <pcl/search/kdtree.h>
|
||||
#include <rtabmap/core/SensorCaptureThread.h>
|
||||
#include <rtabmap/core/SensorEvent.h>
|
||||
|
||||
#ifdef RTABMAP_OCTOMAP
|
||||
#include <rtabmap/core/global_map/OctoMap.h>
|
||||
@@ -142,7 +143,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent, bool sh
|
||||
QMainWindow(parent),
|
||||
_ui(0),
|
||||
_state(kIdle),
|
||||
_camera(0),
|
||||
_sensorCapture(0),
|
||||
_odomThread(0),
|
||||
_imuThread(0),
|
||||
_preferencesDialog(0),
|
||||
@@ -468,6 +469,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent, bool sh
|
||||
connect(_ui->actionDepthAI_oakd, SIGNAL(triggered()), this, SLOT(selectDepthAIOAKD()));
|
||||
connect(_ui->actionDepthAI_oakdlite, SIGNAL(triggered()), this, SLOT(selectDepthAIOAKDLite()));
|
||||
connect(_ui->actionDepthAI_oakdpro, SIGNAL(triggered()), this, SLOT(selectDepthAIOAKDPro()));
|
||||
connect(_ui->actionVelodyne_VLP_16, SIGNAL(triggered()), this, SLOT(selectVLP16()));
|
||||
_ui->actionFreenect->setEnabled(CameraFreenect::available());
|
||||
_ui->actionOpenNI_CV->setEnabled(CameraOpenNICV::available());
|
||||
_ui->actionOpenNI_CV_ASUS->setEnabled(CameraOpenNICV::available());
|
||||
@@ -566,8 +568,8 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent, bool sh
|
||||
qRegisterMetaType<rtabmap::Statistics>("rtabmap::Statistics");
|
||||
connect(this, SIGNAL(statsReceived(rtabmap::Statistics)), this, SLOT(processStats(rtabmap::Statistics)));
|
||||
|
||||
qRegisterMetaType<rtabmap::CameraInfo>("rtabmap::CameraInfo");
|
||||
connect(this, SIGNAL(cameraInfoReceived(rtabmap::CameraInfo)), this, SLOT(processCameraInfo(rtabmap::CameraInfo)));
|
||||
qRegisterMetaType<rtabmap::SensorCaptureInfo>("rtabmap::SensorCaptureInfo");
|
||||
connect(this, SIGNAL(cameraInfoReceived(rtabmap::SensorCaptureInfo)), this, SLOT(processCameraInfo(rtabmap::SensorCaptureInfo)));
|
||||
|
||||
qRegisterMetaType<rtabmap::OdometryEvent>("rtabmap::OdometryEvent");
|
||||
connect(this, SIGNAL(odometryReceived(rtabmap::OdometryEvent, bool)), this, SLOT(processOdometry(rtabmap::OdometryEvent, bool)));
|
||||
@@ -612,6 +614,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent, bool sh
|
||||
_ui->statsToolBox->updateStat("Planning/Length/m", false);
|
||||
|
||||
_ui->statsToolBox->updateStat("Camera/Time capturing/ms", false);
|
||||
_ui->statsToolBox->updateStat("Camera/Time deskewing/ms", false);
|
||||
_ui->statsToolBox->updateStat("Camera/Time undistort depth/ms", false);
|
||||
_ui->statsToolBox->updateStat("Camera/Time bilateral filtering/ms", false);
|
||||
_ui->statsToolBox->updateStat("Camera/Time decimation/ms", false);
|
||||
@@ -641,6 +644,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent, bool sh
|
||||
_ui->statsToolBox->updateStat("Odometry/StdDevAng/rad", false);
|
||||
_ui->statsToolBox->updateStat("Odometry/VarianceLin/", false);
|
||||
_ui->statsToolBox->updateStat("Odometry/VarianceAng/", false);
|
||||
_ui->statsToolBox->updateStat("Odometry/TimeDeskewing/ms", false);
|
||||
_ui->statsToolBox->updateStat("Odometry/TimeEstimation/ms", false);
|
||||
_ui->statsToolBox->updateStat("Odometry/TimeFiltering/ms", false);
|
||||
_ui->statsToolBox->updateStat("Odometry/GravityRollError/deg", false);
|
||||
@@ -839,11 +843,11 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
_ui->dockWidget_odometry->close();
|
||||
_ui->dockWidget_multiSessionLoc->close();
|
||||
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
UERROR("Camera must be already deleted here!");
|
||||
delete _camera;
|
||||
_camera = 0;
|
||||
delete _sensorCapture;
|
||||
_sensorCapture = 0;
|
||||
if(_imuThread)
|
||||
{
|
||||
delete _imuThread;
|
||||
@@ -935,10 +939,10 @@ bool MainWindow::handleEvent(UEvent* anEvent)
|
||||
{
|
||||
Q_EMIT rtabmapGoalStatusEventReceived(anEvent->getCode());
|
||||
}
|
||||
else if(anEvent->getClassName().compare("CameraEvent") == 0)
|
||||
else if(anEvent->getClassName().compare("SensorEvent") == 0)
|
||||
{
|
||||
CameraEvent * cameraEvent = (CameraEvent*)anEvent;
|
||||
if(cameraEvent->getCode() == CameraEvent::kCodeNoMoreImages)
|
||||
SensorEvent * sensorEvent = (SensorEvent*)anEvent;
|
||||
if(sensorEvent->getCode() == SensorEvent::kCodeNoMoreImages)
|
||||
{
|
||||
if(_preferencesDialog->beepOnPause())
|
||||
{
|
||||
@@ -948,15 +952,15 @@ bool MainWindow::handleEvent(UEvent* anEvent)
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_EMIT cameraInfoReceived(cameraEvent->info());
|
||||
if (_odomThread == 0 && (_camera->odomProvided()) && _preferencesDialog->isRGBDMode())
|
||||
Q_EMIT cameraInfoReceived(sensorEvent->info());
|
||||
if (_odomThread == 0 && (_sensorCapture->odomProvided()) && _preferencesDialog->isRGBDMode())
|
||||
{
|
||||
OdometryInfo odomInfo;
|
||||
odomInfo.reg.covariance = cameraEvent->info().odomCovariance;
|
||||
odomInfo.reg.covariance = sensorEvent->info().odomCovariance;
|
||||
if (!_processingOdometry && !_processingStatistics)
|
||||
{
|
||||
_processingOdometry = true; // if we receive too many odometry events!
|
||||
OdometryEvent tmp(cameraEvent->data(), cameraEvent->info().odomPose, odomInfo);
|
||||
OdometryEvent tmp(sensorEvent->data(), sensorEvent->info().odomPose, odomInfo);
|
||||
Q_EMIT odometryReceived(tmp, false);
|
||||
}
|
||||
else
|
||||
@@ -1006,7 +1010,7 @@ bool MainWindow::handleEvent(UEvent* anEvent)
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::processCameraInfo(const rtabmap::CameraInfo & info)
|
||||
void MainWindow::processCameraInfo(const rtabmap::SensorCaptureInfo & info)
|
||||
{
|
||||
if(_firstStamp == 0.0)
|
||||
{
|
||||
@@ -1015,6 +1019,7 @@ void MainWindow::processCameraInfo(const rtabmap::CameraInfo & info)
|
||||
if(_preferencesDialog->isCacheSavedInFigures() || _ui->statsToolBox->isVisible())
|
||||
{
|
||||
_ui->statsToolBox->updateStat("Camera/Time capturing/ms", _preferencesDialog->isTimeUsedInFigures()?info.stamp-_firstStamp:(float)info.id, info.timeCapture*1000.0f, _preferencesDialog->isCacheSavedInFigures());
|
||||
_ui->statsToolBox->updateStat("Camera/Time deskewing/ms", _preferencesDialog->isTimeUsedInFigures()?info.stamp-_firstStamp:(float)info.id, info.timeDeskewing*1000.0f, _preferencesDialog->isCacheSavedInFigures());
|
||||
_ui->statsToolBox->updateStat("Camera/Time undistort depth/ms", _preferencesDialog->isTimeUsedInFigures()?info.stamp-_firstStamp:(float)info.id, info.timeUndistortDepth*1000.0f, _preferencesDialog->isCacheSavedInFigures());
|
||||
_ui->statsToolBox->updateStat("Camera/Time bilateral filtering/ms", _preferencesDialog->isTimeUsedInFigures()?info.stamp-_firstStamp:(float)info.id, info.timeBilateralFiltering*1000.0f, _preferencesDialog->isCacheSavedInFigures());
|
||||
_ui->statsToolBox->updateStat("Camera/Time decimation/ms", _preferencesDialog->isTimeUsedInFigures()?info.stamp-_firstStamp:(float)info.id, info.timeImageDecimation*1000.0f, _preferencesDialog->isCacheSavedInFigures());
|
||||
@@ -1800,6 +1805,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI
|
||||
_ui->statsToolBox->updateStat("Odometry/VarianceLin/", _preferencesDialog->isTimeUsedInFigures()?data->stamp()-_firstStamp:(float)data->id(), (float)linVar, _preferencesDialog->isCacheSavedInFigures());
|
||||
_ui->statsToolBox->updateStat("Odometry/StdDevAng/rad", _preferencesDialog->isTimeUsedInFigures()?data->stamp()-_firstStamp:(float)data->id(), sqrt((float)angVar), _preferencesDialog->isCacheSavedInFigures());
|
||||
_ui->statsToolBox->updateStat("Odometry/VarianceAng/", _preferencesDialog->isTimeUsedInFigures()?data->stamp()-_firstStamp:(float)data->id(), (float)angVar, _preferencesDialog->isCacheSavedInFigures());
|
||||
_ui->statsToolBox->updateStat("Odometry/TimeDeskewing/ms", _preferencesDialog->isTimeUsedInFigures()?data->stamp()-_firstStamp:(float)data->id(), (float)odom.info().timeDeskewing*1000.0f, _preferencesDialog->isCacheSavedInFigures());
|
||||
_ui->statsToolBox->updateStat("Odometry/TimeEstimation/ms", _preferencesDialog->isTimeUsedInFigures()?data->stamp()-_firstStamp:(float)data->id(), (float)odom.info().timeEstimation*1000.0f, _preferencesDialog->isCacheSavedInFigures());
|
||||
if(odom.info().timeParticleFiltering>0.0f)
|
||||
{
|
||||
@@ -4863,15 +4869,15 @@ void MainWindow::applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags)
|
||||
this->updateSelectSourceMenu();
|
||||
_ui->label_stats_source->setText(_preferencesDialog->getSourceDriverStr());
|
||||
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
if(dynamic_cast<DBReader*>(_camera->camera()) != 0)
|
||||
if(dynamic_cast<DBReader*>(_sensorCapture->camera()) != 0)
|
||||
{
|
||||
_camera->setImageRate( _preferencesDialog->isSourceDatabaseStampsUsed()?-1:_preferencesDialog->getGeneralInputRate());
|
||||
_sensorCapture->setFrameRate( _preferencesDialog->isSourceDatabaseStampsUsed()?-1:_preferencesDialog->getGeneralInputRate());
|
||||
}
|
||||
else
|
||||
{
|
||||
_camera->setImageRate(_preferencesDialog->getGeneralInputRate());
|
||||
_sensorCapture->setFrameRate(_preferencesDialog->getGeneralInputRate());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5293,6 +5299,7 @@ void MainWindow::updateSelectSourceMenu()
|
||||
_ui->actionDepthAI_oakd->setChecked(_preferencesDialog->getSourceDriver() == PreferencesDialog::kSrcStereoDepthAI);
|
||||
_ui->actionDepthAI_oakdlite->setChecked(_preferencesDialog->getSourceDriver() == PreferencesDialog::kSrcStereoDepthAI);
|
||||
_ui->actionDepthAI_oakdpro->setChecked(_preferencesDialog->getSourceDriver() == PreferencesDialog::kSrcStereoDepthAI);
|
||||
_ui->actionVelodyne_VLP_16->setChecked(_preferencesDialog->getLidarSourceDriver() == PreferencesDialog::kSrcLidarVLP16);
|
||||
}
|
||||
|
||||
void MainWindow::changeImgRateSetting()
|
||||
@@ -5710,29 +5717,6 @@ void MainWindow::editDatabase()
|
||||
}
|
||||
}
|
||||
|
||||
Camera * MainWindow::createCamera(
|
||||
Camera ** odomSensor,
|
||||
Transform & odomSensorExtrinsics,
|
||||
double & odomSensorTimeOffset,
|
||||
float & odomSensorScaleFactor)
|
||||
{
|
||||
Camera * camera = _preferencesDialog->createCamera();
|
||||
|
||||
if(camera &&
|
||||
_preferencesDialog->getOdomSourceDriver() != PreferencesDialog::kSrcUndef &&
|
||||
_preferencesDialog->getOdomSourceDriver() != _preferencesDialog->getSourceDriver() &&
|
||||
!(_preferencesDialog->getOdomSourceDriver() == PreferencesDialog::kSrcStereoRealSense2 &&
|
||||
_preferencesDialog->getSourceDriver() == PreferencesDialog::kSrcRealSense2))
|
||||
{
|
||||
UINFO("Create Odom Sensor %d (camera = %d)",
|
||||
_preferencesDialog->getOdomSourceDriver(),
|
||||
_preferencesDialog->getSourceDriver());
|
||||
*odomSensor = _preferencesDialog->createOdomSensor(odomSensorExtrinsics, odomSensorTimeOffset, odomSensorScaleFactor);
|
||||
}
|
||||
|
||||
return camera;
|
||||
}
|
||||
|
||||
void MainWindow::startDetection()
|
||||
{
|
||||
UDEBUG("");
|
||||
@@ -5810,18 +5794,19 @@ void MainWindow::startDetection()
|
||||
UDEBUG("");
|
||||
Q_EMIT stateChanged(kStartingDetection);
|
||||
|
||||
if(_camera != 0)
|
||||
if(_sensorCapture != 0)
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("A camera is running, stop it first."));
|
||||
UWARN("_camera is not null... it must be stopped first");
|
||||
UWARN("_sensorCapture is not null... it must be stopped first");
|
||||
Q_EMIT stateChanged(kInitialized);
|
||||
return;
|
||||
}
|
||||
|
||||
// Adjust pre-requirements
|
||||
if(_preferencesDialog->getSourceDriver() == PreferencesDialog::kSrcUndef)
|
||||
if(_preferencesDialog->getSourceDriver() == PreferencesDialog::kSrcUndef &&
|
||||
_preferencesDialog->getLidarSourceDriver() == PreferencesDialog::kSrcUndef)
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
@@ -5834,34 +5819,75 @@ void MainWindow::startDetection()
|
||||
|
||||
double poseTimeOffset = 0.0;
|
||||
float scaleFactor = 0.0f;
|
||||
double waitTime = 0.1;
|
||||
Transform extrinsics;
|
||||
Camera * odomSensor = 0;
|
||||
Camera * camera = this->createCamera(&odomSensor, extrinsics, poseTimeOffset, scaleFactor);
|
||||
if(!camera)
|
||||
SensorCapture * odomSensor = 0;
|
||||
Camera * camera = 0;
|
||||
Lidar * lidar = 0;
|
||||
|
||||
if(_preferencesDialog->getLidarSourceDriver() != PreferencesDialog::kSrcUndef)
|
||||
{
|
||||
Q_EMIT stateChanged(kInitialized);
|
||||
return;
|
||||
lidar = _preferencesDialog->createLidar();
|
||||
if(!lidar)
|
||||
{
|
||||
Q_EMIT stateChanged(kInitialized);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(odomSensor)
|
||||
if(!lidar || _preferencesDialog->getSourceDriver() != PreferencesDialog::kSrcUndef)
|
||||
{
|
||||
_camera = new CameraThread(camera, odomSensor, extrinsics, poseTimeOffset, scaleFactor, _preferencesDialog->isOdomSensorAsGt(), parameters);
|
||||
camera = _preferencesDialog->createCamera();
|
||||
if(!camera)
|
||||
{
|
||||
delete lidar;
|
||||
Q_EMIT stateChanged(kInitialized);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if(_preferencesDialog->getOdomSourceDriver() != PreferencesDialog::kSrcUndef)
|
||||
{
|
||||
_camera = new CameraThread(camera, _preferencesDialog->isOdomSensorAsGt(), parameters);
|
||||
if(camera == 0 ||
|
||||
(_preferencesDialog->getOdomSourceDriver() != _preferencesDialog->getSourceDriver() &&
|
||||
!(_preferencesDialog->getOdomSourceDriver() == PreferencesDialog::kSrcStereoRealSense2 &&
|
||||
_preferencesDialog->getSourceDriver() == PreferencesDialog::kSrcRealSense2)))
|
||||
{
|
||||
UINFO("Create Odom Sensor %d (camera = %d)",
|
||||
_preferencesDialog->getOdomSourceDriver(),
|
||||
_preferencesDialog->getSourceDriver());
|
||||
odomSensor = _preferencesDialog->createOdomSensor(extrinsics, poseTimeOffset, scaleFactor, waitTime);
|
||||
if(!odomSensor)
|
||||
{
|
||||
delete camera;
|
||||
delete lidar;
|
||||
Q_EMIT stateChanged(kInitialized);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(camera->odomProvided())
|
||||
{
|
||||
UINFO("The camera is also the odometry sensor (camera=%d odom=%d).",
|
||||
_preferencesDialog->getSourceDriver(),
|
||||
_preferencesDialog->getOdomSourceDriver());
|
||||
odomSensor = camera;
|
||||
}
|
||||
}
|
||||
_camera->setMirroringEnabled(_preferencesDialog->isSourceMirroring());
|
||||
_camera->setColorOnly(_preferencesDialog->isSourceRGBDColorOnly());
|
||||
_camera->setImageDecimation(_preferencesDialog->getSourceImageDecimation());
|
||||
_camera->setHistogramMethod(_preferencesDialog->getSourceHistogramMethod());
|
||||
|
||||
_sensorCapture = new SensorCaptureThread(lidar, camera, odomSensor, extrinsics, poseTimeOffset, scaleFactor, waitTime, parameters);
|
||||
|
||||
_sensorCapture->setOdomAsGroundTruth(_preferencesDialog->isOdomSensorAsGt());
|
||||
_sensorCapture->setMirroringEnabled(_preferencesDialog->isSourceMirroring());
|
||||
_sensorCapture->setColorOnly(_preferencesDialog->isSourceRGBDColorOnly());
|
||||
_sensorCapture->setImageDecimation(_preferencesDialog->getSourceImageDecimation());
|
||||
_sensorCapture->setHistogramMethod(_preferencesDialog->getSourceHistogramMethod());
|
||||
if(_preferencesDialog->isSourceFeatureDetection())
|
||||
{
|
||||
_camera->enableFeatureDetection(parameters);
|
||||
_sensorCapture->enableFeatureDetection(parameters);
|
||||
}
|
||||
_camera->setStereoToDepth(_preferencesDialog->isSourceStereoDepthGenerated());
|
||||
_camera->setStereoExposureCompensation(_preferencesDialog->isSourceStereoExposureCompensation());
|
||||
_camera->setScanParameters(
|
||||
_sensorCapture->setStereoToDepth(_preferencesDialog->isSourceStereoDepthGenerated());
|
||||
_sensorCapture->setStereoExposureCompensation(_preferencesDialog->isSourceStereoExposureCompensation());
|
||||
_sensorCapture->setScanParameters(
|
||||
_preferencesDialog->isSourceScanFromDepth(),
|
||||
_preferencesDialog->getSourceScanDownsampleStep(),
|
||||
_preferencesDialog->getSourceScanRangeMin(),
|
||||
@@ -5869,32 +5895,33 @@ void MainWindow::startDetection()
|
||||
_preferencesDialog->getSourceScanVoxelSize(),
|
||||
_preferencesDialog->getSourceScanNormalsK(),
|
||||
_preferencesDialog->getSourceScanNormalsRadius(),
|
||||
(float)_preferencesDialog->getSourceScanForceGroundNormalsUp());
|
||||
(float)_preferencesDialog->getSourceScanForceGroundNormalsUp(),
|
||||
_preferencesDialog->isSourceScanDeskewing());
|
||||
if(_preferencesDialog->getIMUFilteringStrategy()>0 && dynamic_cast<DBReader*>(camera) == 0)
|
||||
{
|
||||
_camera->enableIMUFiltering(_preferencesDialog->getIMUFilteringStrategy()-1, parameters, _preferencesDialog->getIMUFilteringBaseFrameConversion());
|
||||
_sensorCapture->enableIMUFiltering(_preferencesDialog->getIMUFilteringStrategy()-1, parameters, _preferencesDialog->getIMUFilteringBaseFrameConversion());
|
||||
}
|
||||
if(_preferencesDialog->isDepthFilteringAvailable())
|
||||
{
|
||||
if(_preferencesDialog->isBilateralFiltering())
|
||||
{
|
||||
_camera->enableBilateralFiltering(
|
||||
_sensorCapture->enableBilateralFiltering(
|
||||
_preferencesDialog->getBilateralSigmaS(),
|
||||
_preferencesDialog->getBilateralSigmaR());
|
||||
}
|
||||
_camera->setDistortionModel(_preferencesDialog->getSourceDistortionModel().toStdString());
|
||||
_sensorCapture->setDistortionModel(_preferencesDialog->getSourceDistortionModel().toStdString());
|
||||
}
|
||||
|
||||
//Create odometry thread if rgbd slam
|
||||
if(uStr2Bool(parameters.at(Parameters::kRGBDEnabled()).c_str()))
|
||||
{
|
||||
// Require calibrated camera
|
||||
if(!camera->isCalibrated())
|
||||
if(camera && !camera->isCalibrated())
|
||||
{
|
||||
UWARN("Camera is not calibrated!");
|
||||
Q_EMIT stateChanged(kInitialized);
|
||||
delete _camera;
|
||||
_camera = 0;
|
||||
delete _sensorCapture;
|
||||
_sensorCapture = 0;
|
||||
|
||||
int button = QMessageBox::question(this,
|
||||
tr("Camera is not calibrated!"),
|
||||
@@ -5922,7 +5949,7 @@ void MainWindow::startDetection()
|
||||
_imuThread = 0;
|
||||
}
|
||||
|
||||
if((!_camera->odomProvided() || _preferencesDialog->isOdomSensorAsGt()) && !_preferencesDialog->isOdomDisabled())
|
||||
if(!_sensorCapture->odomProvided() && !_preferencesDialog->isOdomDisabled())
|
||||
{
|
||||
ParametersMap odomParameters = parameters;
|
||||
if(_preferencesDialog->getOdomRegistrationApproach() < 3)
|
||||
@@ -5958,8 +5985,8 @@ void MainWindow::startDetection()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Source IMU Path"),
|
||||
tr("Initialization of IMU data has failed! Path=%1.").arg(_preferencesDialog->getIMUPath()), QMessageBox::Ok);
|
||||
delete _camera;
|
||||
_camera = 0;
|
||||
delete _sensorCapture;
|
||||
_sensorCapture = 0;
|
||||
delete _imuThread;
|
||||
_imuThread = 0;
|
||||
return;
|
||||
@@ -5969,8 +5996,8 @@ void MainWindow::startDetection()
|
||||
_odomThread = new OdometryThread(odom, _preferencesDialog->getOdomBufferSize());
|
||||
|
||||
UEventsManager::addHandler(_odomThread);
|
||||
UEventsManager::createPipe(_camera, _odomThread, "CameraEvent");
|
||||
UEventsManager::createPipe(_camera, this, "CameraEvent");
|
||||
UEventsManager::createPipe(_sensorCapture, _odomThread, "SensorEvent");
|
||||
UEventsManager::createPipe(_sensorCapture, this, "SensorEvent");
|
||||
if(_imuThread)
|
||||
{
|
||||
UEventsManager::createPipe(_imuThread, _odomThread, "IMUEvent");
|
||||
@@ -5980,9 +6007,9 @@ void MainWindow::startDetection()
|
||||
}
|
||||
}
|
||||
|
||||
if(_dataRecorder && _camera && _odomThread)
|
||||
if(_dataRecorder && _sensorCapture && _odomThread)
|
||||
{
|
||||
UEventsManager::createPipe(_camera, _dataRecorder, "CameraEvent");
|
||||
UEventsManager::createPipe(_sensorCapture, _dataRecorder, "SensorEvent");
|
||||
}
|
||||
|
||||
_lastOdomPose.setNull();
|
||||
@@ -6036,7 +6063,7 @@ void MainWindow::startDetection()
|
||||
// Could not be in the main thread here! (see handleEvents())
|
||||
void MainWindow::pauseDetection()
|
||||
{
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
if(_state == kPaused && (QApplication::keyboardModifiers() & Qt::ShiftModifier))
|
||||
{
|
||||
@@ -6070,13 +6097,13 @@ void MainWindow::pauseDetection()
|
||||
|
||||
void MainWindow::stopDetection()
|
||||
{
|
||||
if(!_camera && !_odomThread)
|
||||
if(!_sensorCapture && !_odomThread)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(_state == kDetecting &&
|
||||
(_camera && _camera->isRunning()) )
|
||||
(_sensorCapture && _sensorCapture->isRunning()) )
|
||||
{
|
||||
QMessageBox::StandardButton button = QMessageBox::question(this, tr("Stopping process..."), tr("Are you sure you want to stop the process?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
|
||||
|
||||
@@ -6093,9 +6120,9 @@ void MainWindow::stopDetection()
|
||||
_imuThread->join(true);
|
||||
}
|
||||
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
_camera->join(true);
|
||||
_sensorCapture->join(true);
|
||||
}
|
||||
|
||||
if(_odomThread)
|
||||
@@ -6110,10 +6137,10 @@ void MainWindow::stopDetection()
|
||||
delete _imuThread;
|
||||
_imuThread = 0;
|
||||
}
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
delete _camera;
|
||||
_camera = 0;
|
||||
delete _sensorCapture;
|
||||
_sensorCapture = 0;
|
||||
}
|
||||
if(_odomThread)
|
||||
{
|
||||
@@ -7201,6 +7228,11 @@ void MainWindow::selectDepthAIOAKDPro()
|
||||
_preferencesDialog->selectSourceDriver(PreferencesDialog::kSrcStereoDepthAI, 2); // variant 2=IMU+color
|
||||
}
|
||||
|
||||
void MainWindow::selectVLP16()
|
||||
{
|
||||
_preferencesDialog->selectSourceDriver(PreferencesDialog::kSrcLidarVLP16);
|
||||
}
|
||||
|
||||
void MainWindow::dumpTheMemory()
|
||||
{
|
||||
this->post(new RtabmapEventCmd(RtabmapEventCmd::kCmdDumpMemory));
|
||||
@@ -8311,9 +8343,9 @@ void MainWindow::dataRecorder()
|
||||
this->connect(_dataRecorder, SIGNAL(destroyed(QObject*)), this, SLOT(dataRecorderDestroyed()));
|
||||
_dataRecorder->show();
|
||||
_dataRecorder->registerToEventsManager();
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
UEventsManager::createPipe(_camera, _dataRecorder, "CameraEvent");
|
||||
UEventsManager::createPipe(_sensorCapture, _dataRecorder, "SensorEvent");
|
||||
}
|
||||
_ui->actionData_recorder->setEnabled(false);
|
||||
}
|
||||
@@ -8580,9 +8612,9 @@ void MainWindow::changeState(MainWindow::State newState)
|
||||
|
||||
_databaseUpdated = true; // if a new database is used, it won't be empty anymore...
|
||||
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
_camera->start();
|
||||
_sensorCapture->start();
|
||||
if(_imuThread)
|
||||
{
|
||||
_imuThread->start();
|
||||
@@ -8616,9 +8648,9 @@ void MainWindow::changeState(MainWindow::State newState)
|
||||
_elapsedTime->start();
|
||||
_oneSecondTimer->start();
|
||||
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
_camera->start();
|
||||
_sensorCapture->start();
|
||||
if(_imuThread)
|
||||
{
|
||||
_imuThread->start();
|
||||
@@ -8654,13 +8686,13 @@ void MainWindow::changeState(MainWindow::State newState)
|
||||
_oneSecondTimer->stop();
|
||||
|
||||
// kill sensors
|
||||
if(_camera)
|
||||
if(_sensorCapture)
|
||||
{
|
||||
if(_imuThread)
|
||||
{
|
||||
_imuThread->join(true);
|
||||
}
|
||||
_camera->join(true);
|
||||
_sensorCapture->join(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -26,6 +26,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Should be first on windows to avoid "WinSock.h has already been included" error
|
||||
#include "rtabmap/core/lidar/LidarVLP16.h"
|
||||
|
||||
#include "rtabmap/gui/PreferencesDialog.h"
|
||||
#include "rtabmap/gui/DatabaseViewer.h"
|
||||
#include "rtabmap/gui/OdometryViewer.h"
|
||||
@@ -56,9 +59,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "rtabmap/core/Odometry.h"
|
||||
#include "rtabmap/core/OdometryThread.h"
|
||||
#include "rtabmap/core/CameraRGBD.h"
|
||||
#include "rtabmap/core/CameraThread.h"
|
||||
#include "rtabmap/core/CameraRGB.h"
|
||||
#include "rtabmap/core/CameraStereo.h"
|
||||
#include "rtabmap/core/IMUFilter.h"
|
||||
#include "rtabmap/core/IMUThread.h"
|
||||
#include "rtabmap/core/Memory.h"
|
||||
#include "rtabmap/core/VWDictionary.h"
|
||||
@@ -84,7 +87,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/utilite/UEventsManager.h>
|
||||
#include "rtabmap/utilite/UPlot.h"
|
||||
|
||||
// Presets
|
||||
#include "camera_tof_icp_ini.h"
|
||||
#include "lidar3d_icp_ini.h"
|
||||
|
||||
#include <opencv2/opencv_modules.hpp>
|
||||
#include <rtabmap/core/SensorCaptureThread.h>
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#include <opencv2/gpu/gpu.hpp>
|
||||
@@ -445,6 +453,9 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
connect(_ui->source_comboBox_image_type, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSourceGrpVisibility()));
|
||||
connect(_ui->comboBox_cameraStereo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSourceGrpVisibility()));
|
||||
connect(_ui->comboBox_imuFilter_strategy, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSourceGrpVisibility()));
|
||||
connect(_ui->comboBox_odom_sensor, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSourceGrpVisibility()));
|
||||
connect(_ui->comboBox_lidar_src, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSourceGrpVisibility()));
|
||||
connect(_ui->checkBox_source_scanFromDepth, SIGNAL(stateChanged(int)), this, SLOT(updateSourceGrpVisibility()));
|
||||
this->resetSettings(_ui->groupBox_source0);
|
||||
|
||||
_ui->predictionPlot->showLegend(false);
|
||||
@@ -459,9 +470,12 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
connect(_ui->pushButton_loadConfig, SIGNAL(clicked()), this, SLOT(loadConfigFrom()));
|
||||
connect(_ui->pushButton_saveConfig, SIGNAL(clicked()), this, SLOT(saveConfigTo()));
|
||||
connect(_ui->pushButton_resetConfig, SIGNAL(clicked()), this, SLOT(resetConfig()));
|
||||
connect(_ui->pushButton_presets_camera_tof_icp, SIGNAL(clicked()), this, SLOT(loadPreset()));
|
||||
connect(_ui->pushButton_presets_lidar_3d_icp, SIGNAL(clicked()), this, SLOT(loadPreset()));
|
||||
connect(_ui->radioButton_basic, SIGNAL(toggled(bool)), this, SLOT(setupTreeView()));
|
||||
connect(_ui->pushButton_testOdometry, SIGNAL(clicked()), this, SLOT(testOdometry()));
|
||||
connect(_ui->pushButton_test_camera, SIGNAL(clicked()), this, SLOT(testCamera()));
|
||||
connect(_ui->pushButton_test_lidar, SIGNAL(clicked()), this, SLOT(testLidar()));
|
||||
|
||||
// General panel
|
||||
connect(_ui->general_checkBox_imagesKept, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteGeneralPanel()));
|
||||
@@ -862,6 +876,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
connect(_ui->lineEdit_odomSourceDevice, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->doubleSpinBox_odom_sensor_time_offset, SIGNAL(valueChanged(double)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->doubleSpinBox_odom_sensor_scale_factor, SIGNAL(valueChanged(double)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->doubleSpinBox_odom_sensor_wait_time, SIGNAL(valueChanged(double)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->checkBox_odom_sensor_use_as_gt, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
|
||||
connect(_ui->comboBox_imuFilter_strategy, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
@@ -870,6 +885,10 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
connect(_ui->checkBox_imuFilter_baseFrameConversion, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->checkbox_publishInterIMU, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
|
||||
connect(_ui->comboBox_lidar_src, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->comboBox_lidar_src, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_lidar_src, SLOT(setCurrentIndex(int)));
|
||||
_ui->stackedWidget_lidar_src->setCurrentIndex(_ui->comboBox_lidar_src->currentIndex());
|
||||
connect(_ui->checkBox_source_scanDeskewing, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->checkBox_source_scanFromDepth, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->spinBox_source_scanDownsampleStep, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->doubleSpinBox_source_scanRangeMin, SIGNAL(valueChanged(double)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
@@ -879,6 +898,17 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
connect(_ui->doubleSpinBox_source_scanNormalsRadius, SIGNAL(valueChanged(double)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->doubleSpinBox_source_scanNormalsForceGroundUp, SIGNAL(valueChanged(double)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
|
||||
connect(_ui->lineEdit_lidar_local_transform, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->toolButton_vlp16_pcap_path, SIGNAL(clicked()), this, SLOT(selectVlp16PcapPath()));
|
||||
connect(_ui->lineEdit_vlp16_pcap_path, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->spinBox_vlp16_ip1, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->spinBox_vlp16_ip2, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->spinBox_vlp16_ip2, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->spinBox_vlp16_ip4, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->spinBox_vlp16_port, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->checkBox_vlp16_organized, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->checkBox_vlp16_hostTime, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->checkBox_vlp16_stamp_last, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
|
||||
//Rtabmap basic
|
||||
connect(_ui->general_doubleSpinBox_timeThr, SIGNAL(valueChanged(double)), _ui->general_doubleSpinBox_timeThr_2, SLOT(setValue(double)));
|
||||
@@ -1239,6 +1269,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
_ui->loopClosure_icpDownsamplingStep->setObjectName(Parameters::kIcpDownsamplingStep().c_str());
|
||||
_ui->loopClosure_icpRangeMin->setObjectName(Parameters::kIcpRangeMin().c_str());
|
||||
_ui->loopClosure_icpRangeMax->setObjectName(Parameters::kIcpRangeMax().c_str());
|
||||
_ui->loopClosure_icpFiltersEnabled->setObjectName(Parameters::kIcpFiltersEnabled().c_str());
|
||||
_ui->loopClosure_icpMaxCorrespondenceDistance->setObjectName(Parameters::kIcpMaxCorrespondenceDistance().c_str());
|
||||
_ui->loopClosure_icpReciprocalCorrespondences->setObjectName(Parameters::kIcpReciprocalCorrespondences().c_str());
|
||||
_ui->loopClosure_icpIterations->setObjectName(Parameters::kIcpIterations().c_str());
|
||||
@@ -1323,6 +1354,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
_ui->odom_guess_smoothing_delay->setObjectName(Parameters::kOdomGuessSmoothingDelay().c_str());
|
||||
_ui->odom_imageDecimation->setObjectName(Parameters::kOdomImageDecimation().c_str());
|
||||
_ui->odom_alignWithGround->setObjectName(Parameters::kOdomAlignWithGround().c_str());
|
||||
_ui->odom_lidar_deskewing->setObjectName(Parameters::kOdomDeskewing().c_str());
|
||||
|
||||
//Odometry Frame to Map
|
||||
_ui->odom_localHistory->setObjectName(Parameters::kOdomF2MMaxSize().c_str());
|
||||
@@ -2208,6 +2240,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
||||
_ui->lineEdit_odomSourceDevice->setText("");
|
||||
_ui->doubleSpinBox_odom_sensor_time_offset->setValue(0.0);
|
||||
_ui->doubleSpinBox_odom_sensor_scale_factor->setValue(1);
|
||||
_ui->doubleSpinBox_odom_sensor_wait_time->setValue(100);
|
||||
_ui->checkBox_odom_sensor_use_as_gt->setChecked(false);
|
||||
|
||||
_ui->comboBox_imuFilter_strategy->setCurrentIndex(2);
|
||||
@@ -2220,6 +2253,8 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
||||
_ui->checkBox_imuFilter_baseFrameConversion->setChecked(true);
|
||||
_ui->checkbox_publishInterIMU->setChecked(false);
|
||||
|
||||
_ui->comboBox_lidar_src->setCurrentIndex(0);
|
||||
_ui->checkBox_source_scanDeskewing->setChecked(false);
|
||||
_ui->checkBox_source_scanFromDepth->setChecked(false);
|
||||
_ui->spinBox_source_scanDownsampleStep->setValue(1);
|
||||
_ui->doubleSpinBox_source_scanRangeMin->setValue(0);
|
||||
@@ -2229,6 +2264,17 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
||||
_ui->doubleSpinBox_source_scanNormalsRadius->setValue(0.0);
|
||||
_ui->doubleSpinBox_source_scanNormalsForceGroundUp->setValue(0);
|
||||
|
||||
_ui->lineEdit_lidar_local_transform->setText("0 0 0 0 0 0");
|
||||
_ui->lineEdit_vlp16_pcap_path->clear();
|
||||
_ui->spinBox_vlp16_ip1->setValue(192);
|
||||
_ui->spinBox_vlp16_ip2->setValue(168);
|
||||
_ui->spinBox_vlp16_ip3->setValue(1);
|
||||
_ui->spinBox_vlp16_ip4->setValue(201);
|
||||
_ui->spinBox_vlp16_port->setValue(2368);
|
||||
_ui->checkBox_vlp16_organized->setChecked(false);
|
||||
_ui->checkBox_vlp16_hostTime->setChecked(true);
|
||||
_ui->checkBox_vlp16_stamp_last->setChecked(true);
|
||||
|
||||
_ui->groupBox_depthFromScan->setChecked(false);
|
||||
_ui->groupBox_depthFromScan_fillHoles->setChecked(true);
|
||||
_ui->radioButton_depthFromScan_vertical->setChecked(true);
|
||||
@@ -2715,6 +2761,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
|
||||
_ui->lineEdit_odomSourceDevice->setText(settings.value("odom_sensor_device", _ui->lineEdit_odomSourceDevice->text()).toString());
|
||||
_ui->doubleSpinBox_odom_sensor_time_offset->setValue(settings.value("odom_sensor_offset_time", _ui->doubleSpinBox_odom_sensor_time_offset->value()).toDouble());
|
||||
_ui->doubleSpinBox_odom_sensor_scale_factor->setValue(settings.value("odom_sensor_scale_factor", _ui->doubleSpinBox_odom_sensor_scale_factor->value()).toDouble());
|
||||
_ui->doubleSpinBox_odom_sensor_wait_time->setValue(settings.value("odom_sensor_wait_time", _ui->doubleSpinBox_odom_sensor_wait_time->value()).toDouble());
|
||||
_ui->checkBox_odom_sensor_use_as_gt->setChecked(settings.value("odom_sensor_odom_as_gt", _ui->checkBox_odom_sensor_use_as_gt->isChecked()).toBool());
|
||||
settings.endGroup(); // OdomSensor
|
||||
|
||||
@@ -2740,6 +2787,8 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
|
||||
settings.endGroup();//IMU
|
||||
|
||||
settings.beginGroup("Scan");
|
||||
_ui->comboBox_lidar_src->setCurrentIndex(settings.value("source", _ui->comboBox_lidar_src->currentIndex()).toInt());
|
||||
_ui->checkBox_source_scanDeskewing->setChecked(settings.value("deskewing", _ui->checkBox_source_scanDeskewing->isChecked()).toBool());
|
||||
_ui->checkBox_source_scanFromDepth->setChecked(settings.value("fromDepth", _ui->checkBox_source_scanFromDepth->isChecked()).toBool());
|
||||
_ui->spinBox_source_scanDownsampleStep->setValue(settings.value("downsampleStep", _ui->spinBox_source_scanDownsampleStep->value()).toInt());
|
||||
_ui->doubleSpinBox_source_scanRangeMin->setValue(settings.value("rangeMin", _ui->doubleSpinBox_source_scanRangeMin->value()).toDouble());
|
||||
@@ -2774,6 +2823,23 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
|
||||
|
||||
settings.endGroup(); // Camera
|
||||
|
||||
settings.beginGroup("Lidar");
|
||||
|
||||
settings.beginGroup("VLP16");
|
||||
_ui->lineEdit_lidar_local_transform->setText(settings.value("localTransform",_ui->lineEdit_lidar_local_transform->text()).toString());
|
||||
_ui->lineEdit_vlp16_pcap_path->setText(settings.value("pcapPath",_ui->lineEdit_vlp16_pcap_path->text()).toString());
|
||||
_ui->spinBox_vlp16_ip1->setValue(settings.value("ip1", _ui->spinBox_vlp16_ip1->value()).toInt());
|
||||
_ui->spinBox_vlp16_ip2->setValue(settings.value("ip2", _ui->spinBox_vlp16_ip2->value()).toInt());
|
||||
_ui->spinBox_vlp16_ip3->setValue(settings.value("ip3", _ui->spinBox_vlp16_ip3->value()).toInt());
|
||||
_ui->spinBox_vlp16_ip4->setValue(settings.value("ip4", _ui->spinBox_vlp16_ip4->value()).toInt());
|
||||
_ui->spinBox_vlp16_port->setValue(settings.value("port", _ui->spinBox_vlp16_port->value()).toInt());
|
||||
_ui->checkBox_vlp16_organized->setChecked(settings.value("organized", _ui->checkBox_vlp16_organized->isChecked()).toBool());
|
||||
_ui->checkBox_vlp16_hostTime->setChecked(settings.value("hostTime", _ui->checkBox_vlp16_hostTime->isChecked()).toBool());
|
||||
_ui->checkBox_vlp16_stamp_last->setChecked(settings.value("stampLast", _ui->checkBox_vlp16_stamp_last->isChecked()).toBool());
|
||||
settings.endGroup(); // VLP16
|
||||
|
||||
settings.endGroup(); // Lidar
|
||||
|
||||
_calibrationDialog->loadSettings(settings, "CalibrationDialog");
|
||||
|
||||
}
|
||||
@@ -2898,6 +2964,45 @@ void PreferencesDialog::resetConfig()
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::loadPreset(const std::string & presetHexHeader)
|
||||
{
|
||||
ParametersMap parameters = Parameters::getDefaultParameters();
|
||||
if(!presetHexHeader.empty())
|
||||
{
|
||||
Parameters::readINIStr(uHex2Str(presetHexHeader), parameters);
|
||||
}
|
||||
|
||||
// Reset 3D rendering panel
|
||||
this->resetSettings(1);
|
||||
// Update parameters
|
||||
parameters.erase(Parameters::kRtabmapWorkingDirectory());
|
||||
for(ParametersMap::iterator iter=parameters.begin(); iter!=parameters.end(); ++iter)
|
||||
{
|
||||
this->setParameter(iter->first, iter->second);
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::loadPreset()
|
||||
{
|
||||
if(sender() == _ui->pushButton_presets_camera_tof_icp)
|
||||
{
|
||||
loadPreset(CAMERA_TOF_ICP_INI);
|
||||
}
|
||||
else if(sender() == _ui->pushButton_presets_lidar_3d_icp)
|
||||
{
|
||||
loadPreset(LIDAR3D_ICP_INI);
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("Unknown sender!");
|
||||
return;
|
||||
}
|
||||
QMessageBox::information(this,
|
||||
tr("Preset"),
|
||||
tr("Loaded \"%1\" preset!").arg(((QPushButton*)sender())->text()),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
void PreferencesDialog::writeSettings(const QString & filePath)
|
||||
{
|
||||
writeGuiSettings(filePath);
|
||||
@@ -3254,6 +3359,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
|
||||
settings.setValue("odom_sensor_device", _ui->lineEdit_odomSourceDevice->text());
|
||||
settings.setValue("odom_sensor_offset_time", _ui->doubleSpinBox_odom_sensor_time_offset->value());
|
||||
settings.setValue("odom_sensor_scale_factor", _ui->doubleSpinBox_odom_sensor_scale_factor->value());
|
||||
settings.setValue("odom_sensor_wait_time", _ui->doubleSpinBox_odom_sensor_wait_time->value());
|
||||
settings.setValue("odom_sensor_odom_as_gt", _ui->checkBox_odom_sensor_use_as_gt->isChecked());
|
||||
settings.endGroup(); // OdomSensor
|
||||
|
||||
@@ -3279,6 +3385,8 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
|
||||
settings.endGroup();//IMU
|
||||
|
||||
settings.beginGroup("Scan");
|
||||
settings.setValue("source", _ui->comboBox_lidar_src->currentIndex());
|
||||
settings.setValue("deskewing", _ui->checkBox_source_scanDeskewing->isChecked());
|
||||
settings.setValue("fromDepth", _ui->checkBox_source_scanFromDepth->isChecked());
|
||||
settings.setValue("downsampleStep", _ui->spinBox_source_scanDownsampleStep->value());
|
||||
settings.setValue("rangeMin", _ui->doubleSpinBox_source_scanRangeMin->value());
|
||||
@@ -3313,6 +3421,23 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
|
||||
|
||||
settings.endGroup(); // Camera
|
||||
|
||||
settings.beginGroup("Lidar");
|
||||
|
||||
settings.beginGroup("VLP16");
|
||||
settings.setValue("localTransform",_ui->lineEdit_lidar_local_transform->text());
|
||||
settings.setValue("pcapPath",_ui->lineEdit_vlp16_pcap_path->text());
|
||||
settings.setValue("ip1", _ui->spinBox_vlp16_ip1->value());
|
||||
settings.setValue("ip2", _ui->spinBox_vlp16_ip2->value());
|
||||
settings.setValue("ip3", _ui->spinBox_vlp16_ip3->value());
|
||||
settings.setValue("ip4", _ui->spinBox_vlp16_ip4->value());
|
||||
settings.setValue("port", _ui->spinBox_vlp16_port->value());
|
||||
settings.setValue("organized", _ui->checkBox_vlp16_organized->isChecked());
|
||||
settings.setValue("hostTime", _ui->checkBox_vlp16_hostTime->isChecked());
|
||||
settings.setValue("stampLast", _ui->checkBox_vlp16_stamp_last->isChecked());
|
||||
settings.endGroup(); // VLP16
|
||||
|
||||
settings.endGroup(); // Lidar
|
||||
|
||||
_calibrationDialog->saveSettings(settings, "CalibrationDialog");
|
||||
}
|
||||
|
||||
@@ -4049,6 +4174,9 @@ void PreferencesDialog::updateParameters(const ParametersMap & parameters, bool
|
||||
|
||||
void PreferencesDialog::selectSourceDriver(Src src, int variant)
|
||||
{
|
||||
Src previousCameraSrc = getSourceDriver();
|
||||
Src previousLidarSrc = getLidarSourceDriver();
|
||||
|
||||
if(_ui->comboBox_imuFilter_strategy->currentIndex()==0)
|
||||
{
|
||||
_ui->comboBox_imuFilter_strategy->setCurrentIndex(2);
|
||||
@@ -4117,10 +4245,33 @@ void PreferencesDialog::selectSourceDriver(Src src, int variant)
|
||||
_ui->comboBox_sourceType->setCurrentIndex(2);
|
||||
_ui->source_comboBox_image_type->setCurrentIndex(src - kSrcRGB);
|
||||
}
|
||||
else if(src >= kSrcDatabase)
|
||||
else if(src == kSrcDatabase)
|
||||
{
|
||||
_ui->comboBox_sourceType->setCurrentIndex(3);
|
||||
}
|
||||
else if(src >= kSrcLidar)
|
||||
{
|
||||
_ui->comboBox_lidar_src->setCurrentIndex(kSrcLidarVLP16 - kSrcLidar + 1);
|
||||
}
|
||||
|
||||
if(previousCameraSrc == kSrcUndef && src < kSrcDatabase &&
|
||||
QMessageBox::question(this, tr("Camera Source..."),
|
||||
tr("Do you want to use default camera settings?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
|
||||
{
|
||||
loadPreset("");
|
||||
_ui->comboBox_lidar_src->setCurrentIndex(0); // Set Lidar to None;
|
||||
_ui->comboBox_odom_sensor->setCurrentIndex(0); // Set odom sensor to None
|
||||
}
|
||||
else if(previousLidarSrc== kSrcUndef && src >= kSrcLidar &&
|
||||
QMessageBox::question(this, tr("LiDAR Source..."),
|
||||
tr("Do you want to use \"LiDAR 3D ICP\" preset?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
|
||||
{
|
||||
loadPreset(LIDAR3D_ICP_INI);
|
||||
_ui->comboBox_sourceType->setCurrentIndex(4); // Set camera to None;
|
||||
_ui->comboBox_odom_sensor->setCurrentIndex(0); // Set odom sensor to No
|
||||
}
|
||||
|
||||
if(validateForm())
|
||||
{
|
||||
@@ -4571,6 +4722,20 @@ void PreferencesDialog::selectSourceDepthaiBlobPath()
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::selectVlp16PcapPath()
|
||||
{
|
||||
QString dir = _ui->lineEdit_vlp16_pcap_path->text();
|
||||
if (dir.isEmpty())
|
||||
{
|
||||
dir = getWorkingDirectory();
|
||||
}
|
||||
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), dir, tr("Velodyne recording (*.pcap)"));
|
||||
if (!path.isEmpty())
|
||||
{
|
||||
_ui->lineEdit_vlp16_pcap_path->setText(path);
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::setParameter(const std::string & key, const std::string & value)
|
||||
{
|
||||
UDEBUG("%s=%s", key.c_str(), value.c_str());
|
||||
@@ -5432,14 +5597,14 @@ void PreferencesDialog::changePyDetectorPath()
|
||||
|
||||
void PreferencesDialog::updateSourceGrpVisibility()
|
||||
{
|
||||
_ui->stackedWidget_src->setVisible(_ui->comboBox_sourceType->currentIndex() != 4); // Not Camera None
|
||||
_ui->frame_camera_sensor->setVisible(_ui->comboBox_sourceType->currentIndex() != 4); // Not Camera None
|
||||
|
||||
_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);
|
||||
|
||||
_ui->checkBox_source_scanFromDepth->setVisible(_ui->comboBox_sourceType->currentIndex() <= 1 || _ui->comboBox_sourceType->currentIndex() == 3);
|
||||
_ui->label_source_scanFromDepth->setVisible(_ui->comboBox_sourceType->currentIndex() <= 1 || _ui->comboBox_sourceType->currentIndex() == 3);
|
||||
|
||||
_ui->stackedWidget_rgbd->setVisible(_ui->comboBox_sourceType->currentIndex() == 0 &&
|
||||
(_ui->comboBox_cameraRGBD->currentIndex() == kSrcOpenNI2-kSrcRGBD ||
|
||||
_ui->comboBox_cameraRGBD->currentIndex() == kSrcFreenect2-kSrcRGBD ||
|
||||
@@ -5492,6 +5657,30 @@ void PreferencesDialog::updateSourceGrpVisibility()
|
||||
_ui->comboBox_sourceType->currentIndex() == 3); // Database
|
||||
_ui->groupBox_depthImageFiltering->setVisible(_ui->groupBox_depthImageFiltering->isEnabled());
|
||||
|
||||
_ui->groupBox_depthFromScan->setVisible(_ui->comboBox_sourceType->currentIndex() == 2 && _ui->source_comboBox_image_type->currentIndex() == kSrcImages-kSrcRGB);
|
||||
|
||||
// Odom Sensor Group
|
||||
_ui->frame_visual_odometry_sensor->setVisible(getOdomSourceDriver() != kSrcUndef); // Not Lidar None
|
||||
_ui->groupBox_odom_sensor->setVisible(_ui->comboBox_sourceType->currentIndex() != 3); // Don't show when database is selected
|
||||
|
||||
// Lidar Sensor Group
|
||||
_ui->comboBox_lidar_src->setEnabled(_ui->comboBox_sourceType->currentIndex() != 3); // Disable if database input
|
||||
if(!_ui->comboBox_lidar_src->isEnabled() && _ui->comboBox_lidar_src->currentIndex() != 0)
|
||||
{
|
||||
_ui->comboBox_lidar_src->setCurrentIndex(0); // Set to none
|
||||
}
|
||||
_ui->checkBox_source_scanFromDepth->setEnabled(_ui->comboBox_sourceType->currentIndex() <= 1 || _ui->comboBox_sourceType->currentIndex() == 3);
|
||||
_ui->label_source_scanFromDepth->setEnabled(_ui->checkBox_source_scanFromDepth->isEnabled());
|
||||
if(!_ui->checkBox_source_scanFromDepth->isEnabled())
|
||||
{
|
||||
_ui->checkBox_source_scanFromDepth->setChecked(false);
|
||||
}
|
||||
_ui->stackedWidget_lidar_src->setVisible(_ui->comboBox_lidar_src->currentIndex() > 0);
|
||||
_ui->groupBox_vlp16->setVisible(_ui->comboBox_lidar_src->currentIndex()-1 == kSrcLidarVLP16-kSrcLidar);
|
||||
_ui->frame_lidar_sensor->setVisible(_ui->comboBox_lidar_src->currentIndex() > 0 || _ui->checkBox_source_scanFromDepth->isChecked()); // Not Lidar None or database input
|
||||
_ui->pushButton_test_lidar->setEnabled(_ui->comboBox_lidar_src->currentIndex() > 0);
|
||||
|
||||
// IMU group
|
||||
_ui->groupBox_imuFiltering->setEnabled(
|
||||
(_ui->comboBox_sourceType->currentIndex() == 0 && _ui->comboBox_cameraRGBD->currentIndex() == kSrcRGBDImages-kSrcRGBD) ||
|
||||
(_ui->comboBox_sourceType->currentIndex() == 1 && _ui->comboBox_cameraStereo->currentIndex() == kSrcStereoImages-kSrcStereo) ||
|
||||
@@ -5504,14 +5693,11 @@ void PreferencesDialog::updateSourceGrpVisibility()
|
||||
(_ui->comboBox_sourceType->currentIndex() == 1 && _ui->comboBox_cameraStereo->currentIndex() == kSrcStereoMyntEye - kSrcStereo) || // MYNT EYE S
|
||||
(_ui->comboBox_sourceType->currentIndex() == 1 && _ui->comboBox_cameraStereo->currentIndex() == kSrcStereoZedOC - kSrcStereo) ||
|
||||
(_ui->comboBox_sourceType->currentIndex() == 1 && _ui->comboBox_cameraStereo->currentIndex() == kSrcStereoDepthAI - kSrcStereo));
|
||||
_ui->frame_imu_filtering->setVisible(getIMUFilteringStrategy() > 0); // Not None
|
||||
_ui->stackedWidget_imuFilter->setVisible(_ui->comboBox_imuFilter_strategy->currentIndex() > 0);
|
||||
_ui->groupBox_madgwickfilter->setVisible(_ui->comboBox_imuFilter_strategy->currentIndex() == 1);
|
||||
_ui->groupBox_complementaryfilter->setVisible(_ui->comboBox_imuFilter_strategy->currentIndex() == 2);
|
||||
_ui->groupBox_imuFiltering->setVisible(_ui->groupBox_imuFiltering->isEnabled());
|
||||
|
||||
//_ui->groupBox_scan->setVisible(_ui->comboBox_sourceType->currentIndex() != 3);
|
||||
|
||||
_ui->groupBox_depthFromScan->setVisible(_ui->comboBox_sourceType->currentIndex() == 2 && _ui->source_comboBox_image_type->currentIndex() == kSrcImages-kSrcRGB);
|
||||
}
|
||||
|
||||
/*** GETTERS ***/
|
||||
@@ -6048,6 +6234,15 @@ PreferencesDialog::Src PreferencesDialog::getOdomSourceDriver() const
|
||||
return kSrcUndef;
|
||||
}
|
||||
|
||||
PreferencesDialog::Src PreferencesDialog::getLidarSourceDriver() const
|
||||
{
|
||||
if(_ui->comboBox_lidar_src->currentIndex() == 0)
|
||||
{
|
||||
return kSrcUndef;
|
||||
}
|
||||
return (PreferencesDialog::Src)(_ui->comboBox_lidar_src->currentIndex()-1 + kSrcLidar);
|
||||
}
|
||||
|
||||
Transform PreferencesDialog::getSourceLocalTransform() const
|
||||
{
|
||||
Transform t = Transform::fromString(_ui->lineEdit_sourceLocalTransform->text().replace("PI_2", QString::number(3.141592/2.0)).toStdString());
|
||||
@@ -6146,6 +6341,10 @@ bool PreferencesDialog::isSourceScanFromDepth() const
|
||||
{
|
||||
return _ui->checkBox_source_scanFromDepth->isChecked();
|
||||
}
|
||||
bool PreferencesDialog::isSourceScanDeskewing() const
|
||||
{
|
||||
return _ui->checkBox_source_scanDeskewing->isChecked();
|
||||
}
|
||||
int PreferencesDialog::getSourceScanDownsampleStep() const
|
||||
{
|
||||
return _ui->spinBox_source_scanDownsampleStep->value();
|
||||
@@ -6338,11 +6537,14 @@ Camera * PreferencesDialog::createCamera(
|
||||
device.isEmpty()&&driver == kSrcStereoRealSense2?"T265":device.toStdString(),
|
||||
this->getGeneralInputRate(),
|
||||
this->getSourceLocalTransform());
|
||||
((CameraRealSense2*)camera)->publishInterIMU(_ui->checkbox_publishInterIMU->isChecked());
|
||||
camera->setInterIMUPublishing(
|
||||
_ui->checkbox_publishInterIMU->isChecked(),
|
||||
_ui->checkbox_publishInterIMU->isChecked() && getIMUFilteringStrategy()>0?
|
||||
IMUFilter::create((IMUFilter::Type)(getIMUFilteringStrategy()-1), this->getAllParameters()):0);
|
||||
if(driver == kSrcStereoRealSense2)
|
||||
{
|
||||
((CameraRealSense2*)camera)->setImagesRectified((_ui->checkBox_stereo_rectify->isEnabled() && _ui->checkBox_stereo_rectify->isChecked()) && !useRawImages);
|
||||
((CameraRealSense2*)camera)->setOdomProvided(_ui->comboBox_odom_sensor->currentIndex() == 1 || odomOnly, odomOnly, odomSensorExtrinsicsCalib);
|
||||
((CameraRealSense2*)camera)->setOdomProvided(getOdomSourceDriver() == kSrcStereoRealSense2 || odomOnly, odomOnly, odomSensorExtrinsicsCalib);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6351,7 +6553,7 @@ Camera * PreferencesDialog::createCamera(
|
||||
((CameraRealSense2*)camera)->setResolution(_ui->spinBox_rs2_width->value(), _ui->spinBox_rs2_height->value(), _ui->spinBox_rs2_rate->value());
|
||||
((CameraRealSense2*)camera)->setDepthResolution(_ui->spinBox_rs2_width_depth->value(), _ui->spinBox_rs2_height_depth->value(), _ui->spinBox_rs2_rate_depth->value());
|
||||
((CameraRealSense2*)camera)->setGlobalTimeSync(_ui->checkbox_rs2_globalTimeStync->isChecked());
|
||||
((CameraRealSense2*)camera)->setDualMode(_ui->comboBox_odom_sensor->currentIndex()==1, Transform::fromString(_ui->lineEdit_odom_sensor_extrinsics->text().toStdString()));
|
||||
((CameraRealSense2*)camera)->setDualMode(getOdomSourceDriver() == kSrcStereoRealSense2, Transform::fromString(_ui->lineEdit_odom_sensor_extrinsics->text().toStdString()));
|
||||
((CameraRealSense2*)camera)->setJsonConfig(_ui->lineEdit_rs2_jsonFile->text().toStdString());
|
||||
}
|
||||
}
|
||||
@@ -6524,7 +6726,7 @@ Camera * PreferencesDialog::createCamera(
|
||||
_ui->comboBox_stereoZed_quality->currentIndex(),
|
||||
_ui->comboBox_stereoZed_sensingMode->currentIndex(),
|
||||
_ui->spinBox_stereoZed_confidenceThr->value(),
|
||||
_ui->comboBox_odom_sensor->currentIndex() == 2,
|
||||
getOdomSourceDriver() == kSrcStereoZed,
|
||||
this->getGeneralInputRate(),
|
||||
this->getSourceLocalTransform(),
|
||||
_ui->checkbox_stereoZed_selfCalibration->isChecked(),
|
||||
@@ -6540,14 +6742,17 @@ Camera * PreferencesDialog::createCamera(
|
||||
_ui->comboBox_stereoZed_quality->currentIndex()==0&&odomOnly?1:_ui->comboBox_stereoZed_quality->currentIndex(),
|
||||
_ui->comboBox_stereoZed_sensingMode->currentIndex(),
|
||||
_ui->spinBox_stereoZed_confidenceThr->value(),
|
||||
_ui->comboBox_odom_sensor->currentIndex() == 2 || odomOnly,
|
||||
getOdomSourceDriver() == kSrcStereoZed || odomOnly,
|
||||
this->getGeneralInputRate(),
|
||||
this->getSourceLocalTransform(),
|
||||
_ui->checkbox_stereoZed_selfCalibration->isChecked(),
|
||||
_ui->loopClosure_bowForce2D->isChecked(),
|
||||
_ui->spinBox_stereoZed_texturenessConfidenceThr->value());
|
||||
}
|
||||
((CameraStereoZed*)camera)->publishInterIMU(_ui->checkbox_publishInterIMU->isChecked());
|
||||
camera->setInterIMUPublishing(
|
||||
_ui->checkbox_publishInterIMU->isChecked(),
|
||||
_ui->checkbox_publishInterIMU->isChecked() && getIMUFilteringStrategy()>0?
|
||||
IMUFilter::create((IMUFilter::Type)(getIMUFilteringStrategy()-1), this->getAllParameters()):0);
|
||||
}
|
||||
else if (driver == kSrcStereoZedOC)
|
||||
{
|
||||
@@ -6713,7 +6918,7 @@ Camera * PreferencesDialog::createCamera(
|
||||
return camera;
|
||||
}
|
||||
|
||||
Camera * PreferencesDialog::createOdomSensor(Transform & extrinsics, double & timeOffset, float & scaleFactor)
|
||||
SensorCapture * PreferencesDialog::createOdomSensor(Transform & extrinsics, double & timeOffset, float & scaleFactor, double & waitTime)
|
||||
{
|
||||
Src driver = getOdomSourceDriver();
|
||||
if(driver != kSrcUndef)
|
||||
@@ -6732,12 +6937,67 @@ Camera * PreferencesDialog::createOdomSensor(Transform & extrinsics, double & ti
|
||||
extrinsics = Transform::fromString(_ui->lineEdit_odom_sensor_extrinsics->text().replace("PI_2", QString::number(3.141592/2.0)).toStdString());
|
||||
timeOffset = _ui->doubleSpinBox_odom_sensor_time_offset->value()/1000.0;
|
||||
scaleFactor = (float)_ui->doubleSpinBox_odom_sensor_scale_factor->value();
|
||||
waitTime = _ui->doubleSpinBox_odom_sensor_wait_time->value()/1000.0;
|
||||
|
||||
return createCamera(driver, _ui->lineEdit_odomSourceDevice->text(), _ui->lineEdit_odom_sensor_path_calibration->text(), false, true, true, false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Lidar * PreferencesDialog::createLidar()
|
||||
{
|
||||
Lidar * lidar = 0;
|
||||
Src driver = getLidarSourceDriver();
|
||||
if(driver == kSrcLidarVLP16)
|
||||
{
|
||||
Transform localTransform = Transform::fromString(_ui->lineEdit_lidar_local_transform->text().replace("PI_2", QString::number(3.141592/2.0)).toStdString());
|
||||
if(localTransform.isNull())
|
||||
{
|
||||
UWARN("Failed to parse lidar local transfor string \"%s\"!",
|
||||
_ui->lineEdit_lidar_local_transform->text().toStdString().c_str());
|
||||
localTransform = Transform::getIdentity();
|
||||
}
|
||||
if(!_ui->lineEdit_vlp16_pcap_path->text().isEmpty())
|
||||
{
|
||||
// PCAP mode
|
||||
lidar = new LidarVLP16(
|
||||
_ui->lineEdit_vlp16_pcap_path->text().toStdString(),
|
||||
_ui->checkBox_vlp16_organized->isChecked(),
|
||||
_ui->checkBox_vlp16_stamp_last->isChecked(),
|
||||
this->getGeneralInputRate(),
|
||||
localTransform);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Connect to sensor
|
||||
|
||||
lidar = new LidarVLP16(
|
||||
boost::asio::ip::address_v4::from_string(uFormat("%ld.%ld.%ld.%ld",
|
||||
(size_t)_ui->spinBox_vlp16_ip1->value(),
|
||||
(size_t)_ui->spinBox_vlp16_ip2->value(),
|
||||
(size_t)_ui->spinBox_vlp16_ip3->value(),
|
||||
(size_t)_ui->spinBox_vlp16_ip4->value())),
|
||||
_ui->spinBox_vlp16_port->value(),
|
||||
_ui->checkBox_vlp16_organized->isChecked(),
|
||||
_ui->checkBox_vlp16_hostTime->isChecked(),
|
||||
_ui->checkBox_vlp16_stamp_last->isChecked(),
|
||||
this->getGeneralInputRate(),
|
||||
localTransform);
|
||||
|
||||
}
|
||||
if(!lidar->init())
|
||||
{
|
||||
UWARN("init lidar failed... ");
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("Lidar initialization failed..."));
|
||||
delete lidar;
|
||||
lidar = 0;
|
||||
}
|
||||
}
|
||||
return lidar;
|
||||
}
|
||||
|
||||
bool PreferencesDialog::isStatisticsPublished() const
|
||||
{
|
||||
return _ui->groupBox_publishing->isChecked();
|
||||
@@ -6935,7 +7195,7 @@ void PreferencesDialog::testOdometry()
|
||||
odomViewer->resize(1280, 480+QPushButton().minimumHeight());
|
||||
odomViewer->registerToEventsManager();
|
||||
|
||||
CameraThread cameraThread(camera, this->getAllParameters()); // take ownership of camera
|
||||
SensorCaptureThread cameraThread(camera, this->getAllParameters()); // take ownership of camera
|
||||
cameraThread.setMirroringEnabled(isSourceMirroring());
|
||||
cameraThread.setColorOnly(_ui->checkbox_rgbd_colorOnly->isChecked());
|
||||
cameraThread.setImageDecimation(_ui->spinBox_source_imageDecimation->value());
|
||||
@@ -6954,7 +7214,8 @@ void PreferencesDialog::testOdometry()
|
||||
_ui->doubleSpinBox_source_scanVoxelSize->value(),
|
||||
_ui->spinBox_source_scanNormalsK->value(),
|
||||
_ui->doubleSpinBox_source_scanNormalsRadius->value(),
|
||||
(float)_ui->doubleSpinBox_source_scanNormalsForceGroundUp->value());
|
||||
(float)_ui->doubleSpinBox_source_scanNormalsForceGroundUp->value(),
|
||||
_ui->checkBox_source_scanDeskewing->isChecked());
|
||||
if(_ui->comboBox_imuFilter_strategy->currentIndex()>0 && dynamic_cast<DBReader*>(camera) == 0)
|
||||
{
|
||||
cameraThread.enableIMUFiltering(_ui->comboBox_imuFilter_strategy->currentIndex()-1, this->getAllParameters(), _ui->checkBox_imuFilter_baseFrameConversion->isChecked());
|
||||
@@ -6973,7 +7234,7 @@ void PreferencesDialog::testOdometry()
|
||||
}
|
||||
}
|
||||
|
||||
UEventsManager::createPipe(&cameraThread, &odomThread, "CameraEvent");
|
||||
UEventsManager::createPipe(&cameraThread, &odomThread, "SensorEvent");
|
||||
if(imuThread)
|
||||
{
|
||||
UEventsManager::createPipe(imuThread, &odomThread, "IMUEvent");
|
||||
@@ -7011,7 +7272,7 @@ void PreferencesDialog::testCamera()
|
||||
Camera * camera = this->createCamera();
|
||||
if(camera)
|
||||
{
|
||||
CameraThread cameraThread(camera, this->getAllParameters());
|
||||
SensorCaptureThread cameraThread(camera, this->getAllParameters());
|
||||
cameraThread.setMirroringEnabled(isSourceMirroring());
|
||||
cameraThread.setColorOnly(_ui->checkbox_rgbd_colorOnly->isChecked());
|
||||
cameraThread.setImageDecimation(_ui->spinBox_source_imageDecimation->value());
|
||||
@@ -7030,7 +7291,8 @@ void PreferencesDialog::testCamera()
|
||||
_ui->doubleSpinBox_source_scanVoxelSize->value(),
|
||||
_ui->spinBox_source_scanNormalsK->value(),
|
||||
_ui->doubleSpinBox_source_scanNormalsRadius->value(),
|
||||
(float)_ui->doubleSpinBox_source_scanNormalsForceGroundUp->value());
|
||||
(float)_ui->doubleSpinBox_source_scanNormalsForceGroundUp->value(),
|
||||
_ui->checkBox_source_scanDeskewing->isChecked());
|
||||
if(_ui->comboBox_imuFilter_strategy->currentIndex()>0 && dynamic_cast<DBReader*>(camera) == 0)
|
||||
{
|
||||
cameraThread.enableIMUFiltering(_ui->comboBox_imuFilter_strategy->currentIndex()-1, this->getAllParameters(), _ui->checkBox_imuFilter_baseFrameConversion->isChecked());
|
||||
@@ -7048,7 +7310,7 @@ void PreferencesDialog::testCamera()
|
||||
cameraThread.setDistortionModel(_ui->lineEdit_source_distortionModel->text().toStdString());
|
||||
}
|
||||
}
|
||||
UEventsManager::createPipe(&cameraThread, window, "CameraEvent");
|
||||
UEventsManager::createPipe(&cameraThread, window, "SensorEvent");
|
||||
|
||||
cameraThread.start();
|
||||
window->exec();
|
||||
@@ -7112,8 +7374,8 @@ void PreferencesDialog::calibrate()
|
||||
_calibrationDialog->setStereoMode(false); // this forces restart
|
||||
_calibrationDialog->setCameraName(QString(camera->getSerial().c_str())+"_rgb");
|
||||
_calibrationDialog->registerToEventsManager();
|
||||
CameraThread cameraThread(camera, this->getAllParameters());
|
||||
UEventsManager::createPipe(&cameraThread, _calibrationDialog, "CameraEvent");
|
||||
SensorCaptureThread cameraThread(camera, this->getAllParameters());
|
||||
UEventsManager::createPipe(&cameraThread, _calibrationDialog, "SensorEvent");
|
||||
cameraThread.start();
|
||||
_calibrationDialog->exec();
|
||||
_calibrationDialog->unregisterFromEventsManager();
|
||||
@@ -7140,8 +7402,8 @@ void PreferencesDialog::calibrate()
|
||||
_calibrationDialog->setStereoMode(false); // this forces restart
|
||||
_calibrationDialog->setCameraName(QString(camera->getSerial().c_str())+"_depth");
|
||||
_calibrationDialog->registerToEventsManager();
|
||||
CameraThread cameraThread(camera, this->getAllParameters());
|
||||
UEventsManager::createPipe(&cameraThread, _calibrationDialog, "CameraEvent");
|
||||
SensorCaptureThread cameraThread(camera, this->getAllParameters());
|
||||
UEventsManager::createPipe(&cameraThread, _calibrationDialog, "SensorEvent");
|
||||
cameraThread.start();
|
||||
_calibrationDialog->exec();
|
||||
_calibrationDialog->unregisterFromEventsManager();
|
||||
@@ -7184,7 +7446,7 @@ void PreferencesDialog::calibrate()
|
||||
{
|
||||
return;
|
||||
}
|
||||
SensorData rgbData = camera->takeImage();
|
||||
SensorData rgbData = camera->takeData();
|
||||
UASSERT(rgbData.cameraModels().size() == 1);
|
||||
rgbModel = rgbData.cameraModels()[0];
|
||||
delete camera;
|
||||
@@ -7193,7 +7455,7 @@ void PreferencesDialog::calibrate()
|
||||
{
|
||||
return;
|
||||
}
|
||||
SensorData irData = camera->takeImage();
|
||||
SensorData irData = camera->takeData();
|
||||
serial = camera->getSerial();
|
||||
UASSERT(irData.cameraModels().size() == 1);
|
||||
irModel = irData.cameraModels()[0];
|
||||
@@ -7269,8 +7531,8 @@ void PreferencesDialog::calibrate()
|
||||
_calibrationDialog->setSavingDirectory(this->getCameraInfoDir());
|
||||
_calibrationDialog->registerToEventsManager();
|
||||
|
||||
CameraThread cameraThread(camera, this->getAllParameters());
|
||||
UEventsManager::createPipe(&cameraThread, _calibrationDialog, "CameraEvent");
|
||||
SensorCaptureThread cameraThread(camera, this->getAllParameters());
|
||||
UEventsManager::createPipe(&cameraThread, _calibrationDialog, "SensorEvent");
|
||||
|
||||
cameraThread.start();
|
||||
|
||||
@@ -7313,27 +7575,14 @@ void PreferencesDialog::calibrateOdomSensorExtrinsics()
|
||||
}
|
||||
}
|
||||
|
||||
Src odomDriver;
|
||||
if(_ui->comboBox_odom_sensor->currentIndex() == 0)
|
||||
Src odomDriver = getOdomSourceDriver();
|
||||
if(odomDriver == kSrcUndef)
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("Calibration"),
|
||||
tr("No odometry sensor selected!"));
|
||||
return;
|
||||
}
|
||||
else if(_ui->comboBox_odom_sensor->currentIndex() == 1)
|
||||
{
|
||||
odomDriver = kSrcStereoRealSense2;
|
||||
}
|
||||
else if(_ui->comboBox_odom_sensor->currentIndex() == 2)
|
||||
{
|
||||
odomDriver = kSrcStereoZed;
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("Odom sensor %d not implemented", _ui->comboBox_odom_sensor->currentIndex());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 3 steps calibration: RGB -> IR -> Extrinsic
|
||||
@@ -7429,7 +7678,7 @@ void PreferencesDialog::calibrateOdomSensorExtrinsics()
|
||||
delete camera;
|
||||
return;
|
||||
}
|
||||
SensorData odomSensorData = camera->takeImage();
|
||||
SensorData odomSensorData = camera->takeData();
|
||||
if(odomSensorData.cameraModels().size() == 1) {
|
||||
odomSensorModel = odomSensorData.cameraModels()[0];
|
||||
}
|
||||
@@ -7453,7 +7702,7 @@ void PreferencesDialog::calibrateOdomSensorExtrinsics()
|
||||
delete camera;
|
||||
return;
|
||||
}
|
||||
SensorData camData = camera->takeImage();
|
||||
SensorData camData = camera->takeData();
|
||||
serial = camera->getSerial();
|
||||
if(camData.cameraModels().size() == 1) {
|
||||
cameraModel = camData.cameraModels()[0];
|
||||
@@ -7530,5 +7779,42 @@ void PreferencesDialog::calibrateOdomSensorExtrinsics()
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::testLidar()
|
||||
{
|
||||
CameraViewer * window = new CameraViewer(this, this->getAllParameters());
|
||||
window->setWindowTitle(tr("Lidar viewer"));
|
||||
window->setWindowFlags(Qt::Window);
|
||||
window->resize(1280, 480+QPushButton().minimumHeight());
|
||||
window->registerToEventsManager();
|
||||
window->setDecimation(1);
|
||||
|
||||
Lidar * lidar = this->createLidar();
|
||||
if(lidar)
|
||||
{
|
||||
SensorCaptureThread lidarThread(lidar, this->getAllParameters());
|
||||
lidarThread.setScanParameters(
|
||||
_ui->checkBox_source_scanFromDepth->isChecked(),
|
||||
_ui->spinBox_source_scanDownsampleStep->value(),
|
||||
_ui->doubleSpinBox_source_scanRangeMin->value(),
|
||||
_ui->doubleSpinBox_source_scanRangeMax->value(),
|
||||
_ui->doubleSpinBox_source_scanVoxelSize->value(),
|
||||
_ui->spinBox_source_scanNormalsK->value(),
|
||||
_ui->doubleSpinBox_source_scanNormalsRadius->value(),
|
||||
(float)_ui->doubleSpinBox_source_scanNormalsForceGroundUp->value(),
|
||||
_ui->checkBox_source_scanDeskewing->isChecked());
|
||||
|
||||
UEventsManager::createPipe(&lidarThread, window, "SensorEvent");
|
||||
|
||||
lidarThread.start();
|
||||
window->exec();
|
||||
delete window;
|
||||
lidarThread.join(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete window;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -341,8 +341,15 @@
|
||||
<addaction name="menuOAK_D_Lite"/>
|
||||
<addaction name="menuOAK_D_Pro"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuLiDAR">
|
||||
<property name="title">
|
||||
<string>LiDAR</string>
|
||||
</property>
|
||||
<addaction name="actionVelodyne_VLP_16"/>
|
||||
</widget>
|
||||
<addaction name="menuRGB_D_camera"/>
|
||||
<addaction name="menuStereo_camera"/>
|
||||
<addaction name="menuLiDAR"/>
|
||||
<addaction name="actionMore_options"/>
|
||||
</widget>
|
||||
<addaction name="menuSelect_source"/>
|
||||
@@ -1718,6 +1725,14 @@
|
||||
<string>Depth AI</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionVelodyne_VLP_16">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Velodyne VLP-16</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user