User Tools

Site Tools


pibot:challenge1

Objective

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.

Parts Required

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.

  1. Assembled PiBot from Lesson 2
  2. 3cm Wide Black Tape
  3. 3/16 inch thick White Foam Board or Corrugated Plastic Yard Signs
  4. Clear Packing Tape

Challenge Setup

  1. Draw a grid with lines 12 inches apart on the foam board with a pencil\

    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

  2. Design a line maze that will fit on the grid drawn on the foam board

    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.

  3. Lay out the maze on the foam board with the black tape as shown below

    Follow the pencil grid to keep the lines of tape straight

    Start the lines on the intersection of the first pencil line from the edge of the foam board

    Layout Maze

  4. Place a 6 inch long strip of the black tape across the end of the line at the start point of the maze as shown below

    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.

    Starting Line

  5. Create a solid black rectangle that is at least 6 inches wide and 4.5 inches tall across the finish point of the maze as shown below

    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

    Finish Box

  6. Turn the PiBot on and place it so that the wheels are on the black tape of the starting line as shown below

    Place PiBot at Starting Line

Software

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.

The Challenge

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

  1. Open a terminal in Visual Studio Code from the Terminal→New Terminal menu
  2. Enter the following command to make the PiBot solve the maze

    python3 picar-line-maze.py
  3. Reset the PiBot to the start of the maze for the second run and time how long it takes with a stopwatch
  4. Hold down the control + C keys to stop the PiBot if necessary
  5. When you're finished with the challenge enter the following command in the terminal to shutdown the PiBot

    sudo shutdown -h now
  6. Click on the small green rectangle in the bottom left corner of the screen and select “Close Remote Connection”
  7. Wait 3-5 minutes for the green light on the Raspberry Pi to stop flashing and turn off the switch on the PiBot battery
"“Worthy are you, our Lord and God, to receive glory and honor and power, for you created all things, and by your will they existed and were created.” - Revelation 4:11"
pibot/challenge1.txt · Last modified: 2022/10/20 21:53 by 127.0.0.1