As soon as the robot would get out of the maze and receive the signal
from the second RCX it would stop and look for the different light
densities around it. We had the robot programmed in way that it would
swipe the visual field around it in a 360 degree angle. It would take a
measurement when facing the brighter signal and also take measurement
for the less bright signal and according to what it has been ordered
to do it would take the each reading rage and then divide that by 3 to
have an accurate median to go to. Here is an example of how it would
work if there was a "gap" between the measurement values.


As you can see through the diagrams if the measurements had sharp and
clear separation between them then it would have been easy for the
robot to detect the clear difference between the sources and choose
the correct destination. But since during the actual presentation the
light sources were set up in a different way such that the brighter
light source would produce a large range span and since the
possibility of having different readings would increase then it would
increase the probability of having the same reading as the second
source and that would make the robot confuse of which one to choose!

The solution that we came up with immediately was to program the robot
in such a way that it would start to swipe the visual field just like
before but this time it would take the optimal reading which means it
would start to read the light density to the point that it would get
its maximum and the way it would recognize that is when after that
reading starts to again change towards the opposite direction (note:
for our reading the "less" value means "brighter" ), so it would pick
up the reading before that change and store that for comparison


Now we will discuss the reasoning behind our decision to use one light
sensor for our robot for our input readings and also use of infrared.

Open loop: 

It was clear from the nature of the project that we were not able to
use the "Open Loop" system structure, mainly because robot needed to
check and re-check our input and output to able to be able to find
its way out of the maze. Since open loop system does not evaluate the
output it is not convenient for us to use!

Close loop:

Feed Back

To use the "Close Loop with Feedback" procedure was our original idea
for the robot to find its way out of the maze. As mentioned in the
hardware section with the use of two touch sensors we were able to
produce this kind of procedure. Robot would first hit the wall and
then through two touch sensors which each were connected to one of the
two motors it would find the direction to move. For example, if the
left sensor get pressed then the procedure was to move back pivoting
on the left wheel by slowing down the left wheel and speeding the
right one and then it would move forward in the new direction with the
same speed for both wheels. Using this kind of procedure was
convenient for the robot to get out of the maze but for the second
part of the procedure which the robot had to recognize the correct
destination by measuring light difference we still had to use the
light sensor. So we used the light sensors and also came up with the
idea of using it for the robot as an "eye" to come out of the maze as

Feed Forward

After the significant changes for the body structure of the robot we
were finally able use "Close Loop Feed forward" to solve the whole
problem. The idea was to use one sensor (i.e. light sensor) for the
whole procedure of getting the robot out of the maze and also leading
it towards the correct "house."  We used the RCX's infrared section to
detect the walls. RCX would send the infrared and it will hit the
black surrounding walls and reflect back to the light sensors. Then
the light sensors would detect the density of the reflection and if it
was above a certain level the robot would not proceed. It would stop
and back up for some period of time and then it would move to the left
and re-send the infrared to check that are for any possible
obstacles. If it would face another wall it would move back and check
the right side until it would find a section of the field which would
reflect less infrared (i.e. open area with minimal reflection) then it
would move forward. This is clearly use of feed forward procedure were
robot is able to detect the obstacles before hand by sending a signal
and receiving the result before hand! This unique design would allow
use to be able to produce much more efficient body and also much more
efficient program for the whole procedure.


Since the behaviour required by this project was bit more challenging
than the first one, we had to test different ideas for both software
and hardware design and that caused us to face shortage of time for
the last part of the program which was the procedure of finding the
chosen distance and proceeding towards it!

Since our robot only used one light sensor, which major function was
to receive infrared radiation from the RCX and be able to choose its
path out of the maze, we had to use the same sensor to measure the
light density when it was out of the maze to be able to choose the
correct "Home" to go to. For the second part of the project we came up
with the idea of measuring the light density of the "brighter home"
and "less bright home" before starting the whole process. This would
help the robot to execute part of the programming which was related to
find the correct destination.