Cory Glenn Garms
← Back to Technical Notes

Fitting Cylinders to Leaning Trees in Real Time on a Robot

#LiDAR #CUTMAP #Robotics #PointClouds

When you push a mobile sensor cart packed with a Livox LiDAR scanner and stereo cameras through a dense conifer forest, your computer has to make sense of absolute chaos.

In our USDA-funded project, CUTMAP, the goal is autonomous forest inventory: measuring individual tree diameters at breast height (DBH), height, and 3D lean angles in real time as you walk.

The catch? Nature hates clean geometric primitives.

Why Standard Circle Fitting Fails

In forestry, the textbook method is simple: take a horizontal slice of your point cloud at 1.3 meters above the ground, fit a 2D circle using least squares, and measure diameter.

That works fine in a manicured orchard. In a real forest:

  1. Stems lean: If a Douglas-fir tilts even 12°, slicing it horizontally produces an ellipse rather than a circle, inflating timber volume estimates by up to 14%.

  2. Understory clutter: Low branches, hanging moss, and dense salal brush corrupt standard circle fits, pulling centers off into empty space.

  3. Hardware limits: You don’t have an air-conditioned cloud cluster in the woods. Everything has to solve at 10–15 Hz on an embedded NVIDIA Jetson Orin powered by a battery pack.

The Fix: Geometry-Constrained RANSAC

Instead of fitting 2D circles, we fit full 3D cylinders defined by an axis vector a, a center point p₀, and a radius r.

To keep RANSAC from wasting time evaluating random brush or ground returns, we enforce a strict physical constraint on surface normals: cylinder surface normals must be perpendicular to the stem axis:

# Sample 2 seed points with divergent normals
axis = np.cross(normal_1, normal_2)
axis /= np.linalg.norm(axis)

# Enforce realistic tree lean prior (reject non-vertical junk)
if abs(axis[2]) < np.cos(np.radians(45)):
    continue

By pre-filtering surface normals and enforcing near-vertical axis priors, the algorithm rejects 95% of branch and ground clutter before spending compute cycles on distance calculations.

The result? The solver converges in under 12 milliseconds per stem on edge hardware, letting us map forest stands with sub-centimeter accuracy while walking through the trees.