CSCI 108 Labs 9-10


This two-week lab is a continuation of the Trashbot project you started last week. The goal of the Trashbot is to find and move garbage. Last time you used sonar to detect and seek out trash. Now you will add a gripper that will enable the robot to grip and carry away trash.

As before, your robot will be placed on a flat surface, which you can assume to be empty, except for trash in the form of two-liter soda bottles. Your robot must find and remove all of the trash. You cannot assume anything about the starting location of the robot relative to the trash. However, you can assume that the closest objects will be the soda bottles.

A second, but not secondary, goal for you is to write a program that is as elegant as it is correct. Use the feedback you received on Lab 8 to guide you as you rethink your design and implementation.

Building the gripper

You will build the gripper from Lego parts, using a motor to control the open/close mechanism of the device. While you are free to design the gripper any way you would like, I recommend starting with one of the designs in Robotic Explorations by Fred Martin. These will be available in lab.

The gripper does not need to be very strong -- the heaviest item it will be expected to grip is an empty soda bottle. However, it must be quite large. You will likely find it necessary to rebuild parts of your robot to fit this new mechanism onto it.

Remember that sonar will continue to be a vital component of this lab. Keep the sonar device on your robot, but be sure to mount it a reasonable distance away from the gripper. You don't want the gripper to get in the way of the sonar's "chirp."

Writing the program

The trash-finding program you wrote for Lab 8 will serve as a starting point for this lab. Now you will need to extend it to do the following:

As the robot moves toward the detected trash, it should check how far the trash appears to be. When the trash is fairly close (I found 0.5 foot to be a good distance), the robot should move just a little more and close the gripper around it. This will be a good test of how well your robot aims for the detected item.

Once the robot has gripped the item, it should move it forward a bit (the distance is up to you) and should then release it. At this point, it should wait long enough for someone to move the trash out of the way so that it can begin another search for trash.

If your trash-finding program did a good job of hitting trash head-on, then the extensions you need to write for this lab will be minimal. Therefore, you should spend a significant amount of time making your program as elegant as possible. Use the comments on Lab 8 as a guide. Please feel free to ask for clarification of my comments or for additional advice.


Place the robot on a flat surface, where the closest items are the target trash items (i.e., the soda bottles). Remember to move out of the way, so that the robot doesn't detect you.

Is your robot able to aim at the trash well enough that the gripper can get around each item? Is it able to hold on to a bottle reasonably well?


You will need to demonstrate to me that your robot successfully finds, grips, and moves trash.

You should turn in your program. Turn it in both electronically and on paper. Don't forget to put your name on everything submitted. It is particularly helpful if you put your name (or initials) in the name of the file you submit electronically.

This lab must be completed by Thursday, December 4 at 3:00 PM. (Note that this is the last lab period of the semester.)

Extra Credit for Extra Fun

This assignment provides many opportunities for fun extensions. For instance, imagine using the light sensors to find a "trash disposal" area marked in, say, black tape on a white surface. If you have the time and the inclination, dream up and implement extensions to this project. You might want to run your ideas by me first so that we can discuss the feasibility of them.