The Endless Square?

 

Write a program that makes your rover drive in an endless square of approximately 2 feet per side. Your rover can make either left or right turns at the corners. It is okay if your rover deviates from the square due to asymmetry in motor power. You will deal with accurately controlling your rover in a later problem.

 

  1. Write the program using a loop and Wait statements to time the length of the drives and turns.
  2. Modify your program so it uses loops, exit when, and the rotation sensors instead.

 

Hints:

·        You might want to take a look at the “parked-in” demo from Lecture  C4

·        The solution from Problem C5 may also be useful.

·        The solution for B will have two loops in another loop.

 

Team Demo: You will need to demo your rover to a TA. Show that it completes at least one “square” (drive, turn, drive, turn, drive, turn, drive, turn) using either code from A or B. Make sure your team gets checked off.

 

Turn in: Each team member needs to turn in: a hardcopy of the team’s code for A and B as a “Listing.” What are the Preconditions, Postconditions, Inputs, and Outputs? It is okay to put None.