Self learning maze robot
- Role
- Solo, course project
- Period
- November 2024
- Outcome
- Maze traversal that improves across runs by recording failed paths
- Stack
- Assembly
- HCS12
- CodeWarrior
Problem
Make a robot solve a maze. Write it in Assembly, on an HCS12 microcontroller, with no operating system, no allocator, and no libraries. Every sensor read, every motor adjustment, and every byte of state is code I wrote.
Solving a maze once is a search problem. Solving it faster the second time is a memory problem, and memory is expensive when you are counting bytes.
Constraints
- Assembly only, on bare metal.
- Fixed sensor hardware, and sensors that are noisy at exactly the moment the decision matters, which is at an intersection.
- Real time. The control loop cannot fall behind the wheels.
What I built
Intersection detection from sensor input, which is the point where the robot has to decide rather than just follow. Real time motor control feedback loops that correct drift continuously rather than assuming the last command worked. Path learning: the robot records the turns that led to dead ends so later runs stop repeating them, which is what makes the second traversal faster than the first.
Debugging was split between CodeWarrior simulation, where I could step through the control routines, and hardware runs, where the sensors behave the way real sensors behave.
Decisions and tradeoffs
Learning from failure rather than mapping the maze. Recording which turns dead ended is much cheaper in memory than building a map of the maze, and on this hardware memory is the binding constraint. The tradeoff is that the robot never knows the maze, only which of its past choices were wrong, so it improves without ever being optimal.