Specifications
40
Robot. It is in the form of a tight loop main routine that branches out when individual
activities require to be completed. The following outline was created to establish the
necessary activities to be completed in the main loop and the appropriate related
subroutines.
While driving do the following:
•
Read the odometer sensors and increment odometer counters
o Check odometer counters and adjust speed for straight driving
•
Watch obstacle sensors in a tight loop act accordingly when sensors
triggered.
o If left is clear, turn left otherwise turn right
If left and right blocked, reverse
•
Continue on a straight path
•
Output data through serial port for debugging purposes
•
Repeat process continuously
The data will flow as follows, coming from the five IR sensors and being manipulated
and processed to obtain the required drive on the motors. There are four main processes
that take part in this data processing.
Figure 4.17: Data flow for software
Process 1:
This is the main section of the program. It runs a tight loop checking for data
from the sensors on port A and also checking the odometer readings to initiate a
compare function to maintain straight line driving.
PORT
A
Obstacle
Odometer
readings
Process 1
MOTOR
CONTROL
Process 3
Process 4
D1 = Signal of which direction to turn
D2 = odometer counters
D3 = motor information for turning
D4 = motor information for drive straight
D5 = jump to process 4 when required
D2
D4
PORT
G
sensors
sensors
Process 2
D1
D3
D5










