diff --git a/corelib/include/rtabmap/core/Parameters.h b/corelib/include/rtabmap/core/Parameters.h index d007fbe0..affcb602 100644 --- a/corelib/include/rtabmap/core/Parameters.h +++ b/corelib/include/rtabmap/core/Parameters.h @@ -512,8 +512,10 @@ class RTABMAP_EXP Parameters RTABMAP_PARAM(Icp, PointToPlane, bool, false, "Use point to plane ICP."); RTABMAP_PARAM(Icp, PointToPlaneNormalNeighbors, int, 20, "Number of neighbors to compute normals for point to plane."); + // libpointmatcher RTABMAP_PARAM(Icp, PM, bool, false, "Use libpointmatcher for ICP registration instead of PCL's implementation."); RTABMAP_PARAM_STR(Icp, PMConfig, "", uFormat("Configuration file (*.yaml) used by libpointmatcher. Note that data filters set for libpointmatcher are done after filtering done by rtabmap (i.e., %s, %s), so make sure to disable those in rtabmap if you want to use only those from libpointmatcher. Parameters %s, %s and %s are also ignored if configuration file is set.", kIcpVoxelSize().c_str(), kIcpDownsamplingStep().c_str(), kIcpIterations().c_str(), kIcpEpsilon().c_str(), kIcpMaxCorrespondenceDistance().c_str()).c_str()); + RTABMAP_PARAM(Icp, PMOutlierRatio, float, 0.85, "TrimmedDistOutlierFilter/ratio: For convenience when configuration file is not set. For kinect-like point cloud, use 0.65."); // Stereo disparity RTABMAP_PARAM(Stereo, WinWidth, int, 15, "Window width."); diff --git a/corelib/include/rtabmap/core/RegistrationIcp.h b/corelib/include/rtabmap/core/RegistrationIcp.h index ecebb16d..546292c7 100644 --- a/corelib/include/rtabmap/core/RegistrationIcp.h +++ b/corelib/include/rtabmap/core/RegistrationIcp.h @@ -67,6 +67,7 @@ private: int _pointToPlaneNormalNeighbors; bool _libpointmatcher; std::string _libpointmatcherConfig; + float _libpointmatcherOutlierRatio; void * _libpointmatcherICP; }; diff --git a/corelib/src/RegistrationIcp.cpp b/corelib/src/RegistrationIcp.cpp index eb818dd1..c6f1e2a2 100644 --- a/corelib/src/RegistrationIcp.cpp +++ b/corelib/src/RegistrationIcp.cpp @@ -228,6 +228,7 @@ RegistrationIcp::RegistrationIcp(const ParametersMap & parameters, Registration _pointToPlaneNormalNeighbors(Parameters::defaultIcpPointToPlaneNormalNeighbors()), _libpointmatcher(Parameters::defaultIcpPM()), _libpointmatcherConfig(Parameters::defaultIcpPMConfig()), + _libpointmatcherOutlierRatio(Parameters::defaultIcpPMOutlierRatio()), _libpointmatcherICP(0) { this->parseParameters(parameters); @@ -260,6 +261,8 @@ void RegistrationIcp::parseParameters(const ParametersMap & parameters) Parameters::parse(parameters, Parameters::kIcpPM(), _libpointmatcher); Parameters::parse(parameters, Parameters::kIcpPMConfig(), _libpointmatcherConfig); + Parameters::parse(parameters, Parameters::kIcpPMOutlierRatio(), _libpointmatcherOutlierRatio); + #ifndef RTABMAP_POINTMATCHER if(_libpointmatcher) { @@ -312,7 +315,7 @@ void RegistrationIcp::parseParameters(const ParametersMap & parameters) icp->matcher.reset(PM::get().MatcherRegistrar.create("KDTreeMatcher", params)); params.clear(); - params["ratio"] = uNumber2Str(0.65); // For kinect cloud, 0.65 is better than 0.85 + params["ratio"] = uNumber2Str(_libpointmatcherOutlierRatio); icp->outlierFilters.clear(); icp->outlierFilters.push_back(PM::get().OutlierFilterRegistrar.create("TrimmedDistOutlierFilter", params)); params.clear(); @@ -358,7 +361,7 @@ Transform RegistrationIcp::computeTransformationImpl( UDEBUG("Max translation=%f", _maxTranslation); UDEBUG("Max rotation=%f", _maxRotation); UDEBUG("Downsampling step=%d", _downsamplingStep); - UDEBUG("libpointmatcher=%d", _libpointmatcher?1:0); + UDEBUG("libpointmatcher=%d (outlier ratio=%f)", _libpointmatcher?1:0, _libpointmatcherOutlierRatio); UTimer timer; std::string msg; diff --git a/guilib/src/PreferencesDialog.cpp b/guilib/src/PreferencesDialog.cpp index f693eb17..cce1694c 100644 --- a/guilib/src/PreferencesDialog.cpp +++ b/guilib/src/PreferencesDialog.cpp @@ -862,6 +862,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) : _ui->groupBox_libpointmatcher->setObjectName(Parameters::kIcpPM().c_str()); _ui->lineEdit_IcpPMConfigPath->setObjectName(Parameters::kIcpPMConfig().c_str()); connect(_ui->toolButton_IcpConfigPath, SIGNAL(clicked()), this, SLOT(changeIcpPMConfigPath())); + _ui->doubleSpinBox_icpPMOutlierRatio->setObjectName(Parameters::kIcpPMOutlierRatio().c_str()); // Occupancy grid _ui->groupBox_grid_3d->setObjectName(Parameters::kGrid3D().c_str()); diff --git a/guilib/src/ui/preferencesDialog.ui b/guilib/src/ui/preferencesDialog.ui index 945f21a3..50c96e14 100644 --- a/guilib/src/ui/preferencesDialog.ui +++ b/guilib/src/ui/preferencesDialog.ui @@ -63,16 +63,25 @@ 0 - -310 + 0 678 - 2736 + 2739 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -4521,7 +4530,16 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki Directory of images (optional settings) - + + 0 + + + 0 + + + 0 + + 0 @@ -12473,7 +12491,16 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag - + + 0 + + + 0 + + + 0 + + 0 @@ -12613,7 +12640,16 @@ Lower the ratio -> higher the precision. 0 means disabled, matching the neare - + + 0 + + + 0 + + + 0 + + 0 @@ -12771,7 +12807,16 @@ Lower the ratio -> higher the precision. 0 means disabled, matching the neare 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -12851,7 +12896,16 @@ Lower the ratio -> higher the precision. 0 means disabled, matching the neare 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -12963,7 +13017,16 @@ Lower the ratio -> higher the precision. 0 means disabled, matching the neare 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -13640,7 +13703,10 @@ Lower the ratio -> higher the precision. 0 means disabled, matching the neare 3 - 0.010000000000000 + 0.001000000000000 + + + 9999.989999999999782 0.010000000000000 @@ -13752,6 +13818,45 @@ Lower the ratio -> higher the precision. 0 means disabled, matching the neare + + + + + + + + + 2 + + + 0.010000000000000 + + + 1.000000000000000 + + + 0.100000000000000 + + + 0.850000000000000 + + + + + + + TrimmedDistOutlierFilter/ratio: For convenience when configuration file is not set. For kinect-like point cloud, use 0.65. + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + +