mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Added Freenect camera source
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1310 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -37,6 +37,7 @@ namespace rtabmap {
|
||||
class CameraThread;
|
||||
class DBReader;
|
||||
class CameraOpenni;
|
||||
class CameraFreenect;
|
||||
class OdometryThread;
|
||||
class CloudViewer;
|
||||
}
|
||||
@@ -113,6 +114,7 @@ private slots:
|
||||
void selectStream();
|
||||
void selectDatabase();
|
||||
void selectOpenni();
|
||||
void selectFreenect();
|
||||
void dumpTheMemory();
|
||||
void dumpThePrediction();
|
||||
void downloadAllClouds();
|
||||
@@ -175,7 +177,7 @@ private:
|
||||
void setupMainLayout(bool vertical);
|
||||
void updateSelectSourceImageMenu(int type);
|
||||
void updateSelectSourceDatabase(bool used);
|
||||
void updateSelectSourceOpenni(bool used);
|
||||
void updateSelectSourceOpenniMenu(bool used, bool openni);
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr createAssembledCloud();
|
||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr createCloud(
|
||||
@@ -201,6 +203,7 @@ private:
|
||||
rtabmap::CameraThread * _camera;
|
||||
rtabmap::DBReader * _dbReader;
|
||||
rtabmap::CameraOpenni * _cameraOpenni;
|
||||
rtabmap::CameraFreenect * _cameraOpenKinect;
|
||||
rtabmap::OdometryThread * _odomThread;
|
||||
|
||||
SrcType _srcType;
|
||||
|
||||
@@ -50,6 +50,7 @@ class QDoubleSpinBox;
|
||||
namespace rtabmap {
|
||||
|
||||
class CameraOpenni;
|
||||
class CameraFreenect;
|
||||
class OdometryThread;
|
||||
class Signature;
|
||||
class LoopClosureViewer;
|
||||
@@ -155,6 +156,7 @@ public:
|
||||
QString getSourceDatabasePath() const; //Database group
|
||||
bool getSourceDatabaseOdometryIgnored() const; //Database group
|
||||
int getSourceDatabaseStartPos() const; //Database group
|
||||
bool getSourceFreenect() const; // Openni group
|
||||
QString getSourceOpenniDevice() const; //Openni group
|
||||
Transform getSourceOpenniLocalTransform() const; //Openni group
|
||||
|
||||
@@ -188,7 +190,7 @@ public slots:
|
||||
void setSLAMMode(bool enabled);
|
||||
void selectSourceImage(Src src = kSrcUndef);
|
||||
void selectSourceDatabase(bool user = false);
|
||||
void selectSourceOpenni(bool user = false);
|
||||
void selectSourceOpenni(bool openni);
|
||||
|
||||
private slots:
|
||||
void closeDialog ( QAbstractButton * button );
|
||||
@@ -266,7 +268,8 @@ private:
|
||||
QProgressDialog * _progressDialog;
|
||||
|
||||
//Odometry test
|
||||
CameraOpenni * _odomCamera;
|
||||
CameraOpenni * _odomCameraOpenNI;
|
||||
CameraFreenect * _odomCameraFreenect;
|
||||
OdometryThread * _odomThread;
|
||||
|
||||
QVector<QCheckBox*> _3dRenderingShowClouds;
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
|
||||
//RGB-D stuff
|
||||
#include "rtabmap/core/CameraOpenni.h"
|
||||
#include "rtabmap/core/CameraFreenect.h"
|
||||
#include "rtabmap/core/Odometry.h"
|
||||
#include "rtabmap/core/OdometryEvent.h"
|
||||
#include "rtabmap/core/util3d.h"
|
||||
@@ -97,6 +98,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
||||
_camera(0),
|
||||
_dbReader(0),
|
||||
_cameraOpenni(0),
|
||||
_cameraOpenKinect(0),
|
||||
_odomThread(0),
|
||||
_srcType(kSrcUndefined),
|
||||
_preferencesDialog(0),
|
||||
@@ -280,15 +282,17 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
||||
selectSourceImageGrp->addAction(_ui->actionUsbCamera);
|
||||
selectSourceImageGrp->addAction(_ui->actionImageFiles);
|
||||
selectSourceImageGrp->addAction(_ui->actionVideo);
|
||||
selectSourceImageGrp->addAction(_ui->actionOpenni_RGBD);
|
||||
selectSourceImageGrp->addAction(_ui->actionOpenNI);
|
||||
selectSourceImageGrp->addAction(_ui->actionFreenect);
|
||||
this->updateSelectSourceImageMenu(_preferencesDialog->getSourceImageType());
|
||||
connect(_ui->actionImageFiles, SIGNAL(triggered()), this, SLOT(selectImages()));
|
||||
connect(_ui->actionVideo, SIGNAL(triggered()), this, SLOT(selectVideo()));
|
||||
connect(_ui->actionUsbCamera, SIGNAL(triggered()), this, SLOT(selectStream()));
|
||||
this->updateSelectSourceDatabase(_preferencesDialog->isSourceDatabaseUsed());
|
||||
connect(_ui->actionDatabase, SIGNAL(triggered()), this, SLOT(selectDatabase()));
|
||||
this->updateSelectSourceOpenni(_preferencesDialog->isSourceOpenniUsed());
|
||||
connect(_ui->actionOpenni_RGBD, SIGNAL(triggered()), this, SLOT(selectOpenni()));
|
||||
this->updateSelectSourceOpenniMenu(_preferencesDialog->isSourceOpenniUsed(), !_preferencesDialog->getSourceFreenect());
|
||||
connect(_ui->actionOpenNI, SIGNAL(triggered()), this, SLOT(selectOpenni()));
|
||||
connect(_ui->actionFreenect, SIGNAL(triggered()), this, SLOT(selectFreenect()));
|
||||
|
||||
connect(_ui->actionSave_state, SIGNAL(triggered()), this, SLOT(saveFigures()));
|
||||
connect(_ui->actionLoad_state, SIGNAL(triggered()), this, SLOT(loadFigures()));
|
||||
@@ -418,6 +422,12 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
delete _cameraOpenni;
|
||||
_cameraOpenni = 0;
|
||||
}
|
||||
if(_cameraOpenKinect)
|
||||
{
|
||||
UERROR("CameraOpenKinect must be already deleted here!");
|
||||
delete _cameraOpenKinect;
|
||||
_cameraOpenKinect = 0;
|
||||
}
|
||||
if(_odomThread)
|
||||
{
|
||||
UERROR("OdomThread must be already deleted here!");
|
||||
@@ -1475,7 +1485,7 @@ void MainWindow::applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags)
|
||||
_ui->doubleSpinBox_stats_imgRate->setValue(_preferencesDialog->getGeneralInputRate());
|
||||
this->updateSelectSourceImageMenu(_preferencesDialog->getSourceImageType());
|
||||
this->updateSelectSourceDatabase(_preferencesDialog->isSourceDatabaseUsed());
|
||||
this->updateSelectSourceOpenni(_preferencesDialog->isSourceOpenniUsed());
|
||||
this->updateSelectSourceOpenniMenu(_preferencesDialog->isSourceOpenniUsed(), !_preferencesDialog->getSourceFreenect());
|
||||
QString src;
|
||||
if(_preferencesDialog->isSourceImageUsed())
|
||||
{
|
||||
@@ -1501,6 +1511,11 @@ void MainWindow::applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags)
|
||||
{
|
||||
_cameraOpenni->setFrameRate(_preferencesDialog->getGeneralInputRate());
|
||||
}
|
||||
|
||||
if(_cameraOpenKinect)
|
||||
{
|
||||
_cameraOpenKinect->setFrameRate(_preferencesDialog->getGeneralInputRate());
|
||||
}
|
||||
}
|
||||
|
||||
if(flags & PreferencesDialog::kPanelGeneral)
|
||||
@@ -1786,9 +1801,10 @@ void MainWindow::updateSelectSourceDatabase(bool used)
|
||||
_ui->actionDatabase->setChecked(used);
|
||||
}
|
||||
|
||||
void MainWindow::updateSelectSourceOpenni(bool used)
|
||||
void MainWindow::updateSelectSourceOpenniMenu(bool used, bool openni)
|
||||
{
|
||||
_ui->actionOpenni_RGBD->setChecked(used);
|
||||
_ui->actionOpenNI->setChecked(used && openni);
|
||||
_ui->actionFreenect->setChecked(used && !openni);
|
||||
}
|
||||
|
||||
void MainWindow::changeImgRateSetting()
|
||||
@@ -1923,6 +1939,15 @@ void MainWindow::startDetection()
|
||||
emit stateChanged(kIdle);
|
||||
return;
|
||||
}
|
||||
if(_cameraOpenKinect != 0)
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("A Freenect camera is running, stop it first."));
|
||||
UWARN("_cameraOpenKinect is not null... it must be stopped first");
|
||||
emit stateChanged(kIdle);
|
||||
return;
|
||||
}
|
||||
|
||||
// Adjust pre-requirements
|
||||
if( !_preferencesDialog->isSourceImageUsed() &&
|
||||
@@ -1969,31 +1994,61 @@ void MainWindow::startDetection()
|
||||
_odomThread->start();
|
||||
}
|
||||
|
||||
// With odomtry, go as fast as we can
|
||||
_cameraOpenni = new CameraOpenni(
|
||||
_preferencesDialog->getSourceOpenniDevice().toStdString(),
|
||||
_preferencesDialog->getGeneralInputRate(),
|
||||
_preferencesDialog->getSourceOpenniLocalTransform());
|
||||
|
||||
if(!_cameraOpenni->init())
|
||||
if(_preferencesDialog->getSourceFreenect())
|
||||
{
|
||||
ULOGGER_WARN("init CameraOpenni failed... ");
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("Openni camera initialization failed..."));
|
||||
emit stateChanged(kIdle);
|
||||
delete _cameraOpenni;
|
||||
_cameraOpenni = 0;
|
||||
_cameraOpenKinect = new CameraFreenect(
|
||||
_preferencesDialog->getSourceOpenniDevice().isEmpty()?0:atoi(_preferencesDialog->getSourceOpenniDevice().toStdString().c_str()),
|
||||
_preferencesDialog->getGeneralInputRate(),
|
||||
_preferencesDialog->getSourceOpenniLocalTransform());
|
||||
|
||||
if(!_cameraOpenKinect->init())
|
||||
{
|
||||
ULOGGER_WARN("init CameraOpenKinect failed... ");
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("OpenKinect camera initialization failed..."));
|
||||
emit stateChanged(kIdle);
|
||||
delete _cameraOpenKinect;
|
||||
_cameraOpenKinect = 0;
|
||||
if(_odomThread)
|
||||
{
|
||||
delete _odomThread;
|
||||
_odomThread = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(_odomThread)
|
||||
{
|
||||
delete _odomThread;
|
||||
_odomThread = 0;
|
||||
UEventsManager::createPipe(_cameraOpenKinect, _odomThread, "CameraEvent");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(_odomThread)
|
||||
else
|
||||
{
|
||||
UEventsManager::createPipe(_cameraOpenni, _odomThread, "CameraEvent");
|
||||
_cameraOpenni = new CameraOpenni(
|
||||
_preferencesDialog->getSourceOpenniDevice().toStdString(),
|
||||
_preferencesDialog->getGeneralInputRate(),
|
||||
_preferencesDialog->getSourceOpenniLocalTransform());
|
||||
|
||||
if(!_cameraOpenni->init())
|
||||
{
|
||||
ULOGGER_WARN("init CameraOpenni failed... ");
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("Openni camera initialization failed..."));
|
||||
emit stateChanged(kIdle);
|
||||
delete _cameraOpenni;
|
||||
_cameraOpenni = 0;
|
||||
if(_odomThread)
|
||||
{
|
||||
delete _odomThread;
|
||||
_odomThread = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(_odomThread)
|
||||
{
|
||||
UEventsManager::createPipe(_cameraOpenni, _odomThread, "CameraEvent");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(_preferencesDialog->isSourceDatabaseUsed())
|
||||
@@ -2149,7 +2204,7 @@ void MainWindow::startDetection()
|
||||
// Could not be in the main thread here! (see handleEvents())
|
||||
void MainWindow::pauseDetection()
|
||||
{
|
||||
if(_camera || _dbReader || _cameraOpenni)
|
||||
if(_camera || _dbReader || _cameraOpenni || _cameraOpenKinect)
|
||||
{
|
||||
if(_state == kPaused && (QApplication::keyboardModifiers() & Qt::ShiftModifier))
|
||||
{
|
||||
@@ -2183,7 +2238,7 @@ void MainWindow::pauseDetection()
|
||||
|
||||
void MainWindow::stopDetection()
|
||||
{
|
||||
if(_state == kIdle || (!_camera && !_dbReader && !_cameraOpenni))
|
||||
if(_state == kIdle || (!_camera && !_dbReader && !_cameraOpenni && !_cameraOpenKinect))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2191,7 +2246,8 @@ void MainWindow::stopDetection()
|
||||
if(_state == kDetecting &&
|
||||
( (_camera && _camera->isRunning()) ||
|
||||
(_dbReader && _dbReader->isRunning()) ||
|
||||
(_cameraOpenni && _cameraOpenni->isRunning())) )
|
||||
(_cameraOpenni && _cameraOpenni->isRunning()) ||
|
||||
(_cameraOpenKinect && _cameraOpenKinect->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);
|
||||
|
||||
@@ -2218,6 +2274,11 @@ void MainWindow::stopDetection()
|
||||
_cameraOpenni->kill();
|
||||
}
|
||||
|
||||
if(_cameraOpenKinect)
|
||||
{
|
||||
_cameraOpenKinect->join(true);
|
||||
}
|
||||
|
||||
if(_odomThread)
|
||||
{
|
||||
_ui->actionReset_Odometry->setEnabled(false);
|
||||
@@ -2240,6 +2301,11 @@ void MainWindow::stopDetection()
|
||||
delete _cameraOpenni;
|
||||
_cameraOpenni = 0;
|
||||
}
|
||||
if(_cameraOpenKinect)
|
||||
{
|
||||
delete _cameraOpenKinect;
|
||||
_cameraOpenKinect = 0;
|
||||
}
|
||||
if(_odomThread)
|
||||
{
|
||||
delete _odomThread;
|
||||
@@ -2479,6 +2545,11 @@ void MainWindow::selectOpenni()
|
||||
_preferencesDialog->selectSourceOpenni(true);
|
||||
}
|
||||
|
||||
void MainWindow::selectFreenect()
|
||||
{
|
||||
_preferencesDialog->selectSourceOpenni(false);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::dumpTheMemory()
|
||||
{
|
||||
@@ -3552,6 +3623,11 @@ void MainWindow::changeState(MainWindow::State newState)
|
||||
{
|
||||
_cameraOpenni->start();
|
||||
}
|
||||
|
||||
if(_cameraOpenKinect)
|
||||
{
|
||||
_cameraOpenKinect->start();
|
||||
}
|
||||
break;
|
||||
|
||||
case kPaused:
|
||||
@@ -3585,6 +3661,11 @@ void MainWindow::changeState(MainWindow::State newState)
|
||||
{
|
||||
_cameraOpenni->start();
|
||||
}
|
||||
|
||||
if(_cameraOpenKinect)
|
||||
{
|
||||
_cameraOpenKinect->start();
|
||||
}
|
||||
}
|
||||
else if(_state == kDetecting)
|
||||
{
|
||||
@@ -3616,6 +3697,11 @@ void MainWindow::changeState(MainWindow::State newState)
|
||||
{
|
||||
_cameraOpenni->pause();
|
||||
}
|
||||
|
||||
if(_cameraOpenKinect)
|
||||
{
|
||||
_cameraOpenKinect->join(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case kMonitoring:
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "rtabmap/core/Parameters.h"
|
||||
#include "rtabmap/core/Odometry.h"
|
||||
#include "rtabmap/core/CameraOpenni.h"
|
||||
#include "rtabmap/core/CameraFreenect.h"
|
||||
#include "rtabmap/core/Memory.h"
|
||||
|
||||
#include "rtabmap/gui/LoopClosureViewer.h"
|
||||
@@ -61,7 +62,8 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
_ui(0),
|
||||
_indexModel(0),
|
||||
_initialized(false),
|
||||
_odomCamera(0),
|
||||
_odomCameraOpenNI(0),
|
||||
_odomCameraFreenect(0),
|
||||
_odomThread(0)
|
||||
{
|
||||
ULOGGER_DEBUG("");
|
||||
@@ -208,6 +210,8 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
connect(_ui->source_spinBox_databaseStartPos, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
//openni group
|
||||
connect(_ui->groupBox_sourceOpenni, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->radioButton_openni, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->radioButton_freenect, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->lineEdit_openniDevice, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->lineEdit_openniLocalTransform, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
|
||||
@@ -735,7 +739,9 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
||||
_ui->source_spinBox_databaseStartPos->setValue(0);
|
||||
|
||||
_ui->groupBox_sourceOpenni->setChecked(true);
|
||||
_ui->lineEdit_openniDevice->setText("#1");
|
||||
_ui->radioButton_openni->setChecked(true);
|
||||
_ui->radioButton_freenect->setChecked(false);
|
||||
_ui->lineEdit_openniDevice->setText("");
|
||||
_ui->lineEdit_openniLocalTransform->setText("0 0 0 -PI_2 0 -PI_2");
|
||||
}
|
||||
else if(groupBox->objectName() == _ui->groupBox_rtabmap_basic0->objectName())
|
||||
@@ -969,6 +975,8 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
|
||||
|
||||
settings.beginGroup("Openni");
|
||||
_ui->groupBox_sourceOpenni->setChecked(settings.value("openniUsed", _ui->groupBox_sourceOpenni->isChecked()).toBool());
|
||||
_ui->radioButton_openni->setChecked(settings.value("openniType", _ui->radioButton_openni->isChecked()).toBool());
|
||||
_ui->radioButton_freenect->setChecked(settings.value("freenectType", _ui->radioButton_freenect->isChecked()).toBool());
|
||||
_ui->lineEdit_openniDevice->setText(settings.value("device",_ui->lineEdit_openniDevice->text()).toString());
|
||||
_ui->lineEdit_openniLocalTransform->setText(settings.value("localTransform",_ui->lineEdit_openniLocalTransform->text()).toString());
|
||||
settings.endGroup(); // Openni
|
||||
@@ -1171,6 +1179,8 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath)
|
||||
|
||||
settings.beginGroup("Openni");
|
||||
settings.setValue("openniUsed", _ui->groupBox_sourceOpenni->isChecked());
|
||||
settings.setValue("openniType", _ui->radioButton_openni->isChecked());
|
||||
settings.setValue("freenectType", _ui->radioButton_freenect->isChecked());
|
||||
settings.setValue("device", _ui->lineEdit_openniDevice->text());
|
||||
settings.setValue("localTransform", _ui->lineEdit_openniLocalTransform->text());
|
||||
settings.endGroup();
|
||||
@@ -1533,7 +1543,7 @@ void PreferencesDialog::selectSourceDatabase(bool user)
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::selectSourceOpenni(bool user)
|
||||
void PreferencesDialog::selectSourceOpenni(bool openni)
|
||||
{
|
||||
ULOGGER_DEBUG("");
|
||||
|
||||
@@ -1541,8 +1551,8 @@ void PreferencesDialog::selectSourceOpenni(bool user)
|
||||
{
|
||||
int button = QMessageBox::information(this,
|
||||
tr("Activate RGB-D SLAM?"),
|
||||
tr("You've selected OpenNI camera as source input, "
|
||||
"would you want to activate RGB-D SLAM mode?"),
|
||||
tr("You've selected %1 camera as source input, "
|
||||
"would you want to activate RGB-D SLAM mode?").arg(openni?"OpenNI":"Freenect"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if(button & QMessageBox::Yes)
|
||||
{
|
||||
@@ -1550,13 +1560,11 @@ void PreferencesDialog::selectSourceOpenni(bool user)
|
||||
}
|
||||
}
|
||||
|
||||
if(user)
|
||||
{
|
||||
// from user
|
||||
_ui->groupBox_sourceOpenni->setChecked(true);
|
||||
}
|
||||
_ui->groupBox_sourceOpenni->setChecked(true);
|
||||
_ui->radioButton_openni->setChecked(openni);
|
||||
_ui->radioButton_freenect->setChecked(!openni);
|
||||
|
||||
if(user && _obsoletePanels)
|
||||
if(_obsoletePanels)
|
||||
{
|
||||
_ui->groupBox_sourceImage->setChecked(false);
|
||||
_ui->groupBox_sourceDatabase->setChecked(false);
|
||||
@@ -2442,6 +2450,10 @@ int PreferencesDialog::getSourceDatabaseStartPos() const
|
||||
{
|
||||
return _ui->source_spinBox_databaseStartPos->value();
|
||||
}
|
||||
bool PreferencesDialog::getSourceFreenect() const
|
||||
{
|
||||
return _ui->radioButton_freenect->isChecked();
|
||||
}
|
||||
QString PreferencesDialog::getSourceOpenniDevice() const
|
||||
{
|
||||
return _ui->lineEdit_openniDevice->text();
|
||||
@@ -2630,14 +2642,34 @@ void PreferencesDialog::testOdometry()
|
||||
|
||||
void PreferencesDialog::testOdometry(OdomType type)
|
||||
{
|
||||
UASSERT(_odomCamera == 0 && _odomThread == 0);
|
||||
UASSERT(_odomCameraOpenNI == 0 && _odomCameraFreenect == 0 && _odomThread == 0);
|
||||
|
||||
_odomCamera = new CameraOpenni(
|
||||
this->getSourceOpenniDevice().toStdString(),
|
||||
this->getGeneralInputRate(),
|
||||
this->getSourceOpenniLocalTransform());
|
||||
if(this->getSourceFreenect())
|
||||
{
|
||||
_odomCameraFreenect = new CameraFreenect(
|
||||
this->getSourceOpenniDevice().isEmpty()?0:atoi(this->getSourceOpenniDevice().toStdString().c_str()),
|
||||
this->getGeneralInputRate(),
|
||||
this->getSourceOpenniLocalTransform());
|
||||
if(!_odomCameraFreenect->init())
|
||||
{
|
||||
delete _odomCameraFreenect;
|
||||
_odomCameraFreenect = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_odomCameraOpenNI = new CameraOpenni(
|
||||
this->getSourceOpenniDevice().toStdString(),
|
||||
this->getGeneralInputRate(),
|
||||
this->getSourceOpenniLocalTransform());
|
||||
if(!_odomCameraOpenNI->init())
|
||||
{
|
||||
delete _odomCameraOpenNI;
|
||||
_odomCameraOpenNI = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(_odomCamera->init())
|
||||
if(_odomCameraOpenNI || _odomCameraFreenect)
|
||||
{
|
||||
Odometry * odometry;
|
||||
ParametersMap parameters = this->getAllParameters();
|
||||
@@ -2673,7 +2705,14 @@ void PreferencesDialog::testOdometry(OdomType type)
|
||||
UEventsManager::addHandler(_odomThread);
|
||||
UEventsManager::addHandler(odomViewer);
|
||||
|
||||
UEventsManager::createPipe(_odomCamera, _odomThread, "CameraEvent");
|
||||
if(_odomCameraFreenect)
|
||||
{
|
||||
UEventsManager::createPipe(_odomCameraFreenect, _odomThread, "CameraEvent");
|
||||
}
|
||||
else
|
||||
{
|
||||
UEventsManager::createPipe(_odomCameraOpenNI, _odomThread, "CameraEvent");
|
||||
}
|
||||
UEventsManager::createPipe(_odomThread, odomViewer, "OdometryEvent");
|
||||
|
||||
window->showNormal();
|
||||
@@ -2683,24 +2722,35 @@ void PreferencesDialog::testOdometry(OdomType type)
|
||||
QApplication::processEvents();
|
||||
|
||||
_odomThread->start();
|
||||
_odomCamera->start();
|
||||
if(_odomCameraFreenect)
|
||||
{
|
||||
_odomCameraFreenect->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_odomCameraOpenNI->start();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, "Initialization failed!", tr("Openni camera initialization failed!"));
|
||||
delete _odomCamera;
|
||||
_odomCamera = 0;
|
||||
QMessageBox::warning(this, "Initialization failed!", tr("RGB-D camera initialization failed!"));
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::cleanOdometryTest()
|
||||
{
|
||||
UDEBUG("");
|
||||
if(_odomCamera)
|
||||
if(_odomCameraOpenNI)
|
||||
{
|
||||
_odomCamera->kill();
|
||||
delete _odomCamera;
|
||||
_odomCamera = 0;
|
||||
_odomCameraOpenNI->kill();
|
||||
delete _odomCameraOpenNI;
|
||||
_odomCameraOpenNI = 0;
|
||||
}
|
||||
if(_odomCameraFreenect)
|
||||
{
|
||||
_odomCameraFreenect->join(true);
|
||||
delete _odomCameraFreenect;
|
||||
_odomCameraFreenect = 0;
|
||||
}
|
||||
if(_odomThread)
|
||||
{
|
||||
|
||||
@@ -86,9 +86,16 @@
|
||||
<addaction name="actionImageFiles"/>
|
||||
<addaction name="actionVideo"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRGB_D_camera">
|
||||
<property name="title">
|
||||
<string>RGB-D camera</string>
|
||||
</property>
|
||||
<addaction name="actionOpenNI"/>
|
||||
<addaction name="actionFreenect"/>
|
||||
</widget>
|
||||
<addaction name="menuImage"/>
|
||||
<addaction name="actionDatabase"/>
|
||||
<addaction name="actionOpenni_RGBD"/>
|
||||
<addaction name="menuRGB_D_camera"/>
|
||||
</widget>
|
||||
<addaction name="menuSelect_source"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -890,14 +897,6 @@
|
||||
<string>Print loop closure IDs to console</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenni_RGBD">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Openni (RGBD)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_point_cloud">
|
||||
<property name="text">
|
||||
<string>Save high-res point clouds (*.pcd *.ply *.vtk)...</string>
|
||||
@@ -979,6 +978,22 @@
|
||||
<string>Take a screenshot</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenNI">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OpenNI</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFreenect">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Freenect</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>859</width>
|
||||
<height>390</height>
|
||||
<width>1009</width>
|
||||
<height>612</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -63,9 +63,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>560</width>
|
||||
<height>632</height>
|
||||
<y>-271</y>
|
||||
<width>711</width>
|
||||
<height>795</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
@@ -86,7 +86,7 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>9</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_22">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||
@@ -1521,7 +1521,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_sourceOpenni">
|
||||
<property name="title">
|
||||
<string>OpenNI camera (RGB-D)</string>
|
||||
<string>RGB-D camera</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@@ -1533,13 +1533,44 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
||||
<item>
|
||||
<widget class="QLabel" name="label_40">
|
||||
<property name="text">
|
||||
<string>Grabber for OpenNI devices (i.e., Primesense PSDK, Microsoft Kinect, Asus XTion Pro/Live).</string>
|
||||
<string>Grabber for RGB-D devices (i.e., Primesense PSDK, Microsoft Kinect, Asus XTion Pro/Live).</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_openni">
|
||||
<property name="text">
|
||||
<string>OpenNI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_freenect">
|
||||
<property name="text">
|
||||
<string>Feeenect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
@@ -1548,7 +1579,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="lineEdit_openniDevice">
|
||||
<property name="text">
|
||||
<string>#1</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user