Lego+Mindstorms

Once again, this environment allows you to graphically drag and drop pieces to create your program. You are going to spend about one week getting to know the Lego Mindstorm Robot. You will be working in groups of about 3 or 4 (depending on the student to robot ratio). You can begin by simply playing around with the robot and getting an idea of what it can do. Once you are feeling comfortable, you need to complete the following assignment.

=Security Patrol Robot=

Robots are frequently designed to perform dangerous and/or boring, repetitive tasks. An example is a security patrol robot, which patrols a specified area. This task can be dangerous if the area is breached, and boring if it is not!

Problem
Your job is to program a security patrol robot, to patrol a specified rectangular area. The area will be marked off with black lines at the top, right and bottom edges. Your robot should patrol the area as shown in the diagram below:



Note that your robot may be placed anywhere within the rectangular area to begin its patrol, but you may assume it will be placed facing the vertical line on the right side. Note that there is no black line on the left side, so the robot must remember how far it went in the right direction, to move the same distance when returning. When the robot reaches the horizontal black line on the top or the bottom of the area, it should start patrolling in the opposite direction (i.e. if it is patrolling downwards, then once it meets the bottom horizontal line it should start patrolling upwards, until it meets the top horizontal line, etc.).

If at any time the robot comes into contact with an intruder (touch sensor pressed), it must sound an alarm (you decide on an appropriate sound), but must not stop patrolling as it does so. You will have to figure out how to attach both a light sensor and touch sensor to your robot at the same time!

You will need to use a variable for this program.

Assignment from the [|Capilano University OpenCourseware Mindstorm course]. Feel free to check out their site for more notes/tips on your robot.

Optional - Robot Wars...
If there is time, we will do the classic battle.