rtabmap: added "flip_scan" parameter to flip scan values if the laser rangefinder is upside down (fixed #65)

This commit is contained in:
matlabbe
2016-06-06 12:35:31 -04:00
parent e76bfa07b2
commit cc0591c60a
2 changed files with 17 additions and 0 deletions
+15
View File
@@ -94,6 +94,7 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart, const ParametersMap & parameters)
genScanMinDepth_(0.0),
scanCloudMaxPoints_(0),
scanCloudNormalK_(0),
flipScan_(false),
mapToOdom_(rtabmap::Transform::getIdentity()),
mapsManager_(true),
depthSync_(0),
@@ -178,6 +179,7 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart, const ParametersMap & parameters)
pnh.param("gen_scan_min_depth", genScanMinDepth_, genScanMinDepth_);
pnh.param("scan_cloud_max_points", scanCloudMaxPoints_, scanCloudMaxPoints_);
pnh.param("scan_cloud_normal_k", scanCloudNormalK_, scanCloudNormalK_);
pnh.param("flip_scan", flipScan_, flipScan_);
if(!tfPrefix.empty())
{
@@ -959,6 +961,12 @@ void CoreWrapper::commonDepthCallback(
}
}
scan = util3d::laserScan2dFromPointCloud(*pclScan);
if(flipScan_)
{
cv::Mat flipScan;
cv::flip(scan, flipScan, 1);
scan = flipScan;
}
}
else if(scan3dMsg.get() != 0)
{
@@ -1116,6 +1124,12 @@ void CoreWrapper::commonStereoCallback(
}
scan = util3d::laserScan2dFromPointCloud(*pclScan);
if(flipScan_)
{
cv::Mat flipScan;
cv::flip(scan, flipScan, 1);
scan = flipScan;
}
}
else if(scan3dMsg.get() != 0)
{
@@ -2955,3 +2969,4 @@ void CoreWrapper::setupCallbacks(
}
+2
View File
@@ -278,6 +278,7 @@ private:
double genScanMinDepth_;
int scanCloudMaxPoints_;
int scanCloudNormalK_;
bool flipScan_;
rtabmap::Transform mapToOdom_;
boost::mutex mapToOdomMutex_;
@@ -472,3 +473,4 @@ private:
};
#endif /* COREWRAPPER_H_ */