mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
Added CameraRGBD with openni from OpenCV, removed feature2D stuff from Camera
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1358 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -115,6 +115,8 @@ private slots:
|
||||
void selectDatabase();
|
||||
void selectOpenni();
|
||||
void selectFreenect();
|
||||
void selectOpenniCv();
|
||||
void selectOpenniCvAsus();
|
||||
void dumpTheMemory();
|
||||
void dumpThePrediction();
|
||||
void downloadAllClouds();
|
||||
@@ -177,7 +179,7 @@ private:
|
||||
void setupMainLayout(bool vertical);
|
||||
void updateSelectSourceImageMenu(int type);
|
||||
void updateSelectSourceDatabase(bool used);
|
||||
void updateSelectSourceOpenniMenu(bool used, bool openni);
|
||||
void updateSelectSourceRGBDMenu(bool used, PreferencesDialog::Src src);
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr createAssembledCloud();
|
||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr createCloud(
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace rtabmap {
|
||||
class CameraOpenni;
|
||||
class CameraFreenect;
|
||||
class OdometryThread;
|
||||
class CameraThread;
|
||||
class Signature;
|
||||
class LoopClosureViewer;
|
||||
|
||||
@@ -75,7 +76,11 @@ public:
|
||||
kSrcUndef,
|
||||
kSrcUsbDevice,
|
||||
kSrcImages,
|
||||
kSrcVideo
|
||||
kSrcVideo,
|
||||
kSrcOpenNI_PCL,
|
||||
kSrcFreenect,
|
||||
kSrcOpenNI_CV,
|
||||
kSrcOpenNI_CV_ASUS
|
||||
};
|
||||
|
||||
enum OdomType {
|
||||
@@ -146,7 +151,6 @@ public:
|
||||
bool isSourceOpenniUsed() const;
|
||||
OdomType getOdometryType() const;
|
||||
bool getGeneralAutoRestart() const;
|
||||
bool getGeneralCameraKeypoints() const;
|
||||
int getSourceImageType() const;
|
||||
QString getSourceImageTypeStr() const;
|
||||
int getSourceWidth() const;
|
||||
@@ -162,7 +166,7 @@ public:
|
||||
QString getSourceDatabasePath() const; //Database group
|
||||
bool getSourceDatabaseOdometryIgnored() const; //Database group
|
||||
int getSourceDatabaseStartPos() const; //Database group
|
||||
bool getSourceFreenect() const; // Openni group
|
||||
Src getSourceRGBD() const; // Openni group
|
||||
QString getSourceOpenniDevice() const; //Openni group
|
||||
Transform getSourceOpenniLocalTransform() const; //Openni group
|
||||
|
||||
@@ -196,7 +200,7 @@ public slots:
|
||||
void setSLAMMode(bool enabled);
|
||||
void selectSourceImage(Src src = kSrcUndef);
|
||||
void selectSourceDatabase(bool user = false);
|
||||
void selectSourceOpenni(bool openni);
|
||||
void selectSourceRGBD(Src src = kSrcUndef);
|
||||
|
||||
private slots:
|
||||
void closeDialog ( QAbstractButton * button );
|
||||
@@ -276,6 +280,7 @@ private:
|
||||
//Odometry test
|
||||
CameraOpenni * _odomCameraOpenNI;
|
||||
CameraFreenect * _odomCameraFreenect;
|
||||
CameraThread * _odomCameraOpenNICv;
|
||||
OdometryThread * _odomThread;
|
||||
|
||||
QVector<QCheckBox*> _3dRenderingShowClouds;
|
||||
|
||||
@@ -290,9 +290,11 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
||||
connect(_ui->actionUsbCamera, SIGNAL(triggered()), this, SLOT(selectStream()));
|
||||
this->updateSelectSourceDatabase(_preferencesDialog->isSourceDatabaseUsed());
|
||||
connect(_ui->actionDatabase, SIGNAL(triggered()), this, SLOT(selectDatabase()));
|
||||
this->updateSelectSourceOpenniMenu(_preferencesDialog->isSourceOpenniUsed(), !_preferencesDialog->getSourceFreenect());
|
||||
this->updateSelectSourceRGBDMenu(_preferencesDialog->isSourceOpenniUsed(), _preferencesDialog->getSourceRGBD());
|
||||
connect(_ui->actionOpenNI, SIGNAL(triggered()), this, SLOT(selectOpenni()));
|
||||
connect(_ui->actionFreenect, SIGNAL(triggered()), this, SLOT(selectFreenect()));
|
||||
connect(_ui->actionOpenNI_CV, SIGNAL(triggered()), this, SLOT(selectOpenniCv()));
|
||||
connect(_ui->actionOpenNI_CV_ASUS, SIGNAL(triggered()), this, SLOT(selectOpenniCvAsus()));
|
||||
|
||||
connect(_ui->actionSave_state, SIGNAL(triggered()), this, SLOT(saveFigures()));
|
||||
connect(_ui->actionLoad_state, SIGNAL(triggered()), this, SLOT(loadFigures()));
|
||||
@@ -1514,7 +1516,7 @@ void MainWindow::applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags)
|
||||
_ui->doubleSpinBox_stats_imgRate->setValue(_preferencesDialog->getGeneralInputRate());
|
||||
this->updateSelectSourceImageMenu(_preferencesDialog->getSourceImageType());
|
||||
this->updateSelectSourceDatabase(_preferencesDialog->isSourceDatabaseUsed());
|
||||
this->updateSelectSourceOpenniMenu(_preferencesDialog->isSourceOpenniUsed(), !_preferencesDialog->getSourceFreenect());
|
||||
this->updateSelectSourceRGBDMenu(_preferencesDialog->isSourceOpenniUsed(), _preferencesDialog->getSourceRGBD());
|
||||
QString src;
|
||||
if(_preferencesDialog->isSourceImageUsed())
|
||||
{
|
||||
@@ -1830,10 +1832,12 @@ void MainWindow::updateSelectSourceDatabase(bool used)
|
||||
_ui->actionDatabase->setChecked(used);
|
||||
}
|
||||
|
||||
void MainWindow::updateSelectSourceOpenniMenu(bool used, bool openni)
|
||||
void MainWindow::updateSelectSourceRGBDMenu(bool used, PreferencesDialog::Src src)
|
||||
{
|
||||
_ui->actionOpenNI->setChecked(used && openni);
|
||||
_ui->actionFreenect->setChecked(used && !openni);
|
||||
_ui->actionOpenNI->setChecked(used && src == PreferencesDialog::kSrcOpenNI_PCL);
|
||||
_ui->actionFreenect->setChecked(used && src == PreferencesDialog::kSrcFreenect);
|
||||
_ui->actionOpenNI_CV->setChecked(used && src == PreferencesDialog::kSrcOpenNI_CV);
|
||||
_ui->actionOpenNI_CV_ASUS->setChecked(used && src == PreferencesDialog::kSrcOpenNI_CV_ASUS);
|
||||
}
|
||||
|
||||
void MainWindow::changeImgRateSetting()
|
||||
@@ -2023,7 +2027,7 @@ void MainWindow::startDetection()
|
||||
_odomThread->start();
|
||||
}
|
||||
|
||||
if(_preferencesDialog->getSourceFreenect())
|
||||
if(_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcFreenect)
|
||||
{
|
||||
_cameraOpenKinect = new CameraFreenect(
|
||||
_preferencesDialog->getSourceOpenniDevice().isEmpty()?0:atoi(_preferencesDialog->getSourceOpenniDevice().toStdString().c_str()),
|
||||
@@ -2060,6 +2064,37 @@ void MainWindow::startDetection()
|
||||
UEventsManager::createPipe(_cameraOpenKinect, _odomThread, "CameraEvent");
|
||||
}
|
||||
}
|
||||
else if(_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV ||
|
||||
_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV_ASUS)
|
||||
{
|
||||
Camera * camera = new CameraRGBD(
|
||||
_preferencesDialog->getGeneralInputRate(),
|
||||
_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV_ASUS);
|
||||
camera->setLocalTransform(_preferencesDialog->getSourceOpenniLocalTransform());
|
||||
|
||||
if(!camera->init())
|
||||
{
|
||||
ULOGGER_WARN("init camera failed... ");
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("Camera initialization failed..."));
|
||||
emit stateChanged(kIdle);
|
||||
delete camera;
|
||||
camera = 0;
|
||||
if(_odomThread)
|
||||
{
|
||||
delete _odomThread;
|
||||
_odomThread = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_camera = new CameraThread(camera);
|
||||
if(_odomThread)
|
||||
{
|
||||
UEventsManager::createPipe(_camera, _odomThread, "CameraEvent");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cameraOpenni = new CameraOpenni(
|
||||
@@ -2176,7 +2211,7 @@ void MainWindow::startDetection()
|
||||
_preferencesDialog->getSourceHeight(),
|
||||
_preferencesDialog->getFramesDropped());
|
||||
}
|
||||
else if(sourceType == 0)
|
||||
else //if(sourceType == 0)
|
||||
{
|
||||
camera = new CameraVideo(
|
||||
_preferencesDialog->getSourceUsbDeviceId(),
|
||||
@@ -2185,21 +2220,6 @@ void MainWindow::startDetection()
|
||||
_preferencesDialog->getSourceHeight(),
|
||||
_preferencesDialog->getFramesDropped());
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("Source type is not supported..."));
|
||||
ULOGGER_WARN("iSource type not supported...");
|
||||
emit stateChanged(kIdle);
|
||||
return;
|
||||
}
|
||||
|
||||
if(_preferencesDialog->getGeneralCameraKeypoints())
|
||||
{
|
||||
camera->setFeaturesExtracted(true);
|
||||
camera->parseParameters(_preferencesDialog->getAllParameters());
|
||||
}
|
||||
|
||||
if(!camera->init())
|
||||
{
|
||||
@@ -2214,7 +2234,6 @@ void MainWindow::startDetection()
|
||||
}
|
||||
|
||||
_camera = new CameraThread(camera);
|
||||
UEventsManager::addHandler(_camera); //thread
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2580,12 +2599,22 @@ void MainWindow::selectDatabase()
|
||||
|
||||
void MainWindow::selectOpenni()
|
||||
{
|
||||
_preferencesDialog->selectSourceOpenni(true);
|
||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_PCL);
|
||||
}
|
||||
|
||||
void MainWindow::selectFreenect()
|
||||
{
|
||||
_preferencesDialog->selectSourceOpenni(false);
|
||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcFreenect);
|
||||
}
|
||||
|
||||
void MainWindow::selectOpenniCv()
|
||||
{
|
||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_CV);
|
||||
}
|
||||
|
||||
void MainWindow::selectOpenniCvAsus()
|
||||
{
|
||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_CV_ASUS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include "rtabmap/core/Odometry.h"
|
||||
#include "rtabmap/core/CameraOpenni.h"
|
||||
#include "rtabmap/core/CameraFreenect.h"
|
||||
#include "rtabmap/core/CameraThread.h"
|
||||
#include "rtabmap/core/Camera.h"
|
||||
#include "rtabmap/core/Memory.h"
|
||||
|
||||
#include "rtabmap/gui/LoopClosureViewer.h"
|
||||
@@ -64,6 +66,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
_initialized(false),
|
||||
_odomCameraOpenNI(0),
|
||||
_odomCameraFreenect(0),
|
||||
_odomCameraOpenNICv(0),
|
||||
_odomThread(0)
|
||||
{
|
||||
ULOGGER_DEBUG("");
|
||||
@@ -208,7 +211,6 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
connect(_ui->source_comboBox_image_type, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_image, SLOT(setCurrentIndex(int)));
|
||||
connect(_ui->source_comboBox_image_type, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->general_checkBox_autoRestart, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->general_checkBox_cameraKeypoints, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
//usbDevice group
|
||||
connect(_ui->source_usbDevice_spinBox_id, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->source_spinBox_imgWidth, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
@@ -231,8 +233,10 @@ 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_opennipcl, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->radioButton_freenect, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->radioButton_opennicv, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
|
||||
connect(_ui->radioButton_opennicvasus, 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()));
|
||||
|
||||
@@ -758,7 +762,6 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
||||
_ui->source_spinBox_imgheight->setValue(0);
|
||||
_ui->source_spinBox_framesDropped->setValue(0);
|
||||
_ui->general_checkBox_autoRestart->setChecked(false);
|
||||
_ui->general_checkBox_cameraKeypoints->setChecked(false);
|
||||
_ui->source_images_spinBox_startPos->setValue(1);
|
||||
_ui->source_images_refreshDir->setChecked(false);
|
||||
|
||||
@@ -767,8 +770,10 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
||||
_ui->source_spinBox_databaseStartPos->setValue(0);
|
||||
|
||||
_ui->groupBox_sourceOpenni->setChecked(true);
|
||||
_ui->radioButton_openni->setChecked(true);
|
||||
_ui->radioButton_opennipcl->setChecked(true);
|
||||
_ui->radioButton_freenect->setChecked(false);
|
||||
_ui->radioButton_opennicv->setChecked(false);
|
||||
_ui->radioButton_opennicvasus->setChecked(false);
|
||||
_ui->lineEdit_openniDevice->setText("");
|
||||
_ui->lineEdit_openniLocalTransform->setText("0 0 0 -PI_2 0 -PI_2");
|
||||
}
|
||||
@@ -978,7 +983,6 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
|
||||
_ui->groupBox_sourceImage->setChecked(settings.value("imageUsed", _ui->groupBox_sourceImage->isChecked()).toBool());
|
||||
_ui->general_doubleSpinBox_imgRate->setValue(settings.value("imgRate", _ui->general_doubleSpinBox_imgRate->value()).toDouble());
|
||||
_ui->general_checkBox_autoRestart->setChecked(settings.value("autoRestart", _ui->general_checkBox_autoRestart->isChecked()).toBool());
|
||||
_ui->general_checkBox_cameraKeypoints->setChecked(settings.value("cameraKeypoints", _ui->general_checkBox_cameraKeypoints->isChecked()).toBool());
|
||||
_ui->source_comboBox_image_type->setCurrentIndex(settings.value("type", _ui->source_comboBox_image_type->currentIndex()).toInt());
|
||||
_ui->source_spinBox_imgWidth->setValue(settings.value("imgWidth",_ui->source_spinBox_imgWidth->value()).toInt());
|
||||
_ui->source_spinBox_imgheight->setValue(settings.value("imgHeight",_ui->source_spinBox_imgheight->value()).toInt());
|
||||
@@ -1008,8 +1012,10 @@ 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_opennipcl->setChecked(settings.value("openniType", _ui->radioButton_opennipcl->isChecked()).toBool());
|
||||
_ui->radioButton_freenect->setChecked(settings.value("freenectType", _ui->radioButton_freenect->isChecked()).toBool());
|
||||
_ui->radioButton_opennicv->setChecked(settings.value("openniCvType", _ui->radioButton_opennicv->isChecked()).toBool());
|
||||
_ui->radioButton_opennicvasus->setChecked(settings.value("openniCvAsusType", _ui->radioButton_opennicvasus->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
|
||||
@@ -1186,7 +1192,6 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath)
|
||||
settings.setValue("imageUsed", _ui->groupBox_sourceImage->isChecked());
|
||||
settings.setValue("imgRate", _ui->general_doubleSpinBox_imgRate->value());
|
||||
settings.setValue("autoRestart", _ui->general_checkBox_autoRestart->isChecked());
|
||||
settings.setValue("cameraKeypoints", _ui->general_checkBox_cameraKeypoints->isChecked());
|
||||
settings.setValue("type", _ui->source_comboBox_image_type->currentIndex());
|
||||
settings.setValue("imgWidth", _ui->source_spinBox_imgWidth->value());
|
||||
settings.setValue("imgHeight", _ui->source_spinBox_imgheight->value());
|
||||
@@ -1217,8 +1222,10 @@ 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("openniType", _ui->radioButton_opennipcl->isChecked());
|
||||
settings.setValue("freenectType", _ui->radioButton_freenect->isChecked());
|
||||
settings.setValue("openniCvType", _ui->radioButton_opennicv->isChecked());
|
||||
settings.setValue("openniCvAsusType", _ui->radioButton_opennicvasus->isChecked());
|
||||
settings.setValue("device", _ui->lineEdit_openniDevice->text());
|
||||
settings.setValue("localTransform", _ui->lineEdit_openniLocalTransform->text());
|
||||
settings.endGroup();
|
||||
@@ -1581,7 +1588,7 @@ void PreferencesDialog::selectSourceDatabase(bool user)
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::selectSourceOpenni(bool openni)
|
||||
void PreferencesDialog::selectSourceRGBD(Src src)
|
||||
{
|
||||
ULOGGER_DEBUG("");
|
||||
|
||||
@@ -1589,8 +1596,8 @@ void PreferencesDialog::selectSourceOpenni(bool openni)
|
||||
{
|
||||
int button = QMessageBox::information(this,
|
||||
tr("Activate RGB-D SLAM?"),
|
||||
tr("You've selected %1 camera as source input, "
|
||||
"would you want to activate RGB-D SLAM mode?").arg(openni?"OpenNI":"Freenect"),
|
||||
tr("You've selected RGB-D camera as source input, "
|
||||
"would you want to activate RGB-D SLAM mode?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if(button & QMessageBox::Yes)
|
||||
{
|
||||
@@ -1599,8 +1606,10 @@ void PreferencesDialog::selectSourceOpenni(bool openni)
|
||||
}
|
||||
|
||||
_ui->groupBox_sourceOpenni->setChecked(true);
|
||||
_ui->radioButton_openni->setChecked(openni);
|
||||
_ui->radioButton_freenect->setChecked(!openni);
|
||||
_ui->radioButton_opennipcl->setChecked(src == kSrcOpenNI_PCL);
|
||||
_ui->radioButton_freenect->setChecked(src == kSrcFreenect);
|
||||
_ui->radioButton_opennicv->setChecked(src == kSrcOpenNI_CV);
|
||||
_ui->radioButton_opennicvasus->setChecked(src == kSrcOpenNI_CV_ASUS);
|
||||
|
||||
if(_obsoletePanels)
|
||||
{
|
||||
@@ -2456,10 +2465,6 @@ bool PreferencesDialog::getGeneralAutoRestart() const
|
||||
{
|
||||
return _ui->general_checkBox_autoRestart->isChecked();
|
||||
}
|
||||
bool PreferencesDialog::getGeneralCameraKeypoints() const
|
||||
{
|
||||
return _ui->general_checkBox_cameraKeypoints->isChecked();
|
||||
}
|
||||
int PreferencesDialog::getSourceImageType() const
|
||||
{
|
||||
return _ui->source_comboBox_image_type->currentIndex();
|
||||
@@ -2512,9 +2517,25 @@ int PreferencesDialog::getSourceDatabaseStartPos() const
|
||||
{
|
||||
return _ui->source_spinBox_databaseStartPos->value();
|
||||
}
|
||||
bool PreferencesDialog::getSourceFreenect() const
|
||||
|
||||
PreferencesDialog::Src PreferencesDialog::getSourceRGBD() const
|
||||
{
|
||||
return _ui->radioButton_freenect->isChecked();
|
||||
if(_ui->radioButton_freenect->isChecked())
|
||||
{
|
||||
return kSrcFreenect;
|
||||
}
|
||||
else if(_ui->radioButton_opennicv->isChecked())
|
||||
{
|
||||
return kSrcOpenNI_CV;
|
||||
}
|
||||
else if (_ui->radioButton_opennicvasus->isChecked())
|
||||
{
|
||||
return kSrcOpenNI_CV_ASUS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kSrcOpenNI_PCL;
|
||||
}
|
||||
}
|
||||
QString PreferencesDialog::getSourceOpenniDevice() const
|
||||
{
|
||||
@@ -2704,9 +2725,9 @@ void PreferencesDialog::testOdometry()
|
||||
|
||||
void PreferencesDialog::testOdometry(OdomType type)
|
||||
{
|
||||
UASSERT(_odomCameraOpenNI == 0 && _odomCameraFreenect == 0 && _odomThread == 0);
|
||||
UASSERT(_odomCameraOpenNI == 0 && _odomCameraFreenect == 0 && _odomThread == 0 && _odomCameraOpenNICv == 0);
|
||||
|
||||
if(this->getSourceFreenect())
|
||||
if(this->getSourceRGBD() == kSrcFreenect)
|
||||
{
|
||||
_odomCameraFreenect = new CameraFreenect(
|
||||
this->getSourceOpenniDevice().isEmpty()?0:atoi(this->getSourceOpenniDevice().toStdString().c_str()),
|
||||
@@ -2730,6 +2751,20 @@ void PreferencesDialog::testOdometry(OdomType type)
|
||||
_odomCameraFreenect = 0;
|
||||
}
|
||||
}
|
||||
else if(this->getSourceRGBD() == kSrcOpenNI_CV || this->getSourceRGBD() == kSrcOpenNI_CV_ASUS)
|
||||
{
|
||||
_odomCameraOpenNICv = new CameraThread(new CameraRGBD(
|
||||
this->getGeneralInputRate(),
|
||||
this->getSourceRGBD() == kSrcOpenNI_CV_ASUS));
|
||||
if(!_odomCameraOpenNICv->init())
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("RTAB-Map"),
|
||||
tr("OpenNI-CV camera initialization failed!"));
|
||||
delete _odomCameraOpenNICv;
|
||||
_odomCameraOpenNICv = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_odomCameraOpenNI = new CameraOpenni(
|
||||
@@ -2746,7 +2781,7 @@ void PreferencesDialog::testOdometry(OdomType type)
|
||||
}
|
||||
}
|
||||
|
||||
if(_odomCameraOpenNI || _odomCameraFreenect)
|
||||
if(_odomCameraOpenNI || _odomCameraFreenect || _odomCameraOpenNICv)
|
||||
{
|
||||
Odometry * odometry;
|
||||
ParametersMap parameters = this->getAllParameters();
|
||||
@@ -2786,6 +2821,10 @@ void PreferencesDialog::testOdometry(OdomType type)
|
||||
{
|
||||
UEventsManager::createPipe(_odomCameraFreenect, _odomThread, "CameraEvent");
|
||||
}
|
||||
else if(_odomCameraOpenNICv)
|
||||
{
|
||||
UEventsManager::createPipe(_odomCameraOpenNICv, _odomThread, "CameraEvent");
|
||||
}
|
||||
else
|
||||
{
|
||||
UEventsManager::createPipe(_odomCameraOpenNI, _odomThread, "CameraEvent");
|
||||
@@ -2803,6 +2842,10 @@ void PreferencesDialog::testOdometry(OdomType type)
|
||||
{
|
||||
_odomCameraFreenect->start();
|
||||
}
|
||||
else if(_odomCameraOpenNICv)
|
||||
{
|
||||
_odomCameraOpenNICv->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_odomCameraOpenNI->start();
|
||||
@@ -2825,6 +2868,12 @@ void PreferencesDialog::cleanOdometryTest()
|
||||
delete _odomCameraFreenect;
|
||||
_odomCameraFreenect = 0;
|
||||
}
|
||||
if(_odomCameraOpenNICv)
|
||||
{
|
||||
_odomCameraOpenNICv->join(true);
|
||||
delete _odomCameraOpenNICv;
|
||||
_odomCameraOpenNICv = 0;
|
||||
}
|
||||
if(_odomThread)
|
||||
{
|
||||
_odomThread->join(true);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>947</width>
|
||||
<height>25</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
@@ -92,6 +92,8 @@
|
||||
</property>
|
||||
<addaction name="actionOpenNI"/>
|
||||
<addaction name="actionFreenect"/>
|
||||
<addaction name="actionOpenNI_CV"/>
|
||||
<addaction name="actionOpenNI_CV_ASUS"/>
|
||||
</widget>
|
||||
<addaction name="menuImage"/>
|
||||
<addaction name="actionDatabase"/>
|
||||
@@ -983,7 +985,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OpenNI</string>
|
||||
<string>OpenNI-PCL</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFreenect">
|
||||
@@ -994,6 +996,22 @@
|
||||
<string>Freenect</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenNI_CV">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OpenNI-CV</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenNI_CV_ASUS">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OpenNI-CV-ASUS</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>729</width>
|
||||
<height>836</height>
|
||||
<y>-142</y>
|
||||
<width>728</width>
|
||||
<height>721</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
@@ -86,7 +86,7 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_22">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||
@@ -1736,9 +1736,9 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_openni">
|
||||
<widget class="QRadioButton" name="radioButton_opennipcl">
|
||||
<property name="text">
|
||||
<string>OpenNI</string>
|
||||
<string>OpenNI-PCL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -1749,6 +1749,20 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_opennicv">
|
||||
<property name="text">
|
||||
<string>OpenNI-CV</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_opennicvasus">
|
||||
<property name="text">
|
||||
<string>OpenNI-CV-ASUS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user