RoboLab #2

Using the LightSensor


810:161:02, Artificial Intelligence RoboLab

Fall Semester 2006


Due: Monday, September 18, 2:00 PM


Introduction

In this week's lab we will begin to consider robots who detect their location in an environment through the use of a light sensor.  Thus, you should begin by removing the double bumper configuration from your RoverBot and installing the light sensor configuration that you were to construct in Lab0.

You will be required to write in leJOS and submit two different yet simple programs.

Program 1 : Boundary Detection

ENVIRONMENT : A flat surface with a "floor" of relatively uniform color.  This color can be either relatively light or relatively dark.  Additionally, there is a boundary or "warning track" consisting of a band of color at the opposite end of the brightness spectrum from the floor (dark-on-light or light-on-dark).

GOAL : "Freely" move about but remaining within the bounds of the environment.

DETAILS :  One way in which a robot to sense its "location" is to use the concept of a "warning track" -- think of a lawn mowing robot that senses a buried wire.  That is, the robot moves about the environment until it senses that it has encountered the warning track.  At that point the robot would perform some sort of response which would ensure that the robot remains within the boundaries of its environment.

For this program, you will be creating a boundary detecting robot using the light sensor.  For original testing purposes, you may use your Test Pad and you may assume that the environment has a light (white) floor with a dark (black) warning track.  However, your finished code should allow for the environment to have the opposite configuration.  That is, I might put some light masking tape on a dark table and use it as a larger testing area (probably with an irregular shape).

There are at least three ways in which your robot can decide whether it is avoiding a dark warning track or a light warning track. 

  1. You could allow for a boolean variable in your code which is set just prior to download to the RCX.  This is the most restrictive technique because it requires you to redownload the code if we change environments.  However, it is probably the easiest and I WILL accept it. 
  2. You could allow for a boolean variable in your code which is set via input on the RCX brick.  Using this technique you would have your robot wait for user input via the buttons on the RCX panel before the robot begins movement.  You might have one button mean dark floor while a second button means light floor.  Or, you might have one button be a toggle button (perhaps with the display showing which value has been entered) and a second button mean "use this setting."   This is probably the most complicated of the three techniques (because you have to figure out button I\O) but it could be a heck of a lot of fun if you want to play around for a while.
  3. You may sense the color of the floor when the program first starts running, and avoid significant light shifts toward the opposite end of the brightness spectrum.  Using this technique requires making the assumption that the robot is placed within the environment at start up but that fact is given in the environment description above.  This is probably the best solution in that it allows for your robot to be truly autonomous (no need for input from a controlling human).

Program 2 : Line Follower

ENVIRONMENT : A flat surface with a line or "track" of uniform color and surroundings which are relatively distinct and at the opposite end of the brightness spectrum from the track (dark-on-light or light-on-dark).  The width of the track will be ~ 1 inch.  The track will only make "curved" turns (no true right angles to worry about).

GOAL : Follow the track.

DETAILS : Many simple robots are designed to navigate their environment by following a path on the floor -- ever seen a mail delivery robot?  By keeping a sensor relatively centered over a "track" the robot is able to effectively navigate its environment.

For this program, you will be creating a line following robot.  As with the previous program, you may begin by having your robot follow the dark track provided on the test pad.  However, your final robot should be able to also handle a white tape track placed on the back table.  Once again, you may use either of the three techniques discussed in program 1.

Your robot may assume that it is placed on the track to begin with and that it is placed "relatively parallel" to the direction of the track (that is, it won't be placed so that it immediately moves off the track).  It should then proceed around the environment following the track.

Do not hard code assumptions about the shape of the track.  For example, your finished robot should be able to navigate the test pad track in either direction.

Deliverables

By the due date and time, submit the files:

via the electronic submission system.  You will also need to prepare your documentation packet following the homework collection policies.