CS460 Project 1

Due: Thursday February 23rd with in class demo and project report. (Note that BSC observes a Monday schedule of classes on Feb21st so we will not meet the Tuesday before the lab is due.)

Overview: This is the traditional line following lab with a couple of twists. You will design and program a robot to search through a maze (essentially a line following lab). Use any method you like to program the robot.


This is your first project and your objective is to integrate sensor input and motor output to perform a simple line following task. Your robot will need to continuously monitor sensors and act accordingly in real time with no external input from you.


Your materials are in a green Lego bin in the cabinet in the back of the lab. The drawers of the cabinet and the bin themselves have been labeled according to groups. Use only the materials assigned to your own group.

You will have an augmented Lego educational set including two touch sensors, two light sensors, the RCX and two motors. Each bin has been supplemented with additional Legos to give you more choice when building your robots. You may find that you have a great idea but just need a couple more legos to make it real. I have a few spare Legos from other kits that I can give out on a  first proposal that shows the needs gets the legos basis. (don't come just asking for lots of extra parts, rather, come with a nearly finished robot and tell me what you need to finish it.

Your group's lab space:

    Each group is hereby assigned a particular lab space according to the diagram below.

Use only the computer assigned to your group. In most cases (unless I needed to check something during the semester) your group only has login privileges on your own computer. These computers are not on the standard bsc network. All of your work is saved locally on your own computer. You are encouraged to save your work on a USB drive or other external storage.

These computers are setup with two drives. Drive one contains SUSE linux and is the one that we will be using for this lab.

Lab Availability:

For those of you who have card access setup (it should be all of you by now), you have access of the lab whenever Moakley is open and theother two classes aren't meeting. (Monday -Wednesday 1:50-3:05 and Tues-Thurs 2-3:15)

Your Task:

Your group will build a Lego RCX based robot that will navigate a maze. Your maze will consist of a colored line on a contrasting background. A sample maze will be provided in the lab to practice on. You should design your robot to navigate the maze as quickly as possible without skipping any of the maze or getting lost and running off of the maze.

On February 23rd each of the 6 groups will demo their robot in class on a new maze that I will bring in at that time. Dead reckoning will not be an acceptable method of solving this task. You will need to use the Lego sensors (Lego light sensors) to navigate the maze.

The software environment:

For this lab we will be using the lejos environment. I will give a brief lecture preparing you on the day the lab is assigned. You will get a brief lecture on Java for c++ programmers and the API provided by the lejos system.

Before you can run your own programs, you must download the firmware (in this case a Java virtual machine for the RCX brink). To do this run the command:


you can optionally use the -f flag to try to download it in fast mode. Please note that the lights in the room often interfere with the download. If you get error messages about failure to download - or other strange messages, then you are probably getting interference from the lights. If your group is the only one in the lab, turn them off (there is one that stays on all the time) and try again. Otherwise take your green bin and turn it over the transmitter and the robot to minimize the interference.

Two well defined error messages are:

When you need to compile your Java programs use lejosc to compile.

lejosc -source 1.2 <filename>

when you are ready to download your program into the robot, turn on your robot and run

lejos <class with main function>

Where <class with main function> is simply the name of the Java class that contains the main function.

Lejos can be found in /opt/lejos_2_1_0/ on the lab machines.

Feel free to take a look as some of the example programs found in the examples directory.

Sensor Calibration:

You are not guaranteed a particular color for the line or the background in the final demo, you are only guaranteed that there will be a contrast as significant as that in the test maze. You should write your program so that you are calibrating the sensors before beginning the maze. Your group will be given a couple minutes to calibrate your robot's sensors before beginning the demo.


The Lego robots run on 6 AA batteries. The school has purchased high capacity rechargeable batteries for use in this class. Make sure not to lose them. Six of these batteries and one rechargeable 9-volt battery has been placed in each kit. The 9-volt battery is needed by the IR transmitter. Please take the batteries out of the robot if your group is not going to be using the robot for more than about 36 hours. (if you leave Saturday afternoon and plan to return Monday morning then fine, you can leave them in, but if you are leaving for the weekend take the batteries out. Remember that you are responsible for replacing any parts that your team might damage.)

When your batteries run out of charge, you will need to recharge them. The 9-volt batteries take about 30 minutes to charge and use the 9-volt charger on the file cabinet in the lab. It used the adapter labeled "AC/DC adapter." Plug the adapter into the outlet, then plug the adapter into the charger. This charger can handle any number of batteries  at once from 1 to its maximum capacity. The indicator light will turn green when the battery is charged. Return the charger to the top of the cabinet when done.

When charging the AA batteries, use the two Energizer rapid chargers on top of the cabinet (along with the two adapters labeled "Energizer.") Batteries must be charged in groups of two in these chargers. The batteries take about 15 minutes to charge.

When you leave the lab for the day:

Remember that this lab is shared with other classes, so when you leave the lab for the day, you must return all of your materials to the cabinet. Make sure that the sample maze is back near the cabinet (but still visible to other groups who might come in later.) Make sure that the battery chargers are on top of the cabinet in the back, and that your robot and parts kit is in your designated drawer. You are responsible if your group leaves your robot out on the table and it gets broken.

Have fun:

Have fun and I look forward to seeing your finished projects in class later in the Month.