This is a genuine single-plane 2D LiDAR — the kind fitted to real mobile robots and vacuum cleaners (Hokuyo, RPLiDAR and similar), spinning one beam through a full 360° in one plane, unlike a multi-channel automotive sensor. At sweep angle θ the beam direction is
d = (sinθ, cosθ)
A long, straight curb-like wall runs past the robot, subtending a wide angle from where it stands — much like the ground plane sits beneath every point in a 3D scan. Cars and pedestrians cluster in front of it, closer to the robot, occluding the wall only where they stand: a ray/circle quadratic for pedestrians, a ray cast into each car's own rotated frame for an oriented-box (OBB) slab test. The nearest positive hit becomes one 2D point, with small Gaussian range noise added for realism.
1. Wall extraction — RANSAC. Real LiDAR returns carry no wall/obstacle label. The pipeline repeatedly samples 2 random points, fits the line through them (ax+by+c=0, unit normal), and counts inliers within the threshold distance |ax+by+c| < ε. The line with the most inliers after many random trials wins — the same RANSAC (RANdom SAmple Consensus) estimator that strips the ground plane out of a 3D point cloud, applied here to the 2D analogue: a straight wall.
2. Object clustering — grid connected components. The remaining non-wall points are hashed into a 2D grid of cells sized to the clustering distance; two points are linked if they fall in the same or an adjacent cell and are within that distance of each other, using union-find to merge chains of linked points into connected components. This is a fast approximation of Euclidean cluster extraction — each surviving component (above a minimum point count) becomes one detected object, boxed by its axis-aligned bounding extent.
- Angular resolution — points per revolution; coarser settings under-sample thin or distant objects.
- Scan rate — sweep frequency; faster sweeps update the scene sooner but each individual sweep still covers the full 360°.
- Sensor range — maximum return distance; objects and wall beyond it are simply invisible to the algorithm.
- RANSAC threshold — how far a point may sit from the fitted line and still count as "wall"; too loose swallows nearby obstacles, too tight fragments the wall into noise.