Sweep Planner

A demining robot has to pass its detector over every square metre of a field โ€” and prove it did. These are three ways to plan that sweep, measured against each other on the same ground.

Drag on the field to paint obstacles ยท Shift-drag to erase. The plan updates when you let go.

never swept โ€” failure once twice โ€” intended lane overlap three times four or more โ€” wasted obstacle

What this is measuring

Getting from A to B is a solved problem. Covering an entire area is a different one, and it is the problem a demining robot actually has. A path that misses one strip of ground has failed completely, however elegant it looks โ€” in a real clearance task, an unswept strip is a mine somebody walks onto later.

So the primary metric is coverage, and it has to be 100 %. Everything else โ€” distance, turns, overlap โ€” only matters once that is true. Turns are counted separately from distance because on a differential-drive rover a turn is not free: it means decelerating, rotating in place, and accelerating again, and for a machine dragging a detector head it is where lane-tracking error is worst.

The three planners

Raster lanes
Straight lanes across the field's full width, ignoring its shape entirely. Where an obstacle breaks a lane, the two halves are re-joined with an A* transit. This is the honest baseline โ€” the thing to beat.
Boustrophedon decomposition
Sweep a vertical line across the field and watch the pattern of free vertical slices. Where an obstacle's leading edge splits one slice into two, or its trailing edge merges two into one, a cell boundary is recorded. Inside any resulting cell the free space is one unbroken band at every column, so back-and-forth lanes cover it completely with no interruptions. Choset's algorithm, on a grid rather than exact polygons.
Inward spiral
Concentric rings shrinking inward by one lane spacing. Very few turns on open ground, which is genuinely attractive โ€” and it degrades badly the moment obstacles break the rings.

An honest result

On these fields, the decomposition does not beat the naive baseline. It covers just as much ground, and on scattered obstacles it drives further and turns more. Try it: load Scattered rubble and compare.

The reason is ordering. Decomposition covers one cell completely before moving to the next, so it pays a transit every time it changes cell. A row-major raster sweeps across every cell at once on each lane and never pays that. Decomposition earns its keep where obstacles genuinely partition the field โ€” try Walled compound โ€” and its real guarantee is completeness by construction rather than minimum distance.

That result is in the repository's test suite as an explicit non-assertion, with a comment explaining why. Measuring the thing was more useful than assuming the textbook algorithm would win.