One of the remaining sensors that we have yet to use is the IR sensor. The IR sensor detects infra-red light levels. An example of infra-red light is the signal emitted by your TV remote control at home.
In this task, your robot, or your partner wearing the garment, will walk across a arena with some boxes in it. The arena will look something like this:

The number of boxes will be set by the TA, and will be given to you at run-time. Therefore, one of the first things that your program should do will be to ask the user for the number of boxes on the arena.
As shown in the diagram, some of those boxes will be emitting infra-red lights. Your robot (or your partner) will walk from one end to the other of the arena.
As he/she/it is walking through the arena, he/she/it will pass in front of the boxes. When he/she/it is passing in front of the box, two things need to happen:
When the robot/your partner gets to the other side of the arena, the TA will turn off the IR lights. He/she/it will then have to turn around 180 degrees and walk back across the arena. When he/she/it passes in front of a box, the following should happen:
(Added on 20/10/2009: For robot groups, you have two choices: your robot can either signal that it needs to be turned 180 degrees when it reaches the other side of the arena, and you can turn it manually; or (for extra credit) your robot can make the 180 degree turn by itself.)
When the robot/your partner has crossed all the way back across the arena, then the program should print out:
You probably know that if you're a robot group, the way to find out whether your robot is crossing in front of a box is to see whether it's crossing over a black line. If you're a garment group, you have two ultrasonic sensors; we will be using A4 boxes and placing them on the desks in the lab. Place your ultrasonic sensors accordingly.
You will need some variables to store the status (emitting IR) of the boxes. I would suggest that you use a list for this. Remember that you can make a list longer by multiplying it with an integer. You can figure out yourself what to store inside your list.
To accurately count the number of boxes, your program will need to remember your current state -- that is, whether you are currently in front of a box or not. Then it should make changes to your current state depending on the signals that it's receiving from your sensors.
For example, if you're a robot group, your logic should go something like this (garment groups adjust accordingly):
You may wish to add in a calibration step if you think that it is necessary (it probably will be for robot groups, garment groups may or may not need this step). If you choose to add this step, your program should display this on the screen. For example, it might say:
Calibrating: Show me the black line and press enter. Stored light level of black line. How many boxes are there on the arena? 9 Walk to the start point and press enter on the keyboard.
For robot groups, we know that going in a straight line is difficult, therefore, we're setting the maximum length of the arena (distance between the first and last boxes) to be 1.5 meters.
Your program should be called IRDetector.py. It is due before 7am, Thursday November 5, on WebCT. The demos will take place during that same afternoon. Both of you need to come for the demo. We will be asking you to demo the version of the program that you uploaded to WebCT.
This is to remind you that COMP 201 has a strict no-cheating policy. The penalties for cheating are on the course webpage. Please reread those policies -- don't say that we didn't warn you!