mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 00:37:46 +08:00
rtabmap: added "flip_scan" parameter to flip scan values if the laser rangefinder is upside down (fixed #65)
This commit is contained in:
@@ -94,6 +94,7 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart, const ParametersMap & parameters)
|
|||||||
genScanMinDepth_(0.0),
|
genScanMinDepth_(0.0),
|
||||||
scanCloudMaxPoints_(0),
|
scanCloudMaxPoints_(0),
|
||||||
scanCloudNormalK_(0),
|
scanCloudNormalK_(0),
|
||||||
|
flipScan_(false),
|
||||||
mapToOdom_(rtabmap::Transform::getIdentity()),
|
mapToOdom_(rtabmap::Transform::getIdentity()),
|
||||||
mapsManager_(true),
|
mapsManager_(true),
|
||||||
depthSync_(0),
|
depthSync_(0),
|
||||||
@@ -178,6 +179,7 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart, const ParametersMap & parameters)
|
|||||||
pnh.param("gen_scan_min_depth", genScanMinDepth_, genScanMinDepth_);
|
pnh.param("gen_scan_min_depth", genScanMinDepth_, genScanMinDepth_);
|
||||||
pnh.param("scan_cloud_max_points", scanCloudMaxPoints_, scanCloudMaxPoints_);
|
pnh.param("scan_cloud_max_points", scanCloudMaxPoints_, scanCloudMaxPoints_);
|
||||||
pnh.param("scan_cloud_normal_k", scanCloudNormalK_, scanCloudNormalK_);
|
pnh.param("scan_cloud_normal_k", scanCloudNormalK_, scanCloudNormalK_);
|
||||||
|
pnh.param("flip_scan", flipScan_, flipScan_);
|
||||||
|
|
||||||
if(!tfPrefix.empty())
|
if(!tfPrefix.empty())
|
||||||
{
|
{
|
||||||
@@ -959,6 +961,12 @@ void CoreWrapper::commonDepthCallback(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
scan = util3d::laserScan2dFromPointCloud(*pclScan);
|
scan = util3d::laserScan2dFromPointCloud(*pclScan);
|
||||||
|
if(flipScan_)
|
||||||
|
{
|
||||||
|
cv::Mat flipScan;
|
||||||
|
cv::flip(scan, flipScan, 1);
|
||||||
|
scan = flipScan;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(scan3dMsg.get() != 0)
|
else if(scan3dMsg.get() != 0)
|
||||||
{
|
{
|
||||||
@@ -1116,6 +1124,12 @@ void CoreWrapper::commonStereoCallback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
scan = util3d::laserScan2dFromPointCloud(*pclScan);
|
scan = util3d::laserScan2dFromPointCloud(*pclScan);
|
||||||
|
if(flipScan_)
|
||||||
|
{
|
||||||
|
cv::Mat flipScan;
|
||||||
|
cv::flip(scan, flipScan, 1);
|
||||||
|
scan = flipScan;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(scan3dMsg.get() != 0)
|
else if(scan3dMsg.get() != 0)
|
||||||
{
|
{
|
||||||
@@ -2955,3 +2969,4 @@ void CoreWrapper::setupCallbacks(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ private:
|
|||||||
double genScanMinDepth_;
|
double genScanMinDepth_;
|
||||||
int scanCloudMaxPoints_;
|
int scanCloudMaxPoints_;
|
||||||
int scanCloudNormalK_;
|
int scanCloudNormalK_;
|
||||||
|
bool flipScan_;
|
||||||
|
|
||||||
rtabmap::Transform mapToOdom_;
|
rtabmap::Transform mapToOdom_;
|
||||||
boost::mutex mapToOdomMutex_;
|
boost::mutex mapToOdomMutex_;
|
||||||
@@ -472,3 +473,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif /* COREWRAPPER_H_ */
|
#endif /* COREWRAPPER_H_ */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user