Project 2 : Lego Robots
DUE IN CLASS DEMONSTRATIONS IN CLASS May 17th
PROJECT DELIVERABLES ARE DUE IN CLASS on May17th
Background
Our Project 1 Agent existed in a simulated environment, robots (i.e. Lego Robots) interact in the real world with sensors and actuators.
Materials and Resources
You will receive an already build go-bot (here are the plans and alternate configurations). The class will have a pool of parts and sensors to use to re-configure the robot.
The Agent's Page (ideas and alternate robot configurations).
NQC (Not Quite C's) current web-page.
NQC Code Samples (from the Tutorial)
Getting Started Lab (5 points)
We will start by working on this begining Lab.
Here is the basic.nqc code to start with.
1. Create a folder called cis32 on the desktop of your laptop. Copy the contents of the cis32 folder from the USB (that I pass around in class) onto your computer.
2. Make sure that your communication tower is plugged into one of the USB ports on the back of your laptop.
Double-click on the MacNQCX to run the NQC IDE.
Go to Preferences->Communications
Set the Port to the Lego Command Tower.
3. Try compiling, downloading and running the basic program.
Choose which Program Slot to download to: in the tool bar, change the selection that currently says "FP" to 1
The RCX stores programs into different slots; when you download the program be mindful of the slot you are downloading. When you run a program on the RCX - you might be running a different program in a different slot.
Choose Program->Compile and Download, to download your program onto the RCX (into the slot you had selected). There is also a button in the toolbar for Compile and Download (it looks like a little binary button).
To run your program, press the run button on your RCX (Make sure you are in Program Slot 1). Alternativly you can hit the Run button in the toolbar to start that program on the RCX.
The sample basic program should start by going forward until the touch sensor is pressed, then the robot will back up for 3 seconds (i.e. Wait(300) where every tick is a(1/100) of a second), then it will turn for 3 second and then it will go forward again. Make sure your robot behaves in this way. If it does not begin by going forward, then you can reverse the leads going from the motors to the RCX. In other words, if the wires coming out of the leads attached to the RCX are facing out, then rotate each square connector piece so that the leads are facing in.
4. Create basic2.nqc by copying basic.nqc. Modify the new program so that the robot goes forward for 5 seconds and then stops completely.
5. Create basic3.nqc by copying basic2.nqc. Modify the program so that the robot goes forward for 5 seconds, then stops until the touch sensor is pressed, then goes backwards for 5 seconds and then stops completely.
6. Create basic4.nqc by copying basic3.nqc. Modify the program so that the robot goes forward until it drives over a black line, then stops completely.
7. Create basic5.nqc by copying basic4.nqc. Modify the program so that it follows a black line taped to the floor. Here's a hint: you are really following the edge of the line, where black meets white. You can follow either the left or the right edge of the black line.
Zip up the programs and drop them on the USB drive.
Part A : Line Following and Discovery (15 points)
You will have to build a robot which follows a line, detects obstacles (and backs up when it hits an obstacle) and can detect various coloured regions that the line passes through.
The course will look similar to this
The course is built on white foamcore, and the line is "drawn" with black electrical tape. There are figures "drawn" in green tape and aluminum foil. All of these elements give different readings on a light sensor, which you can discover experimentally
At the end of the project these robots will compete over this kind of course; the aim is to complete the course in the minimum time.
Doing badly in the competition will not hurt your grade for the project, but doing well in the competition may increase your grade for the project.
The robot control programs should be written in the "stimulus-response" style we discussed in Lecture 3.
Competition details
The following notes should be consulted in conjunction with the line following course.
They describe the procedure that will be followed during the competition.
1. Place the robot at the end of the black line where the line touches the edge of the board.
2. Let the robot start line-following and start timing.
3. At some point between the third and fourth corners place an object (for example a box).
4. When the robot touches the object, it should stop, back up slightly and wait
5. When the robot has stopped after backing up, remove the object.
6. When the robot reaches the green figures it should play a sound.
7. When the robot reaches the silver figures, stops, and plays a second sound (to show it recognises the silver patch) stop the clock.
NOTE:
* Each robot has a maximum of 5 minutes to complete the course.
* If you touch the robot at any point on the course after the clock has started, that attempt will immediately be given a time of 5 minutes.
* If the robot leaves the board, then that attempt will immediately be given a time of 5 minutes.
* If no robot completes the course in 5 minutes, the robot that gets closest to the end will be adjudged the winner.
* If the robot does not play a sound when it crosses the green patch, it will have 2 minutes added onto its time.
What you have to hand in
Submit report should be 2-5 pages long, and should describe the design of the robot and the design of the code which controls the robot. Give good explanations as to why you amde
In addition to the 2-5 pages of report, you must submit a ZIPPED version of your code properly commented (I expect to be able to understand exactly what the code is doing from the comments).
Part B : Search and Mapping
Depending on how we do on Part A, we will work on Part B. This might become an extra credit option to those who want to bolster their grades.
I will hide a Coke can (i.e a red obstacle) and a Mt. Dew can (i.e. a green obstacle) in the classroom. Your robot's task will be to systematically search the room and find both of the cans and then plan a route from the Mt. Dew can to the Coke can. Then you robot will execute the route, if obstacles appear in it's path, then the robot will have to re-plan the route from Mt. Dew to Coke.
To aid your robot, an evenly spaced grid of lines will be provided, to allow for a network of lines for your robot to follow.
(Once Part A is complete I will give more details on the grid - more TBA).
updated 4/21/2007