Nodelets point_cloud_xyz[rgb]: fixed NaN error when no prior filtering is done before radius filtering

This commit is contained in:
matlabbe
2016-05-16 15:48:09 -04:00
parent f5ef80709b
commit f0026b071c
2 changed files with 20 additions and 4 deletions
+10 -2
View File
@@ -256,9 +256,17 @@ private:
void processAndPublish(pcl::PointCloud<pcl::PointXYZ>::Ptr & pclCloud, const std_msgs::Header & header) void processAndPublish(pcl::PointCloud<pcl::PointXYZ>::Ptr & pclCloud, const std_msgs::Header & header)
{ {
if(pclCloud->size() && (minDepth_ != 0.0 || maxDepth_ > minDepth_)) if(pclCloud->size())
{ {
pclCloud = rtabmap::util3d::passThrough(pclCloud, "z", minDepth_, maxDepth_>minDepth_?maxDepth_:std::numeric_limits<float>::max()); if(minDepth_ != 0.0 || maxDepth_ > minDepth_)
{
pclCloud = rtabmap::util3d::passThrough(pclCloud, "z", minDepth_, maxDepth_>minDepth_?maxDepth_:std::numeric_limits<float>::max());
}
else if(noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
{
// remvoe NaN values
pclCloud = rtabmap::util3d::removeNaNFromPointCloud(pclCloud);
}
} }
if(pclCloud->size() && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0) if(pclCloud->size() && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
+10 -2
View File
@@ -259,9 +259,17 @@ private:
void processAndPublish(pcl::PointCloud<pcl::PointXYZRGB>::Ptr & pclCloud, const std_msgs::Header & header) void processAndPublish(pcl::PointCloud<pcl::PointXYZRGB>::Ptr & pclCloud, const std_msgs::Header & header)
{ {
if(pclCloud->size() && (minDepth_ != 0.0 || maxDepth_ > minDepth_)) if(pclCloud->size())
{ {
pclCloud = rtabmap::util3d::passThrough(pclCloud, "z", minDepth_, maxDepth_>minDepth_?maxDepth_:std::numeric_limits<float>::max()); if(minDepth_ != 0.0 || maxDepth_ > minDepth_)
{
pclCloud = rtabmap::util3d::passThrough(pclCloud, "z", minDepth_, maxDepth_>minDepth_?maxDepth_:std::numeric_limits<float>::max());
}
else if(noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)
{
// remvoe NaN values
pclCloud = rtabmap::util3d::removeNaNFromPointCloud(pclCloud);
}
} }
if(pclCloud->size() && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0) if(pclCloud->size() && noiseFilterRadius_ > 0.0 && noiseFilterMinNeighbors_ > 0)