This robot solves simple mazes by just keeping its 'hand' on the left wall
How does it work?
BERTIE senses the maze walls using infra-red sensors.
It has three sensors measuring the distance to the left hand wall,
but they work like one
sensor, giving a distance of:
TOO_NEAR
OK (between two and three centimetres)
TOO_FAR
or, if they can't detect a wall at all:
DISTANT
It tries to keep the distance to OK
It also has front sensors
If it detects a wall in front it turns right 90 degrees
If it detects open space it turns left 90 degrees
The program is technically a state-transition system
Basically, for each combination of the
state of the sensors and the state of the robot
an action sequence is defined.
Each action in the sequence is either to move forwards, turn, or set the robot state.
The initial state is 'Looking' (for the maze entrance), but subsequent states are just text and
could be anything the programmer finds useful
Distance forwards is measured in millimetres.
Distance to turn is measured in degrees.
So the first line means:
If:
FRONT_OFF - the front sensors detect nothing
LEFT_TOO_NEAR - the side sensors detect that the robot is too close to the left hand wall
STATE_Looking - the robot is looking for the start of the maze
Then:
STATE_Opening - the robot needs to open a bigger gap between itself and the wall
veerright_4 - turn right 4 degrees
forwards_10 - move forwards 10 millimetres