Ground Segmentation for Obstacle Avoidance
ROS 2 point-cloud processing with Cloth Simulation Filtering, live ground-segmentation outputs, and offline extraction of low obstacle candidates using local ground height and statistical outlier removal.

Tools & Skills
- ROS 2
- LiDAR
- Ground Segmentation
- Cloth Simulation Filter
- Open3D
- Python
- SciPy
- KD-Tree Search
- Statistical Outlier Removal
- Point-Cloud Processing
- My contribution
- Integrated CSF with ROS 2 point-cloud streams and built accumulation, local-height classification, outlier filtering, and visualization tools.
- Outcome
- Live ground-cloud publication and offline inspection of ground, low obstacle candidates, removed outliers, and higher structures.
Project overview
I built ROS 2 and Python tools around the existing Cloth Simulation Filter (CSF) library to separate ground from surrounding structures in outdoor LiDAR data. The work covers live ground segmentation, point-cloud accumulation, and offline filtering of low obstacle candidates for robot navigation.
The nodes consume registered PointCloud2 messages from /lidar/cloud_registered. Accumulation stacks these already aligned scans in their shared coordinate frame; registration is supplied by the upstream perception system.
Live ground segmentation
I implemented several processing modes to explore how much scene history to use:
| Mode | Processing and output |
|---|---|
| Per-frame segmentation | Run CSF on each incoming scan and publish its ground points |
| Colored per-frame segmentation | Publish the full scan with ground in green and non-ground in red |
| Accumulated segmentation | Re-run CSF on all scans collected so far and publish the ground subset |
| Rolling buffer | Segment the latest 60 scans, with a one-time PLY snapshot when the buffer first fills |
These nodes publish to /lidar/ground_segmented. Cloth resolution, stiffness, simulation time step, iteration count, and classification threshold can be adjusted in the processing scripts.
Local-height obstacle filtering
The obstacle-analysis workflow operates on an accumulated cloud or a saved PLY file:
- Use CSF to obtain ground and non-ground point indices.
- Build a SciPy KD-tree over ground-point XY coordinates.
- For each non-ground point, find the nearest ground point in XY and calculate its vertical height difference, Δz.
- Select points with 0 < Δz ≤ 0.6096 m (2 feet) as low obstacle candidates, and keep higher points in a separate group.
- Apply Open3D Statistical Outlier Removal (SOR) to the low candidate group, retaining its inliers for inspection.
Using local ground height makes the threshold relative to the surrounding terrain. Higher structures, such as canopy points, remain visible separately and are excluded from the low candidate set. The height threshold is a configurable selection rule.
SOR uses neighborhood-distance statistics to remove sparse outliers. It can reduce scattered artifacts in an accumulated cloud, but its output alone does not establish whether an object is moving.
Offline inspection and export
One ROS 2 tool accumulates scans until interrupted, then runs the CSF, height-selection, and SOR sequence. This complements the live ground-publishing nodes. The saved-cloud workflow also offers optional reclassification against exported cloth nodes to inspect the estimated ground surface.
Open3D visualizations distinguish ground, retained low points, removed low outliers, and higher points. PLY snapshots and colored PCD export support comparison of accumulated data and filtering settings.
Outcome
The project supplies ground-segmentation outputs for ROS 2 and an inspectable workflow for extracting low obstacle candidates from registered LiDAR data. It combines an established ground filter with application-specific height selection, outlier cleanup, and visualization for developing obstacle-avoidance perception.


