MainWindow: don't save empty database. Odometry: return null pose when not initialized.

This commit is contained in:
Mathieu Labbe
2014-12-03 22:27:31 -05:00
parent 9e1d38fe09
commit 821c1602bf
6 changed files with 20 additions and 11 deletions

View File

@@ -144,7 +144,7 @@ pcl::PointXYZ RTABMAP_EXP projectDepthTo3D(
float cx, float cy, float cx, float cy,
float fx, float fy, float fx, float fy,
bool smoothing, bool smoothing,
float maxZError = 0.03f); float maxZError = 0.02f);
pcl::PointCloud<pcl::PointXYZ>::Ptr RTABMAP_EXP cloudFromDepth( pcl::PointCloud<pcl::PointXYZ>::Ptr RTABMAP_EXP cloudFromDepth(
const cv::Mat & imageDepth, const cv::Mat & imageDepth,

View File

@@ -69,7 +69,6 @@ Odometry::Odometry(const rtabmap::ParametersMap & parameters) :
_angularUpdate(Parameters::defaultOdomAngularUpdate()), _angularUpdate(Parameters::defaultOdomAngularUpdate()),
_resetCountdown(Parameters::defaultOdomResetCountdown()), _resetCountdown(Parameters::defaultOdomResetCountdown()),
_force2D(Parameters::defaultOdomForce2D()), _force2D(Parameters::defaultOdomForce2D()),
_pose(Transform::getIdentity()),
_resetCurrentCount(0) _resetCurrentCount(0)
{ {
Parameters::parse(parameters, Parameters::kOdomLinearUpdate(), _linearUpdate); Parameters::parse(parameters, Parameters::kOdomLinearUpdate(), _linearUpdate);
@@ -121,6 +120,11 @@ bool Odometry::isLargeEnoughTransform(const Transform & transform)
Transform Odometry::process(SensorData & data, int * quality, int * features, int * localMapSize) Transform Odometry::process(SensorData & data, int * quality, int * features, int * localMapSize)
{ {
if(_pose.isNull())
{
_pose.setIdentity(); // initialized
}
Transform t = this->computeTransform(data, quality, features, localMapSize); Transform t = this->computeTransform(data, quality, features, localMapSize);
if(!t.isNull()) if(!t.isNull())
{ {

View File

@@ -1045,11 +1045,12 @@ bool Rtabmap::process(const SensorData & data)
} }
else if(hypothesis.second < _loopRatio*_lcHypothesisValue) else if(hypothesis.second < _loopRatio*_lcHypothesisValue)
{ {
UDEBUG("rejected hypothesis: not satisfying ratio"); UWARN("rejected hypothesis: not satisfying hypothesis ratio (%f < %f * %f)",
hypothesis.second, _loopRatio, _lcHypothesisValue);
} }
else else
{ {
UDEBUG("rejected hypothesis: by epipolar geometry"); UWARN("rejected hypothesis: by epipolar geometry");
} }
rejectedHypothesis = true; rejectedHypothesis = true;
} }

View File

@@ -2415,8 +2415,6 @@ void MainWindow::startDetection()
"progress will not be shown in the GUI.")); "progress will not be shown in the GUI."));
} }
_emptyNewDatabase = false; // if a new database is used, it won't be empty anymore...
emit stateChanged(kDetecting); emit stateChanged(kDetecting);
} }
@@ -3069,6 +3067,10 @@ void MainWindow::deleteMemory()
} }
this->post(new RtabmapEventCmd(RtabmapEventCmd::kCmdResetMemory)); this->post(new RtabmapEventCmd(RtabmapEventCmd::kCmdResetMemory));
if(_state!=kDetecting)
{
_emptyNewDatabase = true;
}
this->clearTheCache(); this->clearTheCache();
} }
@@ -4648,6 +4650,8 @@ void MainWindow::changeState(MainWindow::State newState)
_elapsedTime->start(); _elapsedTime->start();
_oneSecondTimer->start(); _oneSecondTimer->start();
_emptyNewDatabase = false; // if a new database is used, it won't be empty anymore...
if(_camera) if(_camera)
{ {
_camera->start(); _camera->start();

View File

@@ -847,7 +847,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->doubleSpinBox_mlsRadius->setValue(0.04); _ui->doubleSpinBox_mlsRadius->setValue(0.04);
_ui->groupBox_poseFiltering->setChecked(true); _ui->groupBox_poseFiltering->setChecked(true);
_ui->doubleSpinBox_cloudFilterRadius->setValue(0.3); _ui->doubleSpinBox_cloudFilterRadius->setValue(0.1);
_ui->doubleSpinBox_cloudFilterAngle->setValue(30); _ui->doubleSpinBox_cloudFilterAngle->setValue(30);
_ui->checkBox_map_shown->setChecked(false); _ui->checkBox_map_shown->setChecked(false);

View File

@@ -64,8 +64,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>736</width> <width>744</width>
<height>909</height> <height>1074</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
@@ -86,7 +86,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="page_22"> <widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29"> <layout class="QVBoxLayout" name="verticalLayout_29">
@@ -384,7 +384,7 @@ Show a yellow background when the number of odometry inliers goes under this thr
<double>0.010000000000000</double> <double>0.010000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>0.200000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>