|
ground_segmentation 1.0
Ground segmentation in pointcloud
|
Core grid-based ground segmentation algorithm. More...
#include <ground_detection.hpp>
Public Types | |
| typedef GridCell< PointT > | CellType |
| typedef std::unordered_map< Index3D, CellType, Index3D::HashFunction > | GridCellsType |
| typedef nanoflann::KDTreeSingleIndexAdaptor< nanoflann::L2_Simple_Adaptor< double, PCLPointCloudAdaptor< PointT > >, PCLPointCloudAdaptor< PointT >, 3, size_t > | KDTree |
Public Member Functions | |
| PointCloudGrid (const GridConfig &config) | |
| void | clear () |
| void | setInputCloud (typename pcl::PointCloud< PointT >::Ptr input, const Eigen::Quaterniond &R_body2World) |
| GridCellsType & | getGridCells () |
| std::pair< typename pcl::PointCloud< PointT >::Ptr, typename pcl::PointCloud< PointT >::Ptr > | segmentPoints () |
| Final segmentation step. | |
| bool | checkIndex3DInGrid (const Index3D &index) const |
| void | setDistToGround (double z) |
Private Member Functions | |
| std::vector< Index3D > | generateIndices (const uint16_t &z_threshold) |
| Generate neighbor offsets for region growing. | |
| void | cleanUp () |
| void | addPoint (const PointT &point) |
| void | getGroundCells () |
| Classify grid cells into ground or obstacle. | |
| std::vector< Index3D > | getNeighbors (const GridCell< PointT > &cell, const TerrainType &type, const std::vector< Index3D > &neighbor_offsets) |
| double | computeSlope (const Eigen::Hyperplane< double, int(3)> &plane) const |
| Compute slope angle between surface normal and global Z-axis. | |
| double | computeSlope (const Eigen::Vector3d &normal) |
| bool | fitGroundPlane (GridCell< PointT > &cell, const double &inlier_threshold) |
| Fit a planar model to cell points using PROSAC. | |
| void | expandGrid (std::queue< Index3D > q) |
| Region growing from robot cell using centroid KD-tree. | |
| std::string | classifySparsityBoundingBox (const GridCell< PointT > &cell, typename pcl::PointCloud< PointT >::Ptr cloud) |
| bool | classifySparsityNormalDist (const GridCell< PointT > &cell) |
| bool | findNearestGroundNeighbor (const Index3D &cid, Index3D &out_gid) const |
| bool | pointIsGroundWrtCell (const PointT &p, const GridCell< PointT > &gcell) const |
Private Attributes | |
| std::vector< Index3D > | neighbor_offsets |
| GridCellsType | gridCells |
| GridConfig | grid_config |
| std::vector< Index3D > | ground_cells |
| std::vector< Index3D > | non_ground_cells |
| Eigen::Quaterniond | orientation |
| pcl::PointCloud< PointT >::Ptr | centroid_cloud |
| std::vector< Index3D > | centroid_indices |
| std::unordered_map< Index3D, size_t, Index3D::HashFunction > | index_to_centroid_idx |
| pcl::PointCloud< PointT >::Ptr | ground_points |
| pcl::PointCloud< PointT >::Ptr | non_ground_points |
| pcl::PointCloud< PointT >::Ptr | ground_inliers |
| pcl::PointCloud< PointT >::Ptr | non_ground_inliers |
| pcl::SACSegmentation< PointT > | seg |
Core grid-based ground segmentation algorithm.
Pipeline: 1) Voxelize point cloud into 3D grid 2) Compute PCA per cell 3) Classify primitives (line/plane/noise) 4) Fit plane model (RANSAC) 5) Apply slope threshold 6) Seed region at robot cell 7) Expand via centroid KD-tree
Outputs separated ground and non-ground clouds.
| PointT | PCL point type |
Definition at line 79 of file ground_detection.hpp.
| typedef GridCell<PointT> ground_segmentation::PointCloudGrid< PointT >::CellType |
Definition at line 84 of file ground_detection.hpp.
| typedef std::unordered_map<Index3D, CellType, Index3D::HashFunction> ground_segmentation::PointCloudGrid< PointT >::GridCellsType |
Definition at line 85 of file ground_detection.hpp.
| typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<double, PCLPointCloudAdaptor<PointT> >, PCLPointCloudAdaptor<PointT>, 3, size_t> ground_segmentation::PointCloudGrid< PointT >::KDTree |
Definition at line 114 of file ground_detection.hpp.
| ground_segmentation::PointCloudGrid< PointT >::PointCloudGrid | ( | const GridConfig & | config | ) |
Definition at line 221 of file ground_detection.hpp.
|
private |
Definition at line 354 of file ground_detection.hpp.
References ground_segmentation::GridCell< PointT >::points, ground_segmentation::GridCell< PointT >::x, ground_segmentation::GridCell< PointT >::y, and ground_segmentation::GridCell< PointT >::z.
| bool ground_segmentation::PointCloudGrid< PointT >::checkIndex3DInGrid | ( | const Index3D & | index | ) | const |
Definition at line 763 of file ground_detection.hpp.
|
private |
Definition at line 393 of file ground_detection.hpp.
References ground_segmentation::GridCell< PointT >::points.
|
private |
Definition at line 420 of file ground_detection.hpp.
References ground_segmentation::GridCell< PointT >::centroid, ground_segmentation::GridCell< PointT >::normal, and ground_segmentation::GridCell< PointT >::points.
|
private |
Definition at line 344 of file ground_detection.hpp.
| void ground_segmentation::PointCloudGrid< PointT >::clear | ( | ) |
Definition at line 338 of file ground_detection.hpp.
|
private |
Compute slope angle between surface normal and global Z-axis.
| normal | Estimated plane normal |
Uses body-to-world orientation to ensure gravity alignment.
Definition at line 383 of file ground_detection.hpp.
|
private |
Definition at line 373 of file ground_detection.hpp.
|
private |
Region growing from robot cell using centroid KD-tree.
Expands only to:
Ensures ground continuity and prevents floating ground artifacts.
Definition at line 666 of file ground_detection.hpp.
References ground_segmentation::GridCell< PointT >::centroid, ground_segmentation::GridCell< PointT >::expanded, ground_segmentation::GROUND, ground_segmentation::GridCell< PointT >::in_queue, ground_segmentation::GridCell< PointT >::points, and ground_segmentation::GridCell< PointT >::terrain_type.
|
private |
Definition at line 267 of file ground_detection.hpp.
References ground_segmentation::GROUND, ground_segmentation::Index3D::x, ground_segmentation::Index3D::y, and ground_segmentation::Index3D::z.
|
private |
Fit a planar model to cell points using PROSAC.
| cell | Grid cell |
| threshold | RANSAC inlier threshold (meters) |
Sets:
Definition at line 474 of file ground_detection.hpp.
References ground_segmentation::GridCell< PointT >::inliers, ground_segmentation::GridCell< PointT >::points, and ground_segmentation::GridCell< PointT >::slope.
|
private |
Generate neighbor offsets for region growing.
| z_threshold | Defines vertical expansion range. |
Phase 1 → z_threshold = 0 (horizontal only) Phase 2 → z_threshold = 1 (vertical connectivity allowed)
Definition at line 245 of file ground_detection.hpp.
References ground_segmentation::Index3D::x, ground_segmentation::Index3D::y, and ground_segmentation::Index3D::z.
|
inline |
Definition at line 92 of file ground_detection.hpp.
References ground_segmentation::PointCloudGrid< PointT >::gridCells.
|
private |
Classify grid cells into ground or obstacle.
Steps:
Definition at line 496 of file ground_detection.hpp.
References ground_segmentation::GridCell< PointT >::centroid, ground_segmentation::GridCell< PointT >::eigenvalues, ground_segmentation::GridCell< PointT >::eigenvectors, ground_segmentation::GridCell< PointT >::expanded, ground_segmentation::GROUND, ground_segmentation::GridCell< PointT >::in_queue, ground_segmentation::LINE, ground_segmentation::NOISE, ground_segmentation::GridCell< PointT >::normal, ground_segmentation::OBSTACLE, ground_segmentation::PLANE, ground_segmentation::GridCell< PointT >::points, ground_segmentation::GridCell< PointT >::primitive_type, ground_segmentation::GridCell< PointT >::slope, and ground_segmentation::GridCell< PointT >::terrain_type.
|
private |
Definition at line 440 of file ground_detection.hpp.
References ground_segmentation::GridCell< PointT >::points, ground_segmentation::GridCell< PointT >::terrain_type, ground_segmentation::GridCell< PointT >::x, ground_segmentation::Index3D::x, ground_segmentation::GridCell< PointT >::y, ground_segmentation::Index3D::y, ground_segmentation::GridCell< PointT >::z, and ground_segmentation::Index3D::z.
|
private |
Definition at line 308 of file ground_detection.hpp.
References ground_segmentation::GridCell< PointT >::centroid, and ground_segmentation::GridCell< PointT >::normal.
| std::pair< typename pcl::PointCloud< PointT >::Ptr, typename pcl::PointCloud< PointT >::Ptr > ground_segmentation::PointCloudGrid< PointT >::segmentPoints | ( | ) |
Final segmentation step.
Splits:
Applies:
Definition at line 774 of file ground_detection.hpp.
References ground_segmentation::GROUND, ground_segmentation::GridCell< PointT >::inliers, ground_segmentation::LINE, ground_segmentation::GridCell< PointT >::points, ground_segmentation::GridCell< PointT >::primitive_type, and ground_segmentation::GridCell< PointT >::terrain_type.
|
inline |
Definition at line 117 of file ground_detection.hpp.
References ground_segmentation::GridConfig::distToGround, and ground_segmentation::PointCloudGrid< PointT >::grid_config.
| void ground_segmentation::PointCloudGrid< PointT >::setInputCloud | ( | typename pcl::PointCloud< PointT >::Ptr | input, |
| const Eigen::Quaterniond & | R_body2World | ||
| ) |
Definition at line 750 of file ground_detection.hpp.
|
private |
Definition at line 209 of file ground_detection.hpp.
|
private |
Definition at line 210 of file ground_detection.hpp.
|
private |
Definition at line 203 of file ground_detection.hpp.
Referenced by ground_segmentation::PointCloudGrid< PointT >::setDistToGround().
|
private |
Definition at line 202 of file ground_detection.hpp.
Referenced by ground_segmentation::PointCloudGrid< PointT >::getGridCells().
|
private |
Definition at line 204 of file ground_detection.hpp.
|
private |
Definition at line 215 of file ground_detection.hpp.
|
private |
Definition at line 213 of file ground_detection.hpp.
|
private |
Definition at line 211 of file ground_detection.hpp.
|
private |
Definition at line 200 of file ground_detection.hpp.
|
private |
Definition at line 205 of file ground_detection.hpp.
|
private |
Definition at line 216 of file ground_detection.hpp.
|
private |
Definition at line 214 of file ground_detection.hpp.
|
private |
Definition at line 206 of file ground_detection.hpp.
|
private |
Definition at line 218 of file ground_detection.hpp.