F. improving the maze-solving code – Pololu 3pi Robot User Manual

Page 39

Advertising
background image

The last dead end gives us the sequence ‘SBL’, which reduces to a sigle right turn ‘R’. Our action list is now just ‘R’
and represents the shortest path from start to finish.

As we drove the maze, our action list would have looked like the following:

1. L

2. LS

3. LSB

4. LSBL => LR (pruning occurs here)

5. LRB

6. LRBL => LB (pruning occurs here)

7. LBL => S (pruning occurs here)

8. SB

9. SBL => R (pruning occurs here)

8.f. Improving the Maze-Solving Code

We have gone over the most important parts of the code; the other bits and pieces (like the function display_path(),
the start-up sequence and calibration, etc.) can be found with everything else in the folder

examples\atmegaxx8\3pi-

mazesolver

. After you have the code working and you understand it well, you should try to improve your robot to be

as fast as possible. There are many things you can do to try to make it better:

Pololu 3pi Robot User's Guide

© 2001–2014 Pololu Corporation

8. Example Project #2: Maze Solving

Page 39 of 63

Advertising