CS 363: Assignment #3


For this assignment you will implement three algorithms, adding in the Laser as one of your sensors. The laser enables you to be more precise than sonars or IRs.


The laser is situated on the front of the robot's base, pointing forward. It senses surfaces that are approximately as high as the robot base with 681 separate measurements spread over 240 degrees.

To use the laser, you will need to link to a Laser library built on top of the Player robot package. In your code, you will create a Laser object, tell it to connect to the Laser, and then use the object to update the readings and access the current values. The API is given below.

Laser(void)Create a Laser object
connect(void)Connect to the Laser device
disconnect(void)Disonnect from the Laser device
update(void)Grab the latest readings from the Laser device
count(void)Returns the number of laser readings
minAngle(void)Returns the angle of the rightmost measurement
maxAngle(void)Returns the angle of the leftmost measurement
float value(int index)Returns the distance in mm for the selected reading
float angle(int index)Returns the angle in rad for the selected reading

Player is a general robot interface package that can be used to control or listen to many different types of robots and devices. Before you can use the laser, you will need to run the player server. In an empty terminal, run the following command. To kill the server, just use ctl-c.

player /usr/local/etc/player.conf

The following tgz file contains a simple example of connecting to and reading from the laser. Download and expand the file (tar xvfz laser.tgz) and then type make lt. Start the player server in a separate xterm, and then run the lt program (./lt). It should spit out a sampling of the sensor responses from left to right as you face the robot.



Do each of these tasks with a partner. Incorporate the laser into your code, but do not rely on it alone for obstacle avoidance. It's good, but it doesn't see behind the robot.

  1. Have the robot orient itself towards the nearest flat surface of some minimum extent. The kind of behavior it should exhibit is to turn towards a flat panel held up near the robot.
  2. Have the robot track a flat surface and maintain a specific distance from it. The robot should follow you around the lobby if you are holding a flat piece of whiteboard, or even a large book. Once the robot has tracked on to an object in front of it, try to keep it from being distracted by other objects that may come close on the side or back. Make sure the robot stops if it is about to run into anything.
  3. Write a program that enables the robot to follow a wall (pick right or left wall following). You can assume it is just a straight wall with no corners. If the wall disappears, or an obstacle appears in front of it, the robot should stop and the program terminate.



The writeup for each project should be a brief summary of what you did along with some code examples, terminal output, or screen shots, depending upon the assignment. Please organize the writeup as follows.

  1. Title of the project and your name
  2. An abstract describing what you did in 200 words or less.
  3. A brief description of code you wrote and experiments you ran.
  4. Results.
  5. A brief description of what you learned.


Make your writeup for the project a wiki page in your personal space. If you have questions about making a wiki page, stop by my office or ask in class.

Once you have written up your assignment, give the page the label:


You can give any page a label when you're editing it using the label field at the bottom of the page.

Do not put code on your writeup page or anywhere it can be publicly accessed. To hand in code, attach it to an email and send it to the prof or else put it in the private subdirectory in your Courses folder.