![]() |
Programming the MicroMouse, especially the navigation routines, turned out to be the most time-consuming task of all. When it was finally complete, the program had the following features:
We programmed our MicroMouse using the Interactive C (IC) language. Interactive C is a programming environment originally created for the MIT LEGO Robot Design Contest. It is a multitasking C language based compiler designed to run on boards based on the Motorola 68HC11. One of the best features of Interactive C is that the compiler and debugger are integrated into one package: individual expressions can be typed at the commandline where they are instantly compiled and executed immediately by the controller board. This made trying out expressions easy without having to compile and download an entire program. The program also includes some convenient built-in routines for printing to the LCD screen, operating motors and accepting user inputs through the pushbuttons.
Dexter's maze solving algorithm is based on the "modified flood-fill" routine. The flood-fill algorithm involves assigning values to each of the cells in the maze where these values represent the distance to the destination cell. The destination cell, therefore, is assigned a value of 0. If the mouse is standing in a cell with a value of 1, it is 1 cell away from the goal. If the mouse is standing in a cell with a value of 3, it is 3 cells away from the goal. Assuming the robot cannot move diagonally, the values for a 5X5 maze without walls would look like this:
When it comes time to make a move, the mouse looks for a neighboring cell with the next lowest number. By following the numbers in decending order, they lead the mouse to the destination cells. You can find a more detailed explanation of the flood-fill algorithm in the software section of the introduction. |