Project: Obstacle Avoidance
Project Description
You will write a program avoid.c 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 consecutively
(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 displays an indicative message 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 narrative, pseudocode, or a combination).
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.
Obstacle Avoidance
Here are a few tips for getting better obstacle-avoiding behaviors from your robots:
- Move forward, but not too far before taking another sensor reading.
- Consider the magnitude (and direction!) of the angle turned when a sensor indicates an obstacle is present.
- Take multiple sensor readings (the MyroC library can return averages) to get more reliable results.
Grading
In addition to the general grading guidelines for evaluation, the project is worth 25 points.
- [3 points] Program guides robot through a sequence of moves
- [3 points] Robot avoids obstacles encountered
- [2 points] Robot beeps and turns if it performs two turns in a row
- [2 points] Every ten actions, the robot performs a short dance three times
- [2 points] Terminal display identifies actions
- [2 points] Uses at least two
ifstatements or oneifstatement and oneswitchstatement - [3 points] Uses at least three loops (as specified)
- [8 points] Testing
- [2 points] Test plan enumerates problem circumstances
- [2 points] Test plan lists cases with expected outcomes
- [1 points] Transcript records compilation and test runs
- [3 points] Summary statement describes outcomes and explains why the program behavior is correct
-
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.
