This challenge is to use the line-following PiBot to solve a maze. Instructions on how to create the maze will be provided along with some hints on how to program the PiBot for solving the maze. At the end, race a friend's PiBot and see which one can complete the maze the fastest.
The parts below are required to complete this lesson. Note that all parts except the foam board and clear packing tape are included in the OSOYOO kit that can be purchased on Amazon.
Use small lengths of the clear packing tape to join multiple pieces of the foam board together to make a larger area for your maze. Place the tape on the top of the foam board for one joint and on the bottom of the foam board for the next joint so that you can fold it up like a Z and store it flat.
Use a tape measure to mark each side every 12 inches and then use a yard stick or long piece of wood to draw straight lines all the way across the foam board. Have a friend help you hold the other end of the yard stick or wood while you draw the line.
Start the first line on each side 6 inches from the edge to maximize the number of grid lines
Use the back of the foam board that was used for Lesson 2
Use a website like http://www.mazegenerator.net to help come up with a design. Set the shape to rectangular, the style to orthogonal, the width and height to the number of grid lines on each side, and select the “As Lines” option.
Place the strip of tape on a piece of paper or cardstock with a short piece of tape leading away from it to the edge of the paper so that you can change the start point of the maze. Use Scotch Tape to hold the paper or cardstock to the foam board if needed.
Create the rectangle on a piece of paper or cardstock with a short piece of tape leading away from it to the edge of the paper so that you can change the finish point of the maze. Use Scotch Tape to hold the paper or cardstock to the foam board if needed.
4 pieces of tape that are 6 inches long placed side-by-side can be used to create the rectangle
Select the appropriate link below for instructions to setup the software on the PiBot and hints on how to program the PiBot to solve the maze.
Run the maze solving program that you created and have the robot explore the maze to determine the shortest path from start to finish. Then use a stopwatch to time a second run through the maze to see how fast your robot is. Have a friend try their robot and see whose robot is faster and doesn't make any mistakes. Compare your program to their program to see why one is faster than the other.
To run the PiBot maze solving program that you created perform the following steps
python3 picar-line-maze.py
sudo shutdown -h now