🤖 Autonomous Robot Navigator: A* Planning vs Reactive Lidar Avoidance

What to do

Paint walls on the map (drag), move the start and goal, then press Go. Compare the two brains: A* + pure pursuit plans a global path and follows it; Reactive only uses its lidar and can get trapped in a dead end (try the U-trap preset). Edit walls while it drives: the planner re-plans.

Presets

Controls

Live readouts

Numerical checks

The science

Planner. A* on an 8-connected grid (cell = 0.5 m), cost = 1 per straight step, √2 per diagonal, heuristic = octile distance h = (dx+dy) + (√2−2)·min(dx,dy) (admissible, so the path is optimal on the grid). Diagonal moves may not cut a corner. "Inflate" blocks the cells next to walls to keep the robot body (r = 0.2 m) clear. The grid path is shortened by line-of-sight string pulling, which is no longer grid-optimal but is shorter in Euclidean length.

Robot. Differential drive (unicycle): x' = v cosθ, y' = v sinθ, θ' = ω, integrated with the exact arc formula each 20 ms step. Wheel speeds vR,L = v ± ωb/2.

Pure pursuit. Aim at the path point one look-ahead Ld ahead, in the robot frame at angle α: curvature κ = 2 sinα / Ld, ω = vκ. Speed is reduced in tight turns and near the goal.

Reactive mode. 21 lidar rays over 240°, range 4 m. Heading command = attraction to the goal plus repulsion from each short ray. It has no memory or map, so concave traps defeat it: a classic local-minimum failure of potential-field methods.

Honest simplifications. Known static map for A*, perfect localisation, no wheel dynamics or acceleration limits, noise is only on the lidar range. Speeds are illustrative.