CS 363: Assignment #3

Robot Control

For this assignment you'll implement some simple programs to move the robot smoothly to a location, and to control the position or orientation of the robot in response to its sensors.


Tasks

You should probably develop these algorithms using the simulator, then move them over to the robot. If you want to start working with one of the Magellans, that's fine. You'll probably want to write your code using some #if statements so you can easily switch from the simulator to the Magellan platform. For example, when connecting to the robot, you could use a statement like the following.

#if NOMAD
  connect_robot( 1, MODEL_SCOUT2, "/dev/ttyUSB0", 38400 );
#else
  long State[NUM_STATE];
  connectRobot( State, MAGE_MODEL_MAGELLAN, (char *)"/dev/ttyUSB0");
#endif

There are a few other differences.

Compiling for the Magellan is slightly different. You'll need to check out the Mage directory from the CVS repository on balin, compile Mage, and then use g++ to compile your code and link in the Mage library. Then just run your program.

$ cvs -d usr@balin.cs:/export/cvsroot checkout Mage
$ cd Mage
$ make
$ cd ..
$ g++ -o myprog -IMage/include myprog.c -LMage/lib -lMage -lpthread -lm
$

When you are using the Magellans, it is useful to create a set of virtual sensors that combine the readings from each sonar/IR pair. Don't just take the minimum reading, because the maximum IR reading is farther out than the minimum useful sonar reading.

Do each of these tasks with a partner.

  1. Have the robot orient itself so the three front sonars have the minimum average distance of any three adjacent sonars. The kind of behavior it should exhibit is to turn towards a flat panel held up near the robot.
  2. Have the robot maintain a distance of 1m from whatever is directly in front of it. You probably want to make some use of the two sensors to the side, such as using their value if they are closer than the front sonar.

    Since the robot is moving around in this task, you need to incorporate general obstacle detection. Have the robot come to a stop if it cannot maintain the distance from the object in front because of an obstacle in the rear or to the side.

  3. Combine the above two capabilities so the robot tracks a flat object and maintains 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.
  4. Write a program that enables the robot to follow a wall (pick right or left). 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.

Extensions


Writeup

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.

Handin

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:

cs363f09project3

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.