CS148 Building Intelligent Robots

Week 3 : Sensors Out: 12 Feb 2001

Preliminary Tasks before 14 Feb 2001, 1pm Last week you used the touch sensor for several different tasks. This week you will gain practice using the other sensors (light and rotation) included in your kit. There is no reading this week.

Lab 3: Sensors 14 Feb 2001

It’s difficult to measure the distance of a path on a map because the path often meanders instead of following a straight line. In this lab you will build a measuring device that allows you to find the distance between two points on a map by rolling it along a path between the two points.

Step 1

First build the robot. It should have one wheel, attached to a rotation sensor through a gear train, which can be manually rolled along a path. You’ll be using the rotation sensor to measure the distance traveled, but it doesn’t make very precise measurements so you should gear it down. The brick doesn’t need to be a part of the tool itself, but can instead just be connected via a long wire attached to the rotation sensor. Also, you should have a touch sensor attached to the brick (so that you can reset the distance).

Step 2

The view button is a useful debugging tool. You can use it to determine the current values that the sensors are reading (the program can be running, but it doesn’t have to be). Pressing it will cycle through the inputs (1, 2, 3) and outputs (A, B, C) and display a value, either the input to the sensor or the output to the motor.

To use it, you must first write and download a program that uses the sensor you want to test. Do this with a simple program, and then experiment with the rotation sensor and the values it registers.

Step 3

Now write the program. The RCX should display the distance in some standard unit. Don’t forget about using the touch sensor as a reset button.

Project 3: Sensors due 21 Feb 2001, noon

Specification:

This week you will build a line-following robot that keeps track of it’s position. Chapter 8 of Baum is about the line-following problem, and should give you a good start on thinking about this project. Your robot should be a bit more robust than his though (it should be able to withstand a mild crash and maneuvers on a carpeted surface). You are free to use any and all of the sensors at your disposal, but your robot should meet the following requirements:

• When placed on the test mat, it should first go through a sampling routine to determine the threshold values between black, green, and white on the mat. This is important so that your robot can perform under a variety of lighting conditions without having to be reprogrammed.

• After the sampling is completed, it should wander on the test mat until it finds a dark (either black or green) line. The test area will be surrounded with a short wall, so the only floor pattern that you will have to account for is something similar to that on the test mat.

• After locating the line, it should follow the line for approximately 30 seconds. You can assume that all lines will be continuous (i.e. you won’t have to deal with turning around at the end of a straight line).

• Your robot should keep track of its current position and orientation (relative to its starting point) at all times. When it has completed the line following, it should return to it’s original starting position.

Paper Handin:

Your paper handin should address the following issues:

• Give a general overview of your code and note anything unusual (don’t forget to include an actual copy of the code itself as well).

• Discuss the design of your robot, and include a detailed diagram as you did for the first assignment.

• Explain how you used the sensors to solve the various subproblems — what did you do that was especially interesting or unique?

• Discuss the iterations you went through, both in your code and in your hardware.

Grading:

As in the previous projects, the functionality of your robot and the quality of your paper handin will each account for 50% of your grade.