CameraRealSense2: added stereo ir support for D400 cameras, added publishInterIMU parameter (required for VINS fusion).

This commit is contained in:
matlabbe
2019-09-18 20:55:48 -04:00
parent b2b1977f8b
commit 955660ba2a
6 changed files with 239 additions and 73 deletions

View File

@@ -626,6 +626,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->checkbox_realsenseDepthScaledToRGBSize, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->comboBox_realsenseRGBSource, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkbox_rs2_emitter, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkbox_rs2_irMode, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkbox_rs2_irDepth, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->spinBox_rs2_width, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->spinBox_rs2_height, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
@@ -714,6 +715,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->comboBox_imuFilter_strategy, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->comboBox_imuFilter_strategy, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_imuFilter, SLOT(setCurrentIndex(int)));
_ui->stackedWidget_imuFilter->setCurrentIndex(_ui->comboBox_imuFilter_strategy->currentIndex());
connect(_ui->checkbox_publishInterIMU, 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()));
@@ -1790,7 +1792,8 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->checkbox_realsenseDepthScaledToRGBSize->setChecked(false);
_ui->comboBox_realsenseRGBSource->setCurrentIndex(0);
_ui->checkbox_rs2_emitter->setChecked(true);
_ui->checkbox_rs2_irDepth->setChecked(false);
_ui->checkbox_rs2_irMode->setChecked(false);
_ui->checkbox_rs2_irDepth->setChecked(true);
_ui->spinBox_rs2_width->setValue(848);
_ui->spinBox_rs2_height->setValue(480);
_ui->spinBox_rs2_rate->setValue(60);
@@ -1849,6 +1852,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->doubleSpinBox_imuFilterComplementaryBiasAlpha->setValue(Parameters::defaultImuFilterComplementaryBiasAlpha());
_ui->checkBox_imuFilterComplementaryDoAdaptiveGain->setChecked(Parameters::defaultImuFilterComplementaryDoAdpativeGain());
_ui->checkBox_imuFilterComplementaryDoBiasEstimation->setChecked(Parameters::defaultImuFilterComplementaryDoBiasEstimation());
_ui->checkbox_publishInterIMU->setChecked(false);
_ui->checkBox_source_scanFromDepth->setChecked(false);
_ui->spinBox_source_scanDownsampleStep->setValue(1);
@@ -2217,6 +2221,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
settings.beginGroup("RealSense2");
_ui->checkbox_rs2_emitter->setChecked(settings.value("emitter", _ui->checkbox_rs2_emitter->isChecked()).toBool());
_ui->checkbox_rs2_irMode->setChecked(settings.value("ir", _ui->checkbox_rs2_irMode->isChecked()).toBool());
_ui->checkbox_rs2_irDepth->setChecked(settings.value("irdepth", _ui->checkbox_rs2_irDepth->isChecked()).toBool());
_ui->spinBox_rs2_width->setValue(settings.value("width", _ui->spinBox_rs2_width->value()).toInt());
_ui->spinBox_rs2_height->setValue(settings.value("height", _ui->spinBox_rs2_height->value()).toInt());
@@ -2299,6 +2304,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
_ui->doubleSpinBox_imuFilterComplementaryBiasAlpha->setValue(settings.value("complementary_bias_alpha", _ui->doubleSpinBox_imuFilterComplementaryBiasAlpha->value()).toDouble());
_ui->checkBox_imuFilterComplementaryDoAdaptiveGain->setChecked(settings.value("complementary_adaptive_gain", _ui->checkBox_imuFilterComplementaryDoAdaptiveGain->isChecked()).toBool());
_ui->checkBox_imuFilterComplementaryDoBiasEstimation->setChecked(settings.value("complementary_biais_estimation", _ui->checkBox_imuFilterComplementaryDoBiasEstimation->isChecked()).toBool());
_ui->checkbox_publishInterIMU->setChecked(settings.value("publish_inter_imu", _ui->checkbox_publishInterIMU->isChecked()).toBool());
settings.endGroup();//IMU
settings.beginGroup("Scan");
@@ -2673,6 +2679,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.beginGroup("RealSense2");
settings.setValue("emitter", _ui->checkbox_rs2_emitter->isChecked());
settings.setValue("ir", _ui->checkbox_rs2_irMode->isChecked());
settings.setValue("irdepth", _ui->checkbox_rs2_irDepth->isChecked());
settings.setValue("width", _ui->spinBox_rs2_width->value());
settings.setValue("height", _ui->spinBox_rs2_height->value());
@@ -2753,6 +2760,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.setValue("complementary_bias_alpha", _ui->doubleSpinBox_imuFilterComplementaryBiasAlpha->value());
settings.setValue("complementary_adaptive_gain", _ui->checkBox_imuFilterComplementaryDoAdaptiveGain->isChecked());
settings.setValue("complementary_biais_estimation", _ui->checkBox_imuFilterComplementaryDoBiasEstimation->isChecked());
settings.setValue("publish_inter_imu", _ui->checkbox_publishInterIMU->isChecked());
settings.endGroup();//IMU
settings.beginGroup("Scan");
@@ -5410,6 +5418,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages, bool useColor)
this->getSourceDevice().toStdString(),
this->getGeneralInputRate(),
this->getSourceLocalTransform());
((CameraRealSense2*)camera)->publishInterIMU(_ui->checkbox_publishInterIMU->isChecked());
if(driver == kSrcStereoRealSense2)
{
((CameraRealSense2*)camera)->setImagesRectified(_ui->checkBox_stereo_rectify->isChecked() && !useRawImages);
@@ -5418,7 +5427,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages, bool useColor)
else
{
((CameraRealSense2*)camera)->setEmitterEnabled(_ui->checkbox_rs2_emitter->isChecked());
((CameraRealSense2*)camera)->setIRDepthFormat(_ui->checkbox_rs2_irDepth->isChecked());
((CameraRealSense2*)camera)->setIRFormat(_ui->checkbox_rs2_irMode->isChecked(), _ui->checkbox_rs2_irDepth->isChecked());
((CameraRealSense2*)camera)->setResolution(_ui->spinBox_rs2_width->value(), _ui->spinBox_rs2_height->value(), _ui->spinBox_rs2_rate->value());
}
}

View File

@@ -63,9 +63,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>3071</height>
<y>-2150</y>
<width>680</width>
<height>3083</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -95,7 +95,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>16</number>
<number>5</number>
</property>
<widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
@@ -3096,7 +3096,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item>
<widget class="QStackedWidget" name="stackedWidget_rgbd">
<property name="currentIndex">
<number>10</number>
<number>9</number>
</property>
<widget class="QWidget" name="page_32">
<layout class="QVBoxLayout" name="verticalLayout_63">
@@ -4062,7 +4062,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<string>RealSense2</string>
</property>
<layout class="QGridLayout" name="gridLayout_100" columnstretch="0,1">
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLabel" name="label_549">
<property name="text">
<string>Stream width.</string>
@@ -4072,7 +4072,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QSpinBox" name="spinBox_rs2_height">
<property name="suffix">
<string> pix</string>
@@ -4082,7 +4082,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QSpinBox" name="spinBox_rs2_rate">
<property name="suffix">
<string> Hz</string>
@@ -4113,7 +4113,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkbox_rs2_irDepth">
<widget class="QCheckBox" name="checkbox_rs2_irMode">
<property name="text">
<string/>
</property>
@@ -4125,14 +4125,14 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item row="1" column="1">
<widget class="QLabel" name="label_471">
<property name="text">
<string>Use IR for RGB image. Tracking will be more accurate (field-of-view of the IR camera is larger with less motion blur). Make sure to disable IR emitter. </string>
<string>IR mode: use IR camera instead of RGB camera. Tracking will be more accurate (field-of-view of the IR camera is larger with less motion blur). Make sure to disable IR emitter. </string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QSpinBox" name="spinBox_rs2_width">
<property name="suffix">
<string> pix</string>
@@ -4142,7 +4142,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLabel" name="label_550">
<property name="text">
<string>Stream height.</string>
@@ -4152,7 +4152,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<spacer name="verticalSpacer_71">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -4165,7 +4165,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</spacer>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLabel" name="label_551">
<property name="text">
<string>Stream rate.</string>
@@ -4175,6 +4175,26 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_562">
<property name="text">
<string>Use depth image in IR mode (instead of right image).</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkbox_rs2_irDepth">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -6310,6 +6330,26 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkbox_publishInterIMU">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_563">
<property name="text">
<string>Publish inter IMU messages from the camera. IMU received between images will be published as separate topic.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>