mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +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",
|
||||
minGroundHeight_!=0.0f?minGroundHeight_:std::numeric_limits<int>::min(),
|
||||
maxObstacleHeight_>0.0f?maxObstacleHeight_:std::numeric_limits<int>::max());
|
||||
UDEBUG("indices after max obstacles height filtering = %d", (int)indices->size());
|
||||
}
|
||||
|
||||
if(indices->size())
|
||||
|
||||
@@ -83,7 +83,9 @@ void segmentObstaclesFromGround(
|
||||
normalKSearch,
|
||||
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;
|
||||
std::vector<pcl::IndicesPtr> clusteredFlatSurfaces = extractClusters(
|
||||
@@ -93,7 +95,7 @@ void segmentObstaclesFromGround(
|
||||
minClusterSize,
|
||||
std::numeric_limits<int>::max(),
|
||||
&biggestFlatSurfaceIndex);
|
||||
|
||||
UDEBUG("clusteredFlatSurfaces=%d", (int)clusteredFlatSurfaces.size());
|
||||
|
||||
// cluster all surfaces for which the centroid is in the Z-range of the bigger surface
|
||||
if(clusteredFlatSurfaces.size())
|
||||
@@ -138,6 +140,8 @@ void segmentObstaclesFromGround(
|
||||
ground = flatSurfaces;
|
||||
}
|
||||
|
||||
UDEBUG("ground=%d", (int)ground->size());
|
||||
|
||||
if(ground->size() != cloud->size())
|
||||
{
|
||||
// Remove ground
|
||||
|
||||
Reference in New Issue
Block a user