Skip to main content
Torqheart
← The Lab

02 · Plan · Free

Finding a way with A*

Draw your own walls and watch how a robot thinks its way through, and why the fastest thinker isn't always the shortest path.

Drag on the grid to draw or erase walls; drag S and G to move them

Method

cells opened

–

path length

–

Make a short clip of this demo (TikTok · Reels · Shorts) →

What's going on

Before a warehouse robot moves, it needs a collision-free path on its map. A* opens cells one at a time, always the one with the smallest “walked so far + probably still to go”. The “still to go” is the straight-line distance to the goal, which is never longer than the real way.

Picture it like this

Like finding your way in a strange city. Without a compass you try every street around you equally (Dijkstra). With one pointing at the goal you try streets in that direction first (A*). Trust the compass too much and you rush toward the goal, straight into a dead end.

On real robots

Wheeled warehouse robots plan like this for every new job. In real warehouses the map keeps changing (people, carts, pallets), so how fast you think matters as much as how short the path is. Real systems often use A* for the rough route and a second controller to dodge what just appeared.

For engineers: f = g + w·h

g = cost walked so far, h = estimated cost to go (octile with diagonal moves, Manhattan without). Open the smallest f first.

w = 0 is Dijkstra; w = 1 is A*, still optimal because h never overestimates (admissible); w > 1 is weighted A*, at most w times the shortest length, for faster search.

No cutting corners between two walls. A real robot has width: inflate walls by half its footprint before planning.