Designing KraftMouse is a one of kind system in programming. The
beauty of Kraftmouse's design is that only one kind of input, light
intensity, was used. This unique and simple design forced the
KraftMouse team to do as much as possible with the control software to
take advantage of only one input. So it became important for the
control software to be flexible and powerful - more flexible and
powerful than the standard Mindstorms graphical development
Truly the most powerful system available for the RCX is the embedded
operating system kernel and cross compiler set called legOS. Developed
by Lego enthusiast around the world, this system provides a full C
compiler and rudimentary operating system kernel for the RCX as well
as some tools to download programs onto the RCX unit via
infrared. Briefly, this system supports an impressive set of features,
including 32k RAM for programs and data as well as complete access to
the 16MHz 8bit Hitachi CPU and all connected devices. More details of
this wonderful tool are available at the project's homepage: http://www.noga.de/legOS/. Unfortunately
getting a legOS based robot to communicate with a regular Mindstorms
IR system is quite complex, so in the end this system was abandoned.
Not Quite C
Not Quite C (NQC) is a simple C-like language that provides access to
many of Mindstorms more useful functions without breaking
compatability with other Mindstorm robots. Unfortunately, it also has
many of Mindstorms annoying drawbacks. Lego chose to implement its
system as a program interpreter that runs as a program on the
RCX. Without going into too much detail the results of this
architecture discision is that Mindstorm programs have a limited size
(6K) and can use only a few variables (16). Fortunately, this proved
sufficient for KraftMouse's purposes. More information can be found at
the NQC homepage:
Two Light Sensor Design
As described in the hardware section, KraftMouse initially had a two
light sensor design. The Valentino Braitenberg VEHICLES inspired the
design. Essentially, four tasks were set up, with two global
variables. Analogous to an organism with left and right eyes, left and
right legs and left and right neurons. The eyes would set shared
variables according to the measured intensities on their respective
sides. The leg's would read these values and set the speed of their
motors in proportion to these values. Certain thresholds were
determined such that if both eyes read sufficiently bright levels
KraftMouse would backup and spin to face right a predetermined amount.
Two Touch Sensor System
With the advent of less reflective walls the above two light sensor
design was discarded and replaced with a two touch sensor system. At
first the program was kept as close as possible with the light sensor
program. When a touch sensor was touched the robot would reverse the
corrisponding motor for a preset amount of time. In order to navigate
around corners and ultimately escape the corridor, the left touch
sensor would reverse the left leg longer than the right. This system
proved very effective for navigating the corridor.
Barrier Detection System
When the IR based barrier detection system was developed, it was
decided that in the interest of simplisty and elegance the touch
sensors could be removed. This of course meant that the left right
contrasting architecture would have to be replaced. In order to
navigate the corridor a very simple locomotion algorithm was used.
In order to increase the accuracy of the Barrier Detection System
(BDS), KraftMouse was also updated to take single steps instead of
continuously moving. After each step it would make its decisions and
readings while stationary.
- Is there a barrier in front?
- Yes. Is there a barrier to the left?
- Unknown. Turn left.
- Yes. Turn right.
- No. Turn left and advance.
- No. Go forward.
The development and refinement of the BDS system took a lot of time
and it did not leave much time to make the house choosing algorithm
due primarily to time constraints. As originally intended the BSD
would detect whether a barrier or a building was in front of it. The
original idea was that once the presence of a building was determined
a light level reading could be made. Unfortunately this system only
worked on the dim house, as the brightness of the bright house
overloaded the BDS system.
However, due to the increased accuracy that NQC gave with its light
level readings, the two houses could be isolated based on their
respective light ranges. KraftMouse would sweep left until a light
level was found within the range of the target house. In addition in
order to avoid collision with the corridor structure while looking for
the houses, the BDS system was used to backup KraftMouse whenever a
barrier was detected in front of it.
Aside, a light calibration step was installed into our program. Before
setting KraftMouse on its journey to find a new home, it was necessary
to calibrate light levels for the dim house, the bright house as well
as the "bonus" task of stopping in the corridor when an extremely
bright light was shined on it. This was achieved by using NQC as well
and triggering the calibration step with the use of a touch sensor,
located on the rear of KraftMouse.