03 / SYSTEM2025
Multi-Robot Pathfinding Simulator
Autonomous Robot Navigation in a Factory Environment Using Comparative Pathfinding Algorithms
One robot takes the shortest path. Three robots have to negotiate it.
THE PROBLEM
A* hands one robot its shortest path. Put three robots on the same grid and every path becomes a constraint on every other — a plan is now a promise about where you will be, and when.
Built during my internship at U R Rao Satellite Centre (Mission Planning & Operations, under Mr. M. Srikanth; Group Director Mr. K. Subbarao). The target is an Industry 4.0 "dark factory" floor — where robots, not people, move the goods.
THE SYSTEM
Python + Pygame, a 30×30 grid world with static and moving obstacles. One search core serves both A* and Dijkstra (a heapq priority queue over came_from / g_score dictionaries); a BFS variant runs the same maps for the comparison. Movement is 8-directional with an octile heuristic and a turn-penalty cost (0.1) folded into g, so path quality reflects how a real base actually turns.
Multiple robots take goals round-robin and coordinate through a space-time reservation table: each path claims cells in time, and later planners treat those claims as constraints. Line-of-sight smoothing straightens the result. Every run logs to CSV; the sim renders open/closed sets live and an exploration overlay of where the grid got searched.
WHAT I BUILT
- Unified A* / Dijkstra core + a BFS variant
- Octile heuristic, 8-directional moves, turn penalty (0.1) in g
- Round-robin multi-goal assignment + space-time reservation table
- Dynamic-obstacle replanning, bounded to 3 attempts
- Line-of-sight path smoothing
- Real-time Pygame view, exploration overlay, CSV logging, JSON save/replay
MY SCOPE
- Unified A* / Dijkstra search core — heapq priority queue, came_from / g_score dicts
- A BFS variant of the same search, for the comparison
- Octile heuristic + turn-penalty cost model (turn penalty 0.1)
- Sequential multi-goal round-robin assignment across robots
- Dynamic-obstacle replanning (bounded to 3 attempts)
- Space-time reservation table for multi-robot coordination
- Line-of-sight path smoothing
- Real-time Pygame visualization — open/closed sets + concurrent robot animation
- Per-algorithm heatmap / exploration overlay
- CSV metrics logging; JSON save/load + replay; startup-file autorun
WHAT BROKE
Adding 8-directional movement quietly broke the heuristic's honesty. With orthogonal moves costing 1 and diagonals √2, a naive Manhattan heuristic stops being admissible on that grid — A* can over- or under-estimate and lose its guarantees. The fix was an octile / Euclidean-consistent heuristic (dx + dy + (√2 − 2)·min(dx, dy)) and moving the turn cost into g rather than h, so the heuristic stayed admissible while paths still straightened.
With moving 'worker' obstacles, a robot has to stop mid-path and re-plan — and the first version leaked. Residual open/closed-set and g-score state carried between successive A* calls and corrupted the next path. The fix was a full per-call reset of g / f / parent / direction across the grid before each search, plus a main-loop check that only triggers a replan when a future path cell becomes occupied — bounded to three attempts.
Running pathfinding and Pygame rendering in one blocking loop made the GUI hang and hid what the search was doing. I restructured robot motion as per-frame generators — yield-per-frame — stepped from the main loop, so several robots animate concurrently without freezing the event loop, and the open/closed sets stay visible during the search.
FIGURES


RESULT
- The three-way comparison, averaged over two-robot runs — A*: 2.64 steps · 1.59 turns · 1.2 ms · Dijkstra: 2.55 steps · 1.73 turns · 6.0 ms · BFS: 2.80 steps · 0 turns · 2.4 ms.
- A* reached goals ~5× faster than Dijkstra (1.2 ms vs 6.0 ms) by exploring far fewer nodes. The win was search efficiency, not path length: all three found near-identical short paths on these maps — the difference was compute time and nodes explored.
- Three robots reach three goals with zero cell conflicts under reservation-table coordination — the piece that matters for a dark-factory floor.