CS 30 Homework 9 — Robots!

Due by class time Wednesday, May 3
Note: no extensions will be granted; see below.

You may work with a partner on this assignment if you wish.

Create a robot brain called FollowHall.py that follows the hallway in the Pyrobot Simulator's AndrewHallway world, which is a scale replica of the hallway outside of our classroom in Andrew. The robot should move south from its starting location through the hallway, staying as close to the center of the hallway as possible. How will the robot know when it's in the center? One idea would be to compare readings from sensors on the left side of the robot with sensors on the right side, and try to keep them roughly equal. As a reminder, this page has a diagram showing the placement of sonar sensors on a Pioneer. Unfortunately, the robot in the AndrewHallway world (and my own real Pioneer) is equipped only with front sensors #0 through #7, so you won't be able to use the back sensors.

Once your robot can reliably follow the hallway, see if you can get it to turn around when it reaches the end of the hallway and return to its starting location. In order for the robot to know when to turn around, it will need to be able to sense when it has reached the end of the hallway. Here's one idea: once the robot has established itself in the center of the hall, have it monitor its sonars to detect when some of the readings abruptly change. This would indicate that the robot has moved from the narrow hallway into the more open space at the end. At that point, the robot can execute some kind of turning action, then revert to "hallway-following mode" to return to the starting location.

In class on Wednesday, we will test out your brain on the real Pioneer (with 8 sonars) in the real Andrew hallway!

IMPORTANT: To reduce the possibility of damage to the real robot (or the real walls) on Wednesday, you should limit your robot's forward translation speed to a maximum value of 0.5 (faster rotation speeds should be ok, though). Real Pioneer robots weigh around 40 pounds, and can hurt themselves if allowed to run around at top speeds.

Turning in Your Homework

Use /common/cs/submit/cs30-submit to submit your FollowHall.py brain.

If you have questions about anything, let me know.