Software
Designing Kraftmouse is a one of kind adventure in programming. The
beauty of Kraftmouse 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 environment.
LegOS
Truely 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
complier 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 is available at the project's homepage: http://www.noga.de/legOS/
. Unfortuately getting a legOS based robot to communicate with a
regular mindstorms IR system is quite complex, so in the end this
system was abandonned.
Not Quite C
Not Quite C (NQC) is a simple C-like language which provides access to
many of Mindstorms more useful functions without breaking
compatability with other mindstorm robots. Unfortuately, it also has
many of mindstorms annoying drawbacks. Lego chose to implement it's
system as a program interpreter which runs as a program on the
RCX. Without going into to much detail the results of this
architecture discision is that Mindstorm program's have a limited size
(6K) and can use only a few variables (16). Fortuately, this proved
sufficent for KraftMouse's purposes. More information can be found at
the NQC homepage:
http://www.enteract.com/~dbaum/nqc/ .
Two Light Sensor Design
As described in the hardware section KraftMouse initially had a two
light sensor design. The design was inspired by the Valentino
Braitenberg VEHICLES. 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 eye's would set
shared variables according to the mesured 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.
- 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.
In order to increase the accuracy of the BDS KraftMouse was also
updated to take single steps instead of continously moving. After each
step it would make its decisions and readings while stationary.
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. 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. Unfortuately 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.