An interactive Python prototype that computes and visualises an efficient mowing path for an arbitrary lawn shape, given mower blade width and basic constraints.
This project explores coverage path planning (CPP) applied to residential lawn mowing (boustrophedon sweeping).
- Draw an arbitrary lawn boundary interactively
- Optional obstacle polygons (“holes”) and selectable start point
- Set mower blade width, planning resolution, and sweep angle step
- Automatically selects an efficient sweep orientation
- Visualises traversal path, coverage progress, and optional mowing lanes (planned stripes)
- Estimates mowing distance and multiple time estimates (base vs turn/overlap-adjusted)
- Ranks mower categories (push, self-propelled, battery, robotic, ride-on) with transparent rationale
- Runs fully locally (no GPS, no cloud)
Drawing the lawn shape
Planned path, obstacles, and time metrics
- Draw a lawn polygon (and optional obstacle polygons)
- Rasterise the geometry to a grid
- Evaluate multiple sweep angles
- Score each candidate by:
- Path length
- Turn count (penalised)
- Render the best plan and compute metrics
- Python 3.10+
- pygame
- numpy
pip install pygame numpy
python lawn_carer3.1.py
- B: boundary draw mode
- O: obstacle draw mode (adds “holes” inside lawn)
- S: start-point mode (click to set start)
- ENTER: finalise current polygon / run planning
- BACKSPACE: undo last point
- R: reset and redraw
- ESC: quit
- Left click (release): add point
- Hold left mouse + drag: draw shape quickly
- P: add point at cursor
- SPACE: pause / resume animation
- + / -: change animation speed
- T: toggle turn penalties (compare base vs turn-adjusted time)
- L: toggle lane visualisation (OFF by default)
- H: toggle visit heatmap overlay (Shift+H cycles modes)
- M: toggle mower recommendation panel
- F1–F5 (after planning): cycle recommendation prefs (budget, effort, noise, storage, terrain)
- [ / ]: decrease / increase blade width (m)
- , / .: decrease / increase grid resolution
- A: cycle sweep angle resolution
- 1 / 2: decrease / increase mower speed (m/s)
- Coverage percentage
- Approximate total travel distance (meters)
- Base mowing time (distance ÷ mower speed)
- Turn count and turn density (incl. U-turns if shown)
- Turn-adjusted and overlap-adjusted “decision time” (used for recommendations)
- Mower recommendation with top reasons and warnings
Turn penalties are included in the decision time; toggle T in the app to compare.
- Flat terrain only
- Obstacle handling is basic (polygon holes only)
- Turn and overlap costs are simple heuristics
- Grid approximation (not continuous geometry)
Experimental MVP for exploration and prototyping.

