Project: Obstacle Avoidance
Project Description
You will write a program governing robot behavior so that it avoids obstacles. Since one obstacle might be boring, you will also make the robot do something novel when it has been repetitive and dance every so often because life is too short not to.
Working in pairs, you will develop a program that includes these elements:
- The robot should move so as to avoid obstacles in the room.
-
If the robot performs the same two turns in a row (e.g. two right
turns), the robot beeps and turns for a second or two (before
performing any further movements).
- Note: The beep/turn around activity applies only when there are two turns, so going forward or backward twice in a row does not count!
- The turning that accompanies a beep should not count as an action.
- To accomplish this requirement, you likely will need at least one variable that keeps track of the previous robot activity. This variable is updated after each action. After a turn left or right, this variable can be consulted to determine if the previous action (turn or movement) was the same type of turn.
- Every ten actions, the robot performs a short dance three times in a row (the dance can just be a few actions).
- The program contains at least one
ifstatement. -
The program contains a
switchstatement or a secondifstatement. -
The program contains at least three loops; at least one must be
a
forloop, and at least one must be awhileloop. - The program uses eSpeak to announce each time it turns, each time it moves forward or backward, and each time it performs its short dance after ten other actions.
Note: The robot's motion need not be continual; you can interleave short motions with sensing operations.
Together with the program, your commentary must describe what steps are needed to demonstrate the program is working correctly (this can be pseudocode).
Project Notes
-
Beeps during the "moving about"/"avoid obstacles" phase should not
count as actions. Thus,
right right beep/turn right
would be followed by a beep and that sequence contains only three actions. - The robot need not beep if there are two same turns in a row during its dance; it only needs to beep during its "moving about"/"avoid obstacles" phase.
- The robot need not avoid obstacles during its dance.
- The robot should keep executing the behaviors until the program is terminated.
Grading
In addition to the general grading guidelines for evaluation, the project is worth 25 points.
- [4 points] Program guides robot through a sequence of moves
- [4 points] Robot avoids obstacles encountered
- [4 points] Robot beeps and turns if it performs two turns in a row
- [4 points] Every ten actions, the robot performs a short dance three times
- [3 points] Uses eSpeak to identify actions
- [3 points] Uses at least two
ifstatements or oneifstatement and oneswitchstatement - [3 points] Uses at least three loops (as specified)
-
Comments on Program Format, Comments, Readability, etc.
(Points not given, but points can be deducted.)
A five point penalty will apply to any submission that includes personally identifying information anywhere other than the references/honesty file.
