Added OpenNI2 camera

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1363 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-06-13 23:44:38 +00:00
parent b85263c377
commit a943083e0b
12 changed files with 986 additions and 623 deletions

View File

@@ -117,6 +117,7 @@ private slots:
void selectFreenect();
void selectOpenniCv();
void selectOpenniCvAsus();
void selectOpenni2();
void dumpTheMemory();
void dumpThePrediction();
void downloadAllClouds();

View File

@@ -80,7 +80,8 @@ public:
kSrcOpenNI_PCL,
kSrcFreenect,
kSrcOpenNI_CV,
kSrcOpenNI_CV_ASUS
kSrcOpenNI_CV_ASUS,
kSrcOpenNI2
};
enum OdomType {

View File

@@ -286,6 +286,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
selectSourceImageGrp->addAction(_ui->actionFreenect);
selectSourceImageGrp->addAction(_ui->actionOpenNI_CV);
selectSourceImageGrp->addAction(_ui->actionOpenNI_CV_ASUS);
selectSourceImageGrp->addAction(_ui->actionOpenNI2);
this->updateSelectSourceImageMenu(_preferencesDialog->getSourceImageType());
connect(_ui->actionImageFiles, SIGNAL(triggered()), this, SLOT(selectImages()));
connect(_ui->actionVideo, SIGNAL(triggered()), this, SLOT(selectVideo()));
@@ -298,6 +299,10 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
_ui->actionFreenect->setEnabled(CameraFreenect::available());
connect(_ui->actionOpenNI_CV, SIGNAL(triggered()), this, SLOT(selectOpenniCv()));
connect(_ui->actionOpenNI_CV_ASUS, SIGNAL(triggered()), this, SLOT(selectOpenniCvAsus()));
_ui->actionOpenNI_CV->setEnabled(CameraRGBD::available());
_ui->actionOpenNI_CV_ASUS->setEnabled(CameraRGBD::available());
connect(_ui->actionOpenNI2, SIGNAL(triggered()), this, SLOT(selectOpenni2()));
_ui->actionOpenNI2->setEnabled(CameraOpenNI2::available());
connect(_ui->actionSave_state, SIGNAL(triggered()), this, SLOT(saveFigures()));
connect(_ui->actionLoad_state, SIGNAL(triggered()), this, SLOT(loadFigures()));
@@ -1841,6 +1846,7 @@ void MainWindow::updateSelectSourceRGBDMenu(bool used, PreferencesDialog::Src sr
_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);
_ui->actionOpenNI2->setChecked(used && src == PreferencesDialog::kSrcOpenNI2);
}
void MainWindow::changeImgRateSetting()
@@ -2068,11 +2074,22 @@ void MainWindow::startDetection()
}
}
else if(_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV ||
_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV_ASUS)
_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV_ASUS ||
_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI2)
{
Camera * camera = new CameraRGBD(
_preferencesDialog->getGeneralInputRate(),
_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV_ASUS);
Camera * camera = 0;
if(_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI2)
{
camera = new CameraOpenNI2(
_preferencesDialog->getGeneralInputRate());
}
else
{
camera = new CameraRGBD(
_preferencesDialog->getGeneralInputRate(),
_preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV_ASUS);
}
camera->setLocalTransform(_preferencesDialog->getSourceOpenniLocalTransform());
if(!camera->init())
@@ -2620,6 +2637,11 @@ void MainWindow::selectOpenniCvAsus()
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_CV_ASUS);
}
void MainWindow::selectOpenni2()
{
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI2);
}
void MainWindow::dumpTheMemory()
{

View File

@@ -238,6 +238,10 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->radioButton_freenect->setEnabled(CameraFreenect::available());
connect(_ui->radioButton_opennicv, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->radioButton_opennicvasus, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
_ui->radioButton_opennicv->setEnabled(CameraRGBD::available());
_ui->radioButton_opennicvasus->setEnabled(CameraRGBD::available());
connect(_ui->radioButton_openni2, SIGNAL(toggled(bool)), this, SLOT(makeObsoleteSourcePanel()));
_ui->radioButton_openni2->setEnabled(CameraOpenNI2::available());
connect(_ui->lineEdit_openniDevice, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->lineEdit_openniLocalTransform, SIGNAL(textChanged(const QString &)), this, SLOT(makeObsoleteSourcePanel()));
@@ -1611,6 +1615,7 @@ void PreferencesDialog::selectSourceRGBD(Src src)
_ui->radioButton_freenect->setChecked(src == kSrcFreenect);
_ui->radioButton_opennicv->setChecked(src == kSrcOpenNI_CV);
_ui->radioButton_opennicvasus->setChecked(src == kSrcOpenNI_CV_ASUS);
_ui->radioButton_openni2->setChecked(src == kSrcOpenNI2);
if(_obsoletePanels)
{
@@ -2533,6 +2538,10 @@ PreferencesDialog::Src PreferencesDialog::getSourceRGBD() const
{
return kSrcOpenNI_CV_ASUS;
}
else if (_ui->radioButton_openni2->isChecked())
{
return kSrcOpenNI2;
}
else
{
return kSrcOpenNI_PCL;
@@ -2752,11 +2761,23 @@ void PreferencesDialog::testOdometry(OdomType type)
_odomCameraFreenect = 0;
}
}
else if(this->getSourceRGBD() == kSrcOpenNI_CV || this->getSourceRGBD() == kSrcOpenNI_CV_ASUS)
else if(this->getSourceRGBD() == kSrcOpenNI_CV ||
this->getSourceRGBD() == kSrcOpenNI_CV_ASUS ||
this->getSourceRGBD() == kSrcOpenNI2)
{
Camera * camera = new CameraRGBD(
Camera * camera = 0;
if(this->getSourceRGBD() == kSrcOpenNI2)
{
camera = new CameraOpenNI2(
this->getGeneralInputRate());
}
else
{
camera = new CameraRGBD(
this->getGeneralInputRate(),
this->getSourceRGBD() == kSrcOpenNI_CV_ASUS);
}
camera->setLocalTransform(this->getSourceOpenniLocalTransform());
_odomCameraOpenNICv = new CameraThread(camera);
if(!_odomCameraOpenNICv->init())

View File

@@ -94,6 +94,7 @@
<addaction name="actionFreenect"/>
<addaction name="actionOpenNI_CV"/>
<addaction name="actionOpenNI_CV_ASUS"/>
<addaction name="actionOpenNI2"/>
</widget>
<addaction name="menuImage"/>
<addaction name="actionDatabase"/>
@@ -1012,6 +1013,11 @@
<string>OpenNI-CV-ASUS</string>
</property>
</action>
<action name="actionOpenNI2">
<property name="text">
<string>OpenNI2</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@@ -63,9 +63,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-331</y>
<width>609</width>
<height>811</height>
<height>657</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -1763,6 +1763,13 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_openni2">
<property name="text">
<string>OpenNI2</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">