mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 08:47:45 +08:00
Fixed bug where Grid/MaxObstacleHeight didn't work when the ground is not observable
This commit is contained in:
@@ -87,6 +87,7 @@ typename pcl::PointCloud<PointT>::Ptr OccupancyGrid::segmentCloud(
|
|||||||
indices = util3d::passThrough(cloud, indices, "z",
|
indices = util3d::passThrough(cloud, indices, "z",
|
||||||
minGroundHeight_!=0.0f?minGroundHeight_:std::numeric_limits<int>::min(),
|
minGroundHeight_!=0.0f?minGroundHeight_:std::numeric_limits<int>::min(),
|
||||||
maxObstacleHeight_>0.0f?maxObstacleHeight_:std::numeric_limits<int>::max());
|
maxObstacleHeight_>0.0f?maxObstacleHeight_:std::numeric_limits<int>::max());
|
||||||
|
UDEBUG("indices after max obstacles height filtering = %d", (int)indices->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(indices->size())
|
if(indices->size())
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ void segmentObstaclesFromGround(
|
|||||||
normalKSearch,
|
normalKSearch,
|
||||||
viewPoint);
|
viewPoint);
|
||||||
|
|
||||||
if(segmentFlatObstacles)
|
UDEBUG("cloud=%d, indices=%d flatSurfaces=%d", (int)cloud->size(), (int)indices->size(), (int)flatSurfaces->size());
|
||||||
|
|
||||||
|
if(segmentFlatObstacles && flatSurfaces->size())
|
||||||
{
|
{
|
||||||
int biggestFlatSurfaceIndex;
|
int biggestFlatSurfaceIndex;
|
||||||
std::vector<pcl::IndicesPtr> clusteredFlatSurfaces = extractClusters(
|
std::vector<pcl::IndicesPtr> clusteredFlatSurfaces = extractClusters(
|
||||||
@@ -93,7 +95,7 @@ void segmentObstaclesFromGround(
|
|||||||
minClusterSize,
|
minClusterSize,
|
||||||
std::numeric_limits<int>::max(),
|
std::numeric_limits<int>::max(),
|
||||||
&biggestFlatSurfaceIndex);
|
&biggestFlatSurfaceIndex);
|
||||||
|
UDEBUG("clusteredFlatSurfaces=%d", (int)clusteredFlatSurfaces.size());
|
||||||
|
|
||||||
// cluster all surfaces for which the centroid is in the Z-range of the bigger surface
|
// cluster all surfaces for which the centroid is in the Z-range of the bigger surface
|
||||||
if(clusteredFlatSurfaces.size())
|
if(clusteredFlatSurfaces.size())
|
||||||
@@ -138,6 +140,8 @@ void segmentObstaclesFromGround(
|
|||||||
ground = flatSurfaces;
|
ground = flatSurfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UDEBUG("ground=%d", (int)ground->size());
|
||||||
|
|
||||||
if(ground->size() != cloud->size())
|
if(ground->size() != cloud->size())
|
||||||
{
|
{
|
||||||
// Remove ground
|
// Remove ground
|
||||||
|
|||||||
Reference in New Issue
Block a user