Code: Select all
1. The Robot will roam randomly inside an arena which is defined by a
coloured boundary.(color : green) The robot should have an automatic calibration
mechanism that allows you to quickly calibrate the light sensor using
the buttons on the front of the robot.
2. If the robot encounters the arena perimeter it must backup and then
turn randomly and head off in another direction.
3. The robot must, while inside the arena, avoid obstacles that are placed
in the arena.
4. The robot must perform these operations for 1 minute at which point it
must stop and display some statistical results (as detailed below)
collected while roaming.
NOTE: The readings must be taken at 1 second intervals unless the
Robot is manoeuvring, in which case logging can stop until the
manoeuvre is complete.
OUTLINE OF THE PROGRAM
------------------------------------------
Sensors declaration
task main
declare variables
wait 1 sec
while true
int random roaming variables declaration
During 1 minute : - read all sensor's values every sec
- if sensor value light = silver or black : motors = random values for 1sec
- if sensor value light = green : stop stats counting backoff , turn randomly, head off in another
direction, continue stats counting.
- if sensor value sonar detects object : stop stats counting, count 1, obstacle,
backup , turn randomly, head direction, continue stats counting.
After 1 minute : - stop
- display "run complete"
- display max and min values for each sensor
- display tot number of readings taken
- wait a bit
- display a graph
5. Statistics
a. While roaming you must take a reading of how much:-
i. Light is reflected by the surface of the arena.
ii. Background noise there is.
iii. The distance an obstacle is in front of the robot
b. On first stopping the robot must display a screen stating that the
run is complete and the maximum and minimum light, sound
and distances read during the run and also the total number of
readings taken (NOTE: this will vary based on how many times
the robot avoids an obstacle and the arena perimeter).
c. The statistics must then be displayed as a graph (The type of
graph is up to you) with the sensor reading type displayed in text
across the middle of the graph.
d. On pressing the right arrow key the screen must change to
display the graphs one at a time. There should be two graphs for
each sensor displaying:-
i. Readings in the sequence read during the run for: Light,
Sound and Distance.
ii. Readings sorted in ascending order for Light, Sound and
distance Distance