Home » Personal collection » Acorn ADFS disks » Electron » EUG_submission.ADF » BallBot/Part1

BallBot/Part1

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Electron » EUG_submission.ADF
Filename: BallBot/Part1
Read OK:
File size: 21DD bytes
Load address: 50206576
Exec address: 31747261
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
BallBot Update

Artificial Intelligence Module

The Artificial Intelligence module is the computer program which will run
in the final robot to drive it around the tennis court to collect any
balls, and then dump them in a "home" position. The AI module's technique
is easiest viewed if you imagine that you are a small robot on a tennis
court, and imagine what strategy you would adopt. It is important to
decide what action you would take when confronted with all of the
following objects:

1. ME - Never visable from the ultrasonic sensors, because its always
behind them (when did you last see your face without using a mirror?), but
it is very important to know where you are relative to the rest of the
court.
2. THE BALL - The target. How could such a small thing be so important? Go
for it, but only if its safe to do so without the risk of colliding with
anything on the way.
3. THE  PLAYER - Nasty thing this... Keeps on moving around, but gets
annoyed if you collide with it. Keep away from this at all costs,
otherwise you will find yourself being recycled in the local scrapyard.
4. THE NET - An area where balls often collect, but be VERY careful when
maneovreing close to the net - you don't want to get caught up in it,
because that would be embarrassing.
5. THE CROWD - Large thing which surrounds the court. Don't collide with
it, or you will be in trouble. One wrong move when close to the crowd
could find you a place in that scrapyard again...

I found that the easiest method of performing this task was to split it
up. First the robot enters one of the two sides of the court. It then
begins slowly rotating around, scanning the court for balls. If it sees
one straight ahead, it drives forward to get it. If it sees one to one
side, it steers towards that side to line up with the balls. Once it has
collected the ball, it begins rotating again to try and find another
ball. If it manages to rotate through 360 degrees without seeing a ball,
it knows that this side of the court is clear of balls.

The robot then looks for a net post, and steers towards it. When it gets
very close, it steers away from the net to go around the post onto the
other side of the court. This maneovre required much attention in the
development of the module - if it steers too much it tends to get lost off
the court, and if it steers too little it collides with the post.

When this maneovre has been completed, the robot return to the first stage
of the process, and scans the court for balls again. Once again, the robot
only finishes when it successfully rotates through 360 degrees without
seeing a ball.

This time, the robot heads off towards the point where it is to dump the
balls - currently in the middle of one of the sides of the court, although
this will probably be changed later. Then it dumps the balls here, before
heading off towards one of the net posts, where it sits dormant until
asked to do another collection.

The Computer Simulation

The BallBot artificial intelligence module was developed in BASIC on an
Acorn Archimedes, using a computer simulation of a tennis court. The
simulation takes the robot is being at a point with co-ordinates (x,y) on
the court, and facing a direction of bearing d. To find the ultrasonic
data to pass to the AI module, it systematically cycles through every
object on the court: the balls, the net posts, the net, and any humans.
For each it finds the distance that the object is from the robot, using
Pythagoras' theorum, and the bearing using trigonometry:

It then decides which sensors that particular object would be detected by.
If it is out of sight of all of the sensors, it is ignored, and the
simulation moves onto the next object. This object will not affect
BallBot's input from any of the sensors. If it is in sight of one of the
sensors, it compares the distance of the object with any others which are
already logged as being detected by that sensor. If it is closer, the
previous entry for that sensor is removed, as it would be hidden behind
the new object. If it is further away, the object currently being
considered is ignored, as it would be hidden from sight. This way, the
closest object to the robot is found.

When the simulation has finished processing all of the objects in this
way, the ultrasonic inputs are completed. They are passed to the
artificial intelligence module for processing. Based upon this data, the
module decides what to do next, and the output data to the motors is
calculated. Although the AI module is running on the same computer as the
simulation, it only accesses the ultrasonic data passed to it, and does
not use any data concerning the co-ordinates of itself or any other object
on the court. This would be cheating, and would make the module useless in
any real life situation. The output data is returned to the simulation,
which uses it to update the values of x, y and d (the position of the
robot). It first has to find the speed at which the robot is travelling,
and then uses trigonometry to update x and y:

It then calculates whether or not the robot is turning at all, and if it
is, it updates the value of the bearing d by adding or subtracting a certain number of
degrees from it. When this is completed, the cycle begins again. The same
cycle will also be used by the final robot. The only difference is that
the manipulation of the motors and the calculation of ultrasonic data will
be carried out by hardware, not software.

This simulation allowed me to develop the simulation very easily, and as
the AI module was in BASIC it could be adapted to overcome faults with
little difficulty. At first I placed tennis balls on the court by clicking
with the mouse, and then watched the robot move round to collect them.
Later, when the robot was more reliable, I added a feature to the
simulation which allowed the computer to randomly place balls on the court
itself, without the user, and then set the AI module to try to collect
them. The simulation produced a log of all of the runs, with a judgement
of how well it went. If the AI module successfully collected all of the
balls, and returned the, to the "home" spot, it gave a "PASS". If it
failed to collect all the balls it returned "FAIL". Other responses were
given for crashing into the net or reaching a point of indecision (i.e.
the robot just froze up). Later I could watch the failed runs myself, and
study them to find out what went wrong. I found it useful to develop the
AI module's code during the daytime, and then leave the computer
simulation running on its own overnight so that I could see what areas
still needed attention.

This computer simulation runs in real-time, so that the robot on the
screen moves around in the same time-scale as would the real robot in
reality. This gives me a better judgement as to whether or not the speed
is acceptable than would statistics alone. In order to make the simulation
real-time, I had to research the exact dimensions of a tennis court to
know how fast the robot will move relative to landmarks on the court.

When I had developed the AI module in BASIC so that it was working
consistently, I had to translate the module into 6502 machine code.
Although BASIC is easier to work with, it would not be feasable to run the
code in the final robot or the prototype in BASIC. Machine code not only
runs faster, but is also the only language which microprocessors
can interpret without special software being present (which will not be
the case in the the final robot).

When the module had been converted into machine code, I began testing it
on a BBC, as opposed to an Archimedes, as this computer runs on a 6502
processor, and so accepts this form of machine code. First I used a
conversion of the simulation to check that the conversion had been
successful. I found that even without having to run the AI module in
BASIC, the BBC simulation ran slowly at only 1/20th of real speed. Even
so, I was able to use it to find a few bugs which had cropped up during the
transfer, and remove them from the code.

Development of the BallBot MOS

When the AI module had been successfully converted to the BBC, I began
developing a MOS (Machine Operating System) under which it would operate.
This reads input from an Ultrasonics module, and then passes the data to
the AI module. When the AI module has finished processing the data, it
takes the motor control data and sends it to the BBC's output ports to be
acted upon by the hardware.

This small module is actually a very simple piece of code - its sole
purpose is to pass data from one module to another, and to keep all of the
modules working together in time with one another.
00000000  42 61 6c 6c 42 6f 74 20  55 70 64 61 74 65 0d 0d  |BallBot Update..|
00000010  41 72 74 69 66 69 63 69  61 6c 20 49 6e 74 65 6c  |Artificial Intel|
00000020  6c 69 67 65 6e 63 65 20  4d 6f 64 75 6c 65 0d 0d  |ligence Module..|
00000030  54 68 65 20 41 72 74 69  66 69 63 69 61 6c 20 49  |The Artificial I|
00000040  6e 74 65 6c 6c 69 67 65  6e 63 65 20 6d 6f 64 75  |ntelligence modu|
00000050  6c 65 20 69 73 20 74 68  65 20 63 6f 6d 70 75 74  |le is the comput|
00000060  65 72 20 70 72 6f 67 72  61 6d 20 77 68 69 63 68  |er program which|
00000070  20 77 69 6c 6c 20 72 75  6e 0d 69 6e 20 74 68 65  | will run.in the|
00000080  20 66 69 6e 61 6c 20 72  6f 62 6f 74 20 74 6f 20  | final robot to |
00000090  64 72 69 76 65 20 69 74  20 61 72 6f 75 6e 64 20  |drive it around |
000000a0  74 68 65 20 74 65 6e 6e  69 73 20 63 6f 75 72 74  |the tennis court|
000000b0  20 74 6f 20 63 6f 6c 6c  65 63 74 20 61 6e 79 0d  | to collect any.|
000000c0  62 61 6c 6c 73 2c 20 61  6e 64 20 74 68 65 6e 20  |balls, and then |
000000d0  64 75 6d 70 20 74 68 65  6d 20 69 6e 20 61 20 22  |dump them in a "|
000000e0  68 6f 6d 65 22 20 70 6f  73 69 74 69 6f 6e 2e 20  |home" position. |
000000f0  54 68 65 20 41 49 20 6d  6f 64 75 6c 65 27 73 20  |The AI module's |
00000100  74 65 63 68 6e 69 71 75  65 0d 69 73 20 65 61 73  |technique.is eas|
00000110  69 65 73 74 20 76 69 65  77 65 64 20 69 66 20 79  |iest viewed if y|
00000120  6f 75 20 69 6d 61 67 69  6e 65 20 74 68 61 74 20  |ou imagine that |
00000130  79 6f 75 20 61 72 65 20  61 20 73 6d 61 6c 6c 20  |you are a small |
00000140  72 6f 62 6f 74 20 6f 6e  20 61 20 74 65 6e 6e 69  |robot on a tenni|
00000150  73 0d 63 6f 75 72 74 2c  20 61 6e 64 20 69 6d 61  |s.court, and ima|
00000160  67 69 6e 65 20 77 68 61  74 20 73 74 72 61 74 65  |gine what strate|
00000170  67 79 20 79 6f 75 20 77  6f 75 6c 64 20 61 64 6f  |gy you would ado|
00000180  70 74 2e 20 49 74 20 69  73 20 69 6d 70 6f 72 74  |pt. It is import|
00000190  61 6e 74 20 74 6f 0d 64  65 63 69 64 65 20 77 68  |ant to.decide wh|
000001a0  61 74 20 61 63 74 69 6f  6e 20 79 6f 75 20 77 6f  |at action you wo|
000001b0  75 6c 64 20 74 61 6b 65  20 77 68 65 6e 20 63 6f  |uld take when co|
000001c0  6e 66 72 6f 6e 74 65 64  20 77 69 74 68 20 61 6c  |nfronted with al|
000001d0  6c 20 6f 66 20 74 68 65  0d 66 6f 6c 6c 6f 77 69  |l of the.followi|
000001e0  6e 67 20 6f 62 6a 65 63  74 73 3a 0d 0d 31 2e 20  |ng objects:..1. |
000001f0  4d 45 20 2d 20 4e 65 76  65 72 20 76 69 73 61 62  |ME - Never visab|
00000200  6c 65 20 66 72 6f 6d 20  74 68 65 20 75 6c 74 72  |le from the ultr|
00000210  61 73 6f 6e 69 63 20 73  65 6e 73 6f 72 73 2c 20  |asonic sensors, |
00000220  62 65 63 61 75 73 65 20  69 74 73 20 61 6c 77 61  |because its alwa|
00000230  79 73 0d 62 65 68 69 6e  64 20 74 68 65 6d 20 28  |ys.behind them (|
00000240  77 68 65 6e 20 64 69 64  20 79 6f 75 20 6c 61 73  |when did you las|
00000250  74 20 73 65 65 20 79 6f  75 72 20 66 61 63 65 20  |t see your face |
00000260  77 69 74 68 6f 75 74 20  75 73 69 6e 67 20 61 20  |without using a |
00000270  6d 69 72 72 6f 72 3f 29  2c 20 62 75 74 0d 69 74  |mirror?), but.it|
00000280  20 69 73 20 76 65 72 79  20 69 6d 70 6f 72 74 61  | is very importa|
00000290  6e 74 20 74 6f 20 6b 6e  6f 77 20 77 68 65 72 65  |nt to know where|
000002a0  20 79 6f 75 20 61 72 65  20 72 65 6c 61 74 69 76  | you are relativ|
000002b0  65 20 74 6f 20 74 68 65  20 72 65 73 74 20 6f 66  |e to the rest of|
000002c0  20 74 68 65 0d 63 6f 75  72 74 2e 0d 32 2e 20 54  | the.court..2. T|
000002d0  48 45 20 42 41 4c 4c 20  2d 20 54 68 65 20 74 61  |HE BALL - The ta|
000002e0  72 67 65 74 2e 20 48 6f  77 20 63 6f 75 6c 64 20  |rget. How could |
000002f0  73 75 63 68 20 61 20 73  6d 61 6c 6c 20 74 68 69  |such a small thi|
00000300  6e 67 20 62 65 20 73 6f  20 69 6d 70 6f 72 74 61  |ng be so importa|
00000310  6e 74 3f 20 47 6f 0d 66  6f 72 20 69 74 2c 20 62  |nt? Go.for it, b|
00000320  75 74 20 6f 6e 6c 79 20  69 66 20 69 74 73 20 73  |ut only if its s|
00000330  61 66 65 20 74 6f 20 64  6f 20 73 6f 20 77 69 74  |afe to do so wit|
00000340  68 6f 75 74 20 74 68 65  20 72 69 73 6b 20 6f 66  |hout the risk of|
00000350  20 63 6f 6c 6c 69 64 69  6e 67 20 77 69 74 68 0d  | colliding with.|
00000360  61 6e 79 74 68 69 6e 67  20 6f 6e 20 74 68 65 20  |anything on the |
00000370  77 61 79 2e 0d 33 2e 20  54 48 45 20 20 50 4c 41  |way..3. THE  PLA|
00000380  59 45 52 20 2d 20 4e 61  73 74 79 20 74 68 69 6e  |YER - Nasty thin|
00000390  67 20 74 68 69 73 2e 2e  2e 20 4b 65 65 70 73 20  |g this... Keeps |
000003a0  6f 6e 20 6d 6f 76 69 6e  67 20 61 72 6f 75 6e 64  |on moving around|
000003b0  2c 20 62 75 74 20 67 65  74 73 0d 61 6e 6e 6f 79  |, but gets.annoy|
000003c0  65 64 20 69 66 20 79 6f  75 20 63 6f 6c 6c 69 64  |ed if you collid|
000003d0  65 20 77 69 74 68 20 69  74 2e 20 4b 65 65 70 20  |e with it. Keep |
000003e0  61 77 61 79 20 66 72 6f  6d 20 74 68 69 73 20 61  |away from this a|
000003f0  74 20 61 6c 6c 20 63 6f  73 74 73 2c 0d 6f 74 68  |t all costs,.oth|
00000400  65 72 77 69 73 65 20 79  6f 75 20 77 69 6c 6c 20  |erwise you will |
00000410  66 69 6e 64 20 79 6f 75  72 73 65 6c 66 20 62 65  |find yourself be|
00000420  69 6e 67 20 72 65 63 79  63 6c 65 64 20 69 6e 20  |ing recycled in |
00000430  74 68 65 20 6c 6f 63 61  6c 20 73 63 72 61 70 79  |the local scrapy|
00000440  61 72 64 2e 0d 34 2e 20  54 48 45 20 4e 45 54 20  |ard..4. THE NET |
00000450  2d 20 41 6e 20 61 72 65  61 20 77 68 65 72 65 20  |- An area where |
00000460  62 61 6c 6c 73 20 6f 66  74 65 6e 20 63 6f 6c 6c  |balls often coll|
00000470  65 63 74 2c 20 62 75 74  20 62 65 20 56 45 52 59  |ect, but be VERY|
00000480  20 63 61 72 65 66 75 6c  20 77 68 65 6e 0d 6d 61  | careful when.ma|
00000490  6e 65 6f 76 72 65 69 6e  67 20 63 6c 6f 73 65 20  |neovreing close |
000004a0  74 6f 20 74 68 65 20 6e  65 74 20 2d 20 79 6f 75  |to the net - you|
000004b0  20 64 6f 6e 27 74 20 77  61 6e 74 20 74 6f 20 67  | don't want to g|
000004c0  65 74 20 63 61 75 67 68  74 20 75 70 20 69 6e 20  |et caught up in |
000004d0  69 74 2c 0d 62 65 63 61  75 73 65 20 74 68 61 74  |it,.because that|
000004e0  20 77 6f 75 6c 64 20 62  65 20 65 6d 62 61 72 72  | would be embarr|
000004f0  61 73 73 69 6e 67 2e 0d  35 2e 20 54 48 45 20 43  |assing..5. THE C|
00000500  52 4f 57 44 20 2d 20 4c  61 72 67 65 20 74 68 69  |ROWD - Large thi|
00000510  6e 67 20 77 68 69 63 68  20 73 75 72 72 6f 75 6e  |ng which surroun|
00000520  64 73 20 74 68 65 20 63  6f 75 72 74 2e 20 44 6f  |ds the court. Do|
00000530  6e 27 74 20 63 6f 6c 6c  69 64 65 20 77 69 74 68  |n't collide with|
00000540  0d 69 74 2c 20 6f 72 20  79 6f 75 20 77 69 6c 6c  |.it, or you will|
00000550  20 62 65 20 69 6e 20 74  72 6f 75 62 6c 65 2e 20  | be in trouble. |
00000560  4f 6e 65 20 77 72 6f 6e  67 20 6d 6f 76 65 20 77  |One wrong move w|
00000570  68 65 6e 20 63 6c 6f 73  65 20 74 6f 20 74 68 65  |hen close to the|
00000580  20 63 72 6f 77 64 0d 63  6f 75 6c 64 20 66 69 6e  | crowd.could fin|
00000590  64 20 79 6f 75 20 61 20  70 6c 61 63 65 20 69 6e  |d you a place in|
000005a0  20 74 68 61 74 20 73 63  72 61 70 79 61 72 64 20  | that scrapyard |
000005b0  61 67 61 69 6e 2e 2e 2e  0d 0d 49 20 66 6f 75 6e  |again.....I foun|
000005c0  64 20 74 68 61 74 20 74  68 65 20 65 61 73 69 65  |d that the easie|
000005d0  73 74 20 6d 65 74 68 6f  64 20 6f 66 20 70 65 72  |st method of per|
000005e0  66 6f 72 6d 69 6e 67 20  74 68 69 73 20 74 61 73  |forming this tas|
000005f0  6b 20 77 61 73 20 74 6f  20 73 70 6c 69 74 20 69  |k was to split i|
00000600  74 0d 75 70 2e 20 46 69  72 73 74 20 74 68 65 20  |t.up. First the |
00000610  72 6f 62 6f 74 20 65 6e  74 65 72 73 20 6f 6e 65  |robot enters one|
00000620  20 6f 66 20 74 68 65 20  74 77 6f 20 73 69 64 65  | of the two side|
00000630  73 20 6f 66 20 74 68 65  20 63 6f 75 72 74 2e 20  |s of the court. |
00000640  49 74 20 74 68 65 6e 0d  62 65 67 69 6e 73 20 73  |It then.begins s|
00000650  6c 6f 77 6c 79 20 72 6f  74 61 74 69 6e 67 20 61  |lowly rotating a|
00000660  72 6f 75 6e 64 2c 20 73  63 61 6e 6e 69 6e 67 20  |round, scanning |
00000670  74 68 65 20 63 6f 75 72  74 20 66 6f 72 20 62 61  |the court for ba|
00000680  6c 6c 73 2e 20 49 66 20  69 74 20 73 65 65 73 0d  |lls. If it sees.|
00000690  6f 6e 65 20 73 74 72 61  69 67 68 74 20 61 68 65  |one straight ahe|
000006a0  61 64 2c 20 69 74 20 64  72 69 76 65 73 20 66 6f  |ad, it drives fo|
000006b0  72 77 61 72 64 20 74 6f  20 67 65 74 20 69 74 2e  |rward to get it.|
000006c0  20 49 66 20 69 74 20 73  65 65 73 20 6f 6e 65 20  | If it sees one |
000006d0  74 6f 20 6f 6e 65 0d 73  69 64 65 2c 20 69 74 20  |to one.side, it |
000006e0  73 74 65 65 72 73 20 74  6f 77 61 72 64 73 20 74  |steers towards t|
000006f0  68 61 74 20 73 69 64 65  20 74 6f 20 6c 69 6e 65  |hat side to line|
00000700  20 75 70 20 77 69 74 68  20 74 68 65 20 62 61 6c  | up with the bal|
00000710  6c 73 2e 20 4f 6e 63 65  20 69 74 20 68 61 73 0d  |ls. Once it has.|
00000720  63 6f 6c 6c 65 63 74 65  64 20 74 68 65 20 62 61  |collected the ba|
00000730  6c 6c 2c 20 69 74 20 62  65 67 69 6e 73 20 72 6f  |ll, it begins ro|
00000740  74 61 74 69 6e 67 20 61  67 61 69 6e 20 74 6f 20  |tating again to |
00000750  74 72 79 20 61 6e 64 20  66 69 6e 64 20 61 6e 6f  |try and find ano|
00000760  74 68 65 72 0d 62 61 6c  6c 2e 20 49 66 20 69 74  |ther.ball. If it|
00000770  20 6d 61 6e 61 67 65 73  20 74 6f 20 72 6f 74 61  | manages to rota|
00000780  74 65 20 74 68 72 6f 75  67 68 20 33 36 30 20 64  |te through 360 d|
00000790  65 67 72 65 65 73 20 77  69 74 68 6f 75 74 20 73  |egrees without s|
000007a0  65 65 69 6e 67 20 61 20  62 61 6c 6c 2c 0d 69 74  |eeing a ball,.it|
000007b0  20 6b 6e 6f 77 73 20 74  68 61 74 20 74 68 69 73  | knows that this|
000007c0  20 73 69 64 65 20 6f 66  20 74 68 65 20 63 6f 75  | side of the cou|
000007d0  72 74 20 69 73 20 63 6c  65 61 72 20 6f 66 20 62  |rt is clear of b|
000007e0  61 6c 6c 73 2e 0d 0d 54  68 65 20 72 6f 62 6f 74  |alls...The robot|
000007f0  20 74 68 65 6e 20 6c 6f  6f 6b 73 20 66 6f 72 20  | then looks for |
00000800  61 20 6e 65 74 20 70 6f  73 74 2c 20 61 6e 64 20  |a net post, and |
00000810  73 74 65 65 72 73 20 74  6f 77 61 72 64 73 20 69  |steers towards i|
00000820  74 2e 20 57 68 65 6e 20  69 74 20 67 65 74 73 0d  |t. When it gets.|
00000830  76 65 72 79 20 63 6c 6f  73 65 2c 20 69 74 20 73  |very close, it s|
00000840  74 65 65 72 73 20 61 77  61 79 20 66 72 6f 6d 20  |teers away from |
00000850  74 68 65 20 6e 65 74 20  74 6f 20 67 6f 20 61 72  |the net to go ar|
00000860  6f 75 6e 64 20 74 68 65  20 70 6f 73 74 20 6f 6e  |ound the post on|
00000870  74 6f 20 74 68 65 0d 6f  74 68 65 72 20 73 69 64  |to the.other sid|
00000880  65 20 6f 66 20 74 68 65  20 63 6f 75 72 74 2e 20  |e of the court. |
00000890  54 68 69 73 20 6d 61 6e  65 6f 76 72 65 20 72 65  |This maneovre re|
000008a0  71 75 69 72 65 64 20 6d  75 63 68 20 61 74 74 65  |quired much atte|
000008b0  6e 74 69 6f 6e 20 69 6e  20 74 68 65 0d 64 65 76  |ntion in the.dev|
000008c0  65 6c 6f 70 6d 65 6e 74  20 6f 66 20 74 68 65 20  |elopment of the |
000008d0  6d 6f 64 75 6c 65 20 2d  20 69 66 20 69 74 20 73  |module - if it s|
000008e0  74 65 65 72 73 20 74 6f  6f 20 6d 75 63 68 20 69  |teers too much i|
000008f0  74 20 74 65 6e 64 73 20  74 6f 20 67 65 74 20 6c  |t tends to get l|
00000900  6f 73 74 20 6f 66 66 0d  74 68 65 20 63 6f 75 72  |ost off.the cour|
00000910  74 2c 20 61 6e 64 20 69  66 20 69 74 20 73 74 65  |t, and if it ste|
00000920  65 72 73 20 74 6f 6f 20  6c 69 74 74 6c 65 20 69  |ers too little i|
00000930  74 20 63 6f 6c 6c 69 64  65 73 20 77 69 74 68 20  |t collides with |
00000940  74 68 65 20 70 6f 73 74  2e 0d 0d 57 68 65 6e 20  |the post...When |
00000950  74 68 69 73 20 6d 61 6e  65 6f 76 72 65 20 68 61  |this maneovre ha|
00000960  73 20 62 65 65 6e 20 63  6f 6d 70 6c 65 74 65 64  |s been completed|
00000970  2c 20 74 68 65 20 72 6f  62 6f 74 20 72 65 74 75  |, the robot retu|
00000980  72 6e 20 74 6f 20 74 68  65 20 66 69 72 73 74 20  |rn to the first |
00000990  73 74 61 67 65 0d 6f 66  20 74 68 65 20 70 72 6f  |stage.of the pro|
000009a0  63 65 73 73 2c 20 61 6e  64 20 73 63 61 6e 73 20  |cess, and scans |
000009b0  74 68 65 20 63 6f 75 72  74 20 66 6f 72 20 62 61  |the court for ba|
000009c0  6c 6c 73 20 61 67 61 69  6e 2e 20 4f 6e 63 65 20  |lls again. Once |
000009d0  61 67 61 69 6e 2c 20 74  68 65 20 72 6f 62 6f 74  |again, the robot|
000009e0  0d 6f 6e 6c 79 20 66 69  6e 69 73 68 65 73 20 77  |.only finishes w|
000009f0  68 65 6e 20 69 74 20 73  75 63 63 65 73 73 66 75  |hen it successfu|
00000a00  6c 6c 79 20 72 6f 74 61  74 65 73 20 74 68 72 6f  |lly rotates thro|
00000a10  75 67 68 20 33 36 30 20  64 65 67 72 65 65 73 20  |ugh 360 degrees |
00000a20  77 69 74 68 6f 75 74 0d  73 65 65 69 6e 67 20 61  |without.seeing a|
00000a30  20 62 61 6c 6c 2e 0d 0d  54 68 69 73 20 74 69 6d  | ball...This tim|
00000a40  65 2c 20 74 68 65 20 72  6f 62 6f 74 20 68 65 61  |e, the robot hea|
00000a50  64 73 20 6f 66 66 20 74  6f 77 61 72 64 73 20 74  |ds off towards t|
00000a60  68 65 20 70 6f 69 6e 74  20 77 68 65 72 65 20 69  |he point where i|
00000a70  74 20 69 73 20 74 6f 20  64 75 6d 70 20 74 68 65  |t is to dump the|
00000a80  0d 62 61 6c 6c 73 20 2d  20 63 75 72 72 65 6e 74  |.balls - current|
00000a90  6c 79 20 69 6e 20 74 68  65 20 6d 69 64 64 6c 65  |ly in the middle|
00000aa0  20 6f 66 20 6f 6e 65 20  6f 66 20 74 68 65 20 73  | of one of the s|
00000ab0  69 64 65 73 20 6f 66 20  74 68 65 20 63 6f 75 72  |ides of the cour|
00000ac0  74 2c 20 61 6c 74 68 6f  75 67 68 0d 74 68 69 73  |t, although.this|
00000ad0  20 77 69 6c 6c 20 70 72  6f 62 61 62 6c 79 20 62  | will probably b|
00000ae0  65 20 63 68 61 6e 67 65  64 20 6c 61 74 65 72 2e  |e changed later.|
00000af0  20 54 68 65 6e 20 69 74  20 64 75 6d 70 73 20 74  | Then it dumps t|
00000b00  68 65 20 62 61 6c 6c 73  20 68 65 72 65 2c 20 62  |he balls here, b|
00000b10  65 66 6f 72 65 0d 68 65  61 64 69 6e 67 20 6f 66  |efore.heading of|
00000b20  66 20 74 6f 77 61 72 64  73 20 6f 6e 65 20 6f 66  |f towards one of|
00000b30  20 74 68 65 20 6e 65 74  20 70 6f 73 74 73 2c 20  | the net posts, |
00000b40  77 68 65 72 65 20 69 74  20 73 69 74 73 20 64 6f  |where it sits do|
00000b50  72 6d 61 6e 74 20 75 6e  74 69 6c 0d 61 73 6b 65  |rmant until.aske|
00000b60  64 20 74 6f 20 64 6f 20  61 6e 6f 74 68 65 72 20  |d to do another |
00000b70  63 6f 6c 6c 65 63 74 69  6f 6e 2e 0d 0d 54 68 65  |collection...The|
00000b80  20 43 6f 6d 70 75 74 65  72 20 53 69 6d 75 6c 61  | Computer Simula|
00000b90  74 69 6f 6e 0d 0d 54 68  65 20 42 61 6c 6c 42 6f  |tion..The BallBo|
00000ba0  74 20 61 72 74 69 66 69  63 69 61 6c 20 69 6e 74  |t artificial int|
00000bb0  65 6c 6c 69 67 65 6e 63  65 20 6d 6f 64 75 6c 65  |elligence module|
00000bc0  20 77 61 73 20 64 65 76  65 6c 6f 70 65 64 20 69  | was developed i|
00000bd0  6e 20 42 41 53 49 43 20  6f 6e 20 61 6e 0d 41 63  |n BASIC on an.Ac|
00000be0  6f 72 6e 20 41 72 63 68  69 6d 65 64 65 73 2c 20  |orn Archimedes, |
00000bf0  75 73 69 6e 67 20 61 20  63 6f 6d 70 75 74 65 72  |using a computer|
00000c00  20 73 69 6d 75 6c 61 74  69 6f 6e 20 6f 66 20 61  | simulation of a|
00000c10  20 74 65 6e 6e 69 73 20  63 6f 75 72 74 2e 20 54  | tennis court. T|
00000c20  68 65 0d 73 69 6d 75 6c  61 74 69 6f 6e 20 74 61  |he.simulation ta|
00000c30  6b 65 73 20 74 68 65 20  72 6f 62 6f 74 20 69 73  |kes the robot is|
00000c40  20 62 65 69 6e 67 20 61  74 20 61 20 70 6f 69 6e  | being at a poin|
00000c50  74 20 77 69 74 68 20 63  6f 2d 6f 72 64 69 6e 61  |t with co-ordina|
00000c60  74 65 73 20 28 78 2c 79  29 20 6f 6e 0d 74 68 65  |tes (x,y) on.the|
00000c70  20 63 6f 75 72 74 2c 20  61 6e 64 20 66 61 63 69  | court, and faci|
00000c80  6e 67 20 61 20 64 69 72  65 63 74 69 6f 6e 20 6f  |ng a direction o|
00000c90  66 20 62 65 61 72 69 6e  67 20 64 2e 20 54 6f 20  |f bearing d. To |
00000ca0  66 69 6e 64 20 74 68 65  20 75 6c 74 72 61 73 6f  |find the ultraso|
00000cb0  6e 69 63 0d 64 61 74 61  20 74 6f 20 70 61 73 73  |nic.data to pass|
00000cc0  20 74 6f 20 74 68 65 20  41 49 20 6d 6f 64 75 6c  | to the AI modul|
00000cd0  65 2c 20 69 74 20 73 79  73 74 65 6d 61 74 69 63  |e, it systematic|
00000ce0  61 6c 6c 79 20 63 79 63  6c 65 73 20 74 68 72 6f  |ally cycles thro|
00000cf0  75 67 68 20 65 76 65 72  79 0d 6f 62 6a 65 63 74  |ugh every.object|
00000d00  20 6f 6e 20 74 68 65 20  63 6f 75 72 74 3a 20 74  | on the court: t|
00000d10  68 65 20 62 61 6c 6c 73  2c 20 74 68 65 20 6e 65  |he balls, the ne|
00000d20  74 20 70 6f 73 74 73 2c  20 74 68 65 20 6e 65 74  |t posts, the net|
00000d30  2c 20 61 6e 64 20 61 6e  79 20 68 75 6d 61 6e 73  |, and any humans|
00000d40  2e 0d 46 6f 72 20 65 61  63 68 20 69 74 20 66 69  |..For each it fi|
00000d50  6e 64 73 20 74 68 65 20  64 69 73 74 61 6e 63 65  |nds the distance|
00000d60  20 74 68 61 74 20 74 68  65 20 6f 62 6a 65 63 74  | that the object|
00000d70  20 69 73 20 66 72 6f 6d  20 74 68 65 20 72 6f 62  | is from the rob|
00000d80  6f 74 2c 20 75 73 69 6e  67 0d 50 79 74 68 61 67  |ot, using.Pythag|
00000d90  6f 72 61 73 27 20 74 68  65 6f 72 75 6d 2c 20 61  |oras' theorum, a|
00000da0  6e 64 20 74 68 65 20 62  65 61 72 69 6e 67 20 75  |nd the bearing u|
00000db0  73 69 6e 67 20 74 72 69  67 6f 6e 6f 6d 65 74 72  |sing trigonometr|
00000dc0  79 3a 0d 0d 49 74 20 74  68 65 6e 20 64 65 63 69  |y:..It then deci|
00000dd0  64 65 73 20 77 68 69 63  68 20 73 65 6e 73 6f 72  |des which sensor|
00000de0  73 20 74 68 61 74 20 70  61 72 74 69 63 75 6c 61  |s that particula|
00000df0  72 20 6f 62 6a 65 63 74  20 77 6f 75 6c 64 20 62  |r object would b|
00000e00  65 20 64 65 74 65 63 74  65 64 20 62 79 2e 0d 49  |e detected by..I|
00000e10  66 20 69 74 20 69 73 20  6f 75 74 20 6f 66 20 73  |f it is out of s|
00000e20  69 67 68 74 20 6f 66 20  61 6c 6c 20 6f 66 20 74  |ight of all of t|
00000e30  68 65 20 73 65 6e 73 6f  72 73 2c 20 69 74 20 69  |he sensors, it i|
00000e40  73 20 69 67 6e 6f 72 65  64 2c 20 61 6e 64 20 74  |s ignored, and t|
00000e50  68 65 0d 73 69 6d 75 6c  61 74 69 6f 6e 20 6d 6f  |he.simulation mo|
00000e60  76 65 73 20 6f 6e 74 6f  20 74 68 65 20 6e 65 78  |ves onto the nex|
00000e70  74 20 6f 62 6a 65 63 74  2e 20 54 68 69 73 20 6f  |t object. This o|
00000e80  62 6a 65 63 74 20 77 69  6c 6c 20 6e 6f 74 20 61  |bject will not a|
00000e90  66 66 65 63 74 0d 42 61  6c 6c 42 6f 74 27 73 20  |ffect.BallBot's |
00000ea0  69 6e 70 75 74 20 66 72  6f 6d 20 61 6e 79 20 6f  |input from any o|
00000eb0  66 20 74 68 65 20 73 65  6e 73 6f 72 73 2e 20 49  |f the sensors. I|
00000ec0  66 20 69 74 20 69 73 20  69 6e 20 73 69 67 68 74  |f it is in sight|
00000ed0  20 6f 66 20 6f 6e 65 20  6f 66 20 74 68 65 0d 73  | of one of the.s|
00000ee0  65 6e 73 6f 72 73 2c 20  69 74 20 63 6f 6d 70 61  |ensors, it compa|
00000ef0  72 65 73 20 74 68 65 20  64 69 73 74 61 6e 63 65  |res the distance|
00000f00  20 6f 66 20 74 68 65 20  6f 62 6a 65 63 74 20 77  | of the object w|
00000f10  69 74 68 20 61 6e 79 20  6f 74 68 65 72 73 20 77  |ith any others w|
00000f20  68 69 63 68 20 61 72 65  0d 61 6c 72 65 61 64 79  |hich are.already|
00000f30  20 6c 6f 67 67 65 64 20  61 73 20 62 65 69 6e 67  | logged as being|
00000f40  20 64 65 74 65 63 74 65  64 20 62 79 20 74 68 61  | detected by tha|
00000f50  74 20 73 65 6e 73 6f 72  2e 20 49 66 20 69 74 20  |t sensor. If it |
00000f60  69 73 20 63 6c 6f 73 65  72 2c 20 74 68 65 0d 70  |is closer, the.p|
00000f70  72 65 76 69 6f 75 73 20  65 6e 74 72 79 20 66 6f  |revious entry fo|
00000f80  72 20 74 68 61 74 20 73  65 6e 73 6f 72 20 69 73  |r that sensor is|
00000f90  20 72 65 6d 6f 76 65 64  2c 20 61 73 20 69 74 20  | removed, as it |
00000fa0  77 6f 75 6c 64 20 62 65  20 68 69 64 64 65 6e 20  |would be hidden |
00000fb0  62 65 68 69 6e 64 0d 74  68 65 20 6e 65 77 20 6f  |behind.the new o|
00000fc0  62 6a 65 63 74 2e 20 49  66 20 69 74 20 69 73 20  |bject. If it is |
00000fd0  66 75 72 74 68 65 72 20  61 77 61 79 2c 20 74 68  |further away, th|
00000fe0  65 20 6f 62 6a 65 63 74  20 63 75 72 72 65 6e 74  |e object current|
00000ff0  6c 79 20 62 65 69 6e 67  0d 63 6f 6e 73 69 64 65  |ly being.conside|
00001000  72 65 64 20 69 73 20 69  67 6e 6f 72 65 64 2c 20  |red is ignored, |
00001010  61 73 20 69 74 20 77 6f  75 6c 64 20 62 65 20 68  |as it would be h|
00001020  69 64 64 65 6e 20 66 72  6f 6d 20 73 69 67 68 74  |idden from sight|
00001030  2e 20 54 68 69 73 20 77  61 79 2c 20 74 68 65 0d  |. This way, the.|
00001040  63 6c 6f 73 65 73 74 20  6f 62 6a 65 63 74 20 74  |closest object t|
00001050  6f 20 74 68 65 20 72 6f  62 6f 74 20 69 73 20 66  |o the robot is f|
00001060  6f 75 6e 64 2e 0d 0d 57  68 65 6e 20 74 68 65 20  |ound...When the |
00001070  73 69 6d 75 6c 61 74 69  6f 6e 20 68 61 73 20 66  |simulation has f|
00001080  69 6e 69 73 68 65 64 20  70 72 6f 63 65 73 73 69  |inished processi|
00001090  6e 67 20 61 6c 6c 20 6f  66 20 74 68 65 20 6f 62  |ng all of the ob|
000010a0  6a 65 63 74 73 20 69 6e  20 74 68 69 73 0d 77 61  |jects in this.wa|
000010b0  79 2c 20 74 68 65 20 75  6c 74 72 61 73 6f 6e 69  |y, the ultrasoni|
000010c0  63 20 69 6e 70 75 74 73  20 61 72 65 20 63 6f 6d  |c inputs are com|
000010d0  70 6c 65 74 65 64 2e 20  54 68 65 79 20 61 72 65  |pleted. They are|
000010e0  20 70 61 73 73 65 64 20  74 6f 20 74 68 65 0d 61  | passed to the.a|
000010f0  72 74 69 66 69 63 69 61  6c 20 69 6e 74 65 6c 6c  |rtificial intell|
00001100  69 67 65 6e 63 65 20 6d  6f 64 75 6c 65 20 66 6f  |igence module fo|
00001110  72 20 70 72 6f 63 65 73  73 69 6e 67 2e 20 42 61  |r processing. Ba|
00001120  73 65 64 20 75 70 6f 6e  20 74 68 69 73 20 64 61  |sed upon this da|
00001130  74 61 2c 20 74 68 65 0d  6d 6f 64 75 6c 65 20 64  |ta, the.module d|
00001140  65 63 69 64 65 73 20 77  68 61 74 20 74 6f 20 64  |ecides what to d|
00001150  6f 20 6e 65 78 74 2c 20  61 6e 64 20 74 68 65 20  |o next, and the |
00001160  6f 75 74 70 75 74 20 64  61 74 61 20 74 6f 20 74  |output data to t|
00001170  68 65 20 6d 6f 74 6f 72  73 20 69 73 0d 63 61 6c  |he motors is.cal|
00001180  63 75 6c 61 74 65 64 2e  20 41 6c 74 68 6f 75 67  |culated. Althoug|
00001190  68 20 74 68 65 20 41 49  20 6d 6f 64 75 6c 65 20  |h the AI module |
000011a0  69 73 20 72 75 6e 6e 69  6e 67 20 6f 6e 20 74 68  |is running on th|
000011b0  65 20 73 61 6d 65 20 63  6f 6d 70 75 74 65 72 20  |e same computer |
000011c0  61 73 20 74 68 65 0d 73  69 6d 75 6c 61 74 69 6f  |as the.simulatio|
000011d0  6e 2c 20 69 74 20 6f 6e  6c 79 20 61 63 63 65 73  |n, it only acces|
000011e0  73 65 73 20 74 68 65 20  75 6c 74 72 61 73 6f 6e  |ses the ultrason|
000011f0  69 63 20 64 61 74 61 20  70 61 73 73 65 64 20 74  |ic data passed t|
00001200  6f 20 69 74 2c 20 61 6e  64 20 64 6f 65 73 0d 6e  |o it, and does.n|
00001210  6f 74 20 75 73 65 20 61  6e 79 20 64 61 74 61 20  |ot use any data |
00001220  63 6f 6e 63 65 72 6e 69  6e 67 20 74 68 65 20 63  |concerning the c|
00001230  6f 2d 6f 72 64 69 6e 61  74 65 73 20 6f 66 20 69  |o-ordinates of i|
00001240  74 73 65 6c 66 20 6f 72  20 61 6e 79 20 6f 74 68  |tself or any oth|
00001250  65 72 20 6f 62 6a 65 63  74 0d 6f 6e 20 74 68 65  |er object.on the|
00001260  20 63 6f 75 72 74 2e 20  54 68 69 73 20 77 6f 75  | court. This wou|
00001270  6c 64 20 62 65 20 63 68  65 61 74 69 6e 67 2c 20  |ld be cheating, |
00001280  61 6e 64 20 77 6f 75 6c  64 20 6d 61 6b 65 20 74  |and would make t|
00001290  68 65 20 6d 6f 64 75 6c  65 20 75 73 65 6c 65 73  |he module useles|
000012a0  73 20 69 6e 0d 61 6e 79  20 72 65 61 6c 20 6c 69  |s in.any real li|
000012b0  66 65 20 73 69 74 75 61  74 69 6f 6e 2e 20 54 68  |fe situation. Th|
000012c0  65 20 6f 75 74 70 75 74  20 64 61 74 61 20 69 73  |e output data is|
000012d0  20 72 65 74 75 72 6e 65  64 20 74 6f 20 74 68 65  | returned to the|
000012e0  20 73 69 6d 75 6c 61 74  69 6f 6e 2c 0d 77 68 69  | simulation,.whi|
000012f0  63 68 20 75 73 65 73 20  69 74 20 74 6f 20 75 70  |ch uses it to up|
00001300  64 61 74 65 20 74 68 65  20 76 61 6c 75 65 73 20  |date the values |
00001310  6f 66 20 78 2c 20 79 20  61 6e 64 20 64 20 28 74  |of x, y and d (t|
00001320  68 65 20 70 6f 73 69 74  69 6f 6e 20 6f 66 20 74  |he position of t|
00001330  68 65 0d 72 6f 62 6f 74  29 2e 20 49 74 20 66 69  |he.robot). It fi|
00001340  72 73 74 20 68 61 73 20  74 6f 20 66 69 6e 64 20  |rst has to find |
00001350  74 68 65 20 73 70 65 65  64 20 61 74 20 77 68 69  |the speed at whi|
00001360  63 68 20 74 68 65 20 72  6f 62 6f 74 20 69 73 20  |ch the robot is |
00001370  74 72 61 76 65 6c 6c 69  6e 67 2c 0d 61 6e 64 20  |travelling,.and |
00001380  74 68 65 6e 20 75 73 65  73 20 74 72 69 67 6f 6e  |then uses trigon|
00001390  6f 6d 65 74 72 79 20 74  6f 20 75 70 64 61 74 65  |ometry to update|
000013a0  20 78 20 61 6e 64 20 79  3a 0d 0d 49 74 20 74 68  | x and y:..It th|
000013b0  65 6e 20 63 61 6c 63 75  6c 61 74 65 73 20 77 68  |en calculates wh|
000013c0  65 74 68 65 72 20 6f 72  20 6e 6f 74 20 74 68 65  |ether or not the|
000013d0  20 72 6f 62 6f 74 20 69  73 20 74 75 72 6e 69 6e  | robot is turnin|
000013e0  67 20 61 74 20 61 6c 6c  2c 20 61 6e 64 20 69 66  |g at all, and if|
000013f0  20 69 74 0d 69 73 2c 20  69 74 20 75 70 64 61 74  | it.is, it updat|
00001400  65 73 20 74 68 65 20 76  61 6c 75 65 20 6f 66 20  |es the value of |
00001410  74 68 65 20 62 65 61 72  69 6e 67 20 64 20 62 79  |the bearing d by|
00001420  20 61 64 64 69 6e 67 20  6f 72 20 73 75 62 74 72  | adding or subtr|
00001430  61 63 74 69 6e 67 20 61  20 63 65 72 74 61 69 6e  |acting a certain|
00001440  20 6e 75 6d 62 65 72 20  6f 66 0d 64 65 67 72 65  | number of.degre|
00001450  65 73 20 66 72 6f 6d 20  69 74 2e 20 57 68 65 6e  |es from it. When|
00001460  20 74 68 69 73 20 69 73  20 63 6f 6d 70 6c 65 74  | this is complet|
00001470  65 64 2c 20 74 68 65 20  63 79 63 6c 65 20 62 65  |ed, the cycle be|
00001480  67 69 6e 73 20 61 67 61  69 6e 2e 20 54 68 65 20  |gins again. The |
00001490  73 61 6d 65 0d 63 79 63  6c 65 20 77 69 6c 6c 20  |same.cycle will |
000014a0  61 6c 73 6f 20 62 65 20  75 73 65 64 20 62 79 20  |also be used by |
000014b0  74 68 65 20 66 69 6e 61  6c 20 72 6f 62 6f 74 2e  |the final robot.|
000014c0  20 54 68 65 20 6f 6e 6c  79 20 64 69 66 66 65 72  | The only differ|
000014d0  65 6e 63 65 20 69 73 20  74 68 61 74 0d 74 68 65  |ence is that.the|
000014e0  20 6d 61 6e 69 70 75 6c  61 74 69 6f 6e 20 6f 66  | manipulation of|
000014f0  20 74 68 65 20 6d 6f 74  6f 72 73 20 61 6e 64 20  | the motors and |
00001500  74 68 65 20 63 61 6c 63  75 6c 61 74 69 6f 6e 20  |the calculation |
00001510  6f 66 20 75 6c 74 72 61  73 6f 6e 69 63 20 64 61  |of ultrasonic da|
00001520  74 61 20 77 69 6c 6c 0d  62 65 20 63 61 72 72 69  |ta will.be carri|
00001530  65 64 20 6f 75 74 20 62  79 20 68 61 72 64 77 61  |ed out by hardwa|
00001540  72 65 2c 20 6e 6f 74 20  73 6f 66 74 77 61 72 65  |re, not software|
00001550  2e 0d 0d 54 68 69 73 20  73 69 6d 75 6c 61 74 69  |...This simulati|
00001560  6f 6e 20 61 6c 6c 6f 77  65 64 20 6d 65 20 74 6f  |on allowed me to|
00001570  20 64 65 76 65 6c 6f 70  20 74 68 65 20 73 69 6d  | develop the sim|
00001580  75 6c 61 74 69 6f 6e 20  76 65 72 79 20 65 61 73  |ulation very eas|
00001590  69 6c 79 2c 20 61 6e 64  20 61 73 0d 74 68 65 20  |ily, and as.the |
000015a0  41 49 20 6d 6f 64 75 6c  65 20 77 61 73 20 69 6e  |AI module was in|
000015b0  20 42 41 53 49 43 20 69  74 20 63 6f 75 6c 64 20  | BASIC it could |
000015c0  62 65 20 61 64 61 70 74  65 64 20 74 6f 20 6f 76  |be adapted to ov|
000015d0  65 72 63 6f 6d 65 20 66  61 75 6c 74 73 20 77 69  |ercome faults wi|
000015e0  74 68 0d 6c 69 74 74 6c  65 20 64 69 66 66 69 63  |th.little diffic|
000015f0  75 6c 74 79 2e 20 41 74  20 66 69 72 73 74 20 49  |ulty. At first I|
00001600  20 70 6c 61 63 65 64 20  74 65 6e 6e 69 73 20 62  | placed tennis b|
00001610  61 6c 6c 73 20 6f 6e 20  74 68 65 20 63 6f 75 72  |alls on the cour|
00001620  74 20 62 79 20 63 6c 69  63 6b 69 6e 67 0d 77 69  |t by clicking.wi|
00001630  74 68 20 74 68 65 20 6d  6f 75 73 65 2c 20 61 6e  |th the mouse, an|
00001640  64 20 74 68 65 6e 20 77  61 74 63 68 65 64 20 74  |d then watched t|
00001650  68 65 20 72 6f 62 6f 74  20 6d 6f 76 65 20 72 6f  |he robot move ro|
00001660  75 6e 64 20 74 6f 20 63  6f 6c 6c 65 63 74 20 74  |und to collect t|
00001670  68 65 6d 2e 0d 4c 61 74  65 72 2c 20 77 68 65 6e  |hem..Later, when|
00001680  20 74 68 65 20 72 6f 62  6f 74 20 77 61 73 20 6d  | the robot was m|
00001690  6f 72 65 20 72 65 6c 69  61 62 6c 65 2c 20 49 20  |ore reliable, I |
000016a0  61 64 64 65 64 20 61 20  66 65 61 74 75 72 65 20  |added a feature |
000016b0  74 6f 20 74 68 65 0d 73  69 6d 75 6c 61 74 69 6f  |to the.simulatio|
000016c0  6e 20 77 68 69 63 68 20  61 6c 6c 6f 77 65 64 20  |n which allowed |
000016d0  74 68 65 20 63 6f 6d 70  75 74 65 72 20 74 6f 20  |the computer to |
000016e0  72 61 6e 64 6f 6d 6c 79  20 70 6c 61 63 65 20 62  |randomly place b|
000016f0  61 6c 6c 73 20 6f 6e 20  74 68 65 20 63 6f 75 72  |alls on the cour|
00001700  74 0d 69 74 73 65 6c 66  2c 20 77 69 74 68 6f 75  |t.itself, withou|
00001710  74 20 74 68 65 20 75 73  65 72 2c 20 61 6e 64 20  |t the user, and |
00001720  74 68 65 6e 20 73 65 74  20 74 68 65 20 41 49 20  |then set the AI |
00001730  6d 6f 64 75 6c 65 20 74  6f 20 74 72 79 20 74 6f  |module to try to|
00001740  20 63 6f 6c 6c 65 63 74  0d 74 68 65 6d 2e 20 54  | collect.them. T|
00001750  68 65 20 73 69 6d 75 6c  61 74 69 6f 6e 20 70 72  |he simulation pr|
00001760  6f 64 75 63 65 64 20 61  20 6c 6f 67 20 6f 66 20  |oduced a log of |
00001770  61 6c 6c 20 6f 66 20 74  68 65 20 72 75 6e 73 2c  |all of the runs,|
00001780  20 77 69 74 68 20 61 20  6a 75 64 67 65 6d 65 6e  | with a judgemen|
00001790  74 0d 6f 66 20 68 6f 77  20 77 65 6c 6c 20 69 74  |t.of how well it|
000017a0  20 77 65 6e 74 2e 20 49  66 20 74 68 65 20 41 49  | went. If the AI|
000017b0  20 6d 6f 64 75 6c 65 20  73 75 63 63 65 73 73 66  | module successf|
000017c0  75 6c 6c 79 20 63 6f 6c  6c 65 63 74 65 64 20 61  |ully collected a|
000017d0  6c 6c 20 6f 66 20 74 68  65 0d 62 61 6c 6c 73 2c  |ll of the.balls,|
000017e0  20 61 6e 64 20 72 65 74  75 72 6e 65 64 20 74 68  | and returned th|
000017f0  65 2c 20 74 6f 20 74 68  65 20 22 68 6f 6d 65 22  |e, to the "home"|
00001800  20 73 70 6f 74 2c 20 69  74 20 67 61 76 65 20 61  | spot, it gave a|
00001810  20 22 50 41 53 53 22 2e  20 49 66 20 69 74 0d 66  | "PASS". If it.f|
00001820  61 69 6c 65 64 20 74 6f  20 63 6f 6c 6c 65 63 74  |ailed to collect|
00001830  20 61 6c 6c 20 74 68 65  20 62 61 6c 6c 73 20 69  | all the balls i|
00001840  74 20 72 65 74 75 72 6e  65 64 20 22 46 41 49 4c  |t returned "FAIL|
00001850  22 2e 20 4f 74 68 65 72  20 72 65 73 70 6f 6e 73  |". Other respons|
00001860  65 73 20 77 65 72 65 0d  67 69 76 65 6e 20 66 6f  |es were.given fo|
00001870  72 20 63 72 61 73 68 69  6e 67 20 69 6e 74 6f 20  |r crashing into |
00001880  74 68 65 20 6e 65 74 20  6f 72 20 72 65 61 63 68  |the net or reach|
00001890  69 6e 67 20 61 20 70 6f  69 6e 74 20 6f 66 20 69  |ing a point of i|
000018a0  6e 64 65 63 69 73 69 6f  6e 20 28 69 2e 65 2e 0d  |ndecision (i.e..|
000018b0  74 68 65 20 72 6f 62 6f  74 20 6a 75 73 74 20 66  |the robot just f|
000018c0  72 6f 7a 65 20 75 70 29  2e 20 4c 61 74 65 72 20  |roze up). Later |
000018d0  49 20 63 6f 75 6c 64 20  77 61 74 63 68 20 74 68  |I could watch th|
000018e0  65 20 66 61 69 6c 65 64  20 72 75 6e 73 20 6d 79  |e failed runs my|
000018f0  73 65 6c 66 2c 20 61 6e  64 0d 73 74 75 64 79 20  |self, and.study |
00001900  74 68 65 6d 20 74 6f 20  66 69 6e 64 20 6f 75 74  |them to find out|
00001910  20 77 68 61 74 20 77 65  6e 74 20 77 72 6f 6e 67  | what went wrong|
00001920  2e 20 49 20 66 6f 75 6e  64 20 69 74 20 75 73 65  |. I found it use|
00001930  66 75 6c 20 74 6f 20 64  65 76 65 6c 6f 70 20 74  |ful to develop t|
00001940  68 65 0d 41 49 20 6d 6f  64 75 6c 65 27 73 20 63  |he.AI module's c|
00001950  6f 64 65 20 64 75 72 69  6e 67 20 74 68 65 20 64  |ode during the d|
00001960  61 79 74 69 6d 65 2c 20  61 6e 64 20 74 68 65 6e  |aytime, and then|
00001970  20 6c 65 61 76 65 20 74  68 65 20 63 6f 6d 70 75  | leave the compu|
00001980  74 65 72 0d 73 69 6d 75  6c 61 74 69 6f 6e 20 72  |ter.simulation r|
00001990  75 6e 6e 69 6e 67 20 6f  6e 20 69 74 73 20 6f 77  |unning on its ow|
000019a0  6e 20 6f 76 65 72 6e 69  67 68 74 20 73 6f 20 74  |n overnight so t|
000019b0  68 61 74 20 49 20 63 6f  75 6c 64 20 73 65 65 20  |hat I could see |
000019c0  77 68 61 74 20 61 72 65  61 73 0d 73 74 69 6c 6c  |what areas.still|
000019d0  20 6e 65 65 64 65 64 20  61 74 74 65 6e 74 69 6f  | needed attentio|
000019e0  6e 2e 0d 0d 54 68 69 73  20 63 6f 6d 70 75 74 65  |n...This compute|
000019f0  72 20 73 69 6d 75 6c 61  74 69 6f 6e 20 72 75 6e  |r simulation run|
00001a00  73 20 69 6e 20 72 65 61  6c 2d 74 69 6d 65 2c 20  |s in real-time, |
00001a10  73 6f 20 74 68 61 74 20  74 68 65 20 72 6f 62 6f  |so that the robo|
00001a20  74 20 6f 6e 20 74 68 65  0d 73 63 72 65 65 6e 20  |t on the.screen |
00001a30  6d 6f 76 65 73 20 61 72  6f 75 6e 64 20 69 6e 20  |moves around in |
00001a40  74 68 65 20 73 61 6d 65  20 74 69 6d 65 2d 73 63  |the same time-sc|
00001a50  61 6c 65 20 61 73 20 77  6f 75 6c 64 20 74 68 65  |ale as would the|
00001a60  20 72 65 61 6c 20 72 6f  62 6f 74 20 69 6e 0d 72  | real robot in.r|
00001a70  65 61 6c 69 74 79 2e 20  54 68 69 73 20 67 69 76  |eality. This giv|
00001a80  65 73 20 6d 65 20 61 20  62 65 74 74 65 72 20 6a  |es me a better j|
00001a90  75 64 67 65 6d 65 6e 74  20 61 73 20 74 6f 20 77  |udgement as to w|
00001aa0  68 65 74 68 65 72 20 6f  72 20 6e 6f 74 20 74 68  |hether or not th|
00001ab0  65 20 73 70 65 65 64 0d  69 73 20 61 63 63 65 70  |e speed.is accep|
00001ac0  74 61 62 6c 65 20 74 68  61 6e 20 77 6f 75 6c 64  |table than would|
00001ad0  20 73 74 61 74 69 73 74  69 63 73 20 61 6c 6f 6e  | statistics alon|
00001ae0  65 2e 20 49 6e 20 6f 72  64 65 72 20 74 6f 20 6d  |e. In order to m|
00001af0  61 6b 65 20 74 68 65 20  73 69 6d 75 6c 61 74 69  |ake the simulati|
00001b00  6f 6e 0d 72 65 61 6c 2d  74 69 6d 65 2c 20 49 20  |on.real-time, I |
00001b10  68 61 64 20 74 6f 20 72  65 73 65 61 72 63 68 20  |had to research |
00001b20  74 68 65 20 65 78 61 63  74 20 64 69 6d 65 6e 73  |the exact dimens|
00001b30  69 6f 6e 73 20 6f 66 20  61 20 74 65 6e 6e 69 73  |ions of a tennis|
00001b40  20 63 6f 75 72 74 20 74  6f 0d 6b 6e 6f 77 20 68  | court to.know h|
00001b50  6f 77 20 66 61 73 74 20  74 68 65 20 72 6f 62 6f  |ow fast the robo|
00001b60  74 20 77 69 6c 6c 20 6d  6f 76 65 20 72 65 6c 61  |t will move rela|
00001b70  74 69 76 65 20 74 6f 20  6c 61 6e 64 6d 61 72 6b  |tive to landmark|
00001b80  73 20 6f 6e 20 74 68 65  20 63 6f 75 72 74 2e 0d  |s on the court..|
00001b90  0d 57 68 65 6e 20 49 20  68 61 64 20 64 65 76 65  |.When I had deve|
00001ba0  6c 6f 70 65 64 20 74 68  65 20 41 49 20 6d 6f 64  |loped the AI mod|
00001bb0  75 6c 65 20 69 6e 20 42  41 53 49 43 20 73 6f 20  |ule in BASIC so |
00001bc0  74 68 61 74 20 69 74 20  77 61 73 20 77 6f 72 6b  |that it was work|
00001bd0  69 6e 67 0d 63 6f 6e 73  69 73 74 65 6e 74 6c 79  |ing.consistently|
00001be0  2c 20 49 20 68 61 64 20  74 6f 20 74 72 61 6e 73  |, I had to trans|
00001bf0  6c 61 74 65 20 74 68 65  20 6d 6f 64 75 6c 65 20  |late the module |
00001c00  69 6e 74 6f 20 36 35 30  32 20 6d 61 63 68 69 6e  |into 6502 machin|
00001c10  65 20 63 6f 64 65 2e 0d  41 6c 74 68 6f 75 67 68  |e code..Although|
00001c20  20 42 41 53 49 43 20 69  73 20 65 61 73 69 65 72  | BASIC is easier|
00001c30  20 74 6f 20 77 6f 72 6b  20 77 69 74 68 2c 20 69  | to work with, i|
00001c40  74 20 77 6f 75 6c 64 20  6e 6f 74 20 62 65 20 66  |t would not be f|
00001c50  65 61 73 61 62 6c 65 20  74 6f 20 72 75 6e 20 74  |easable to run t|
00001c60  68 65 0d 63 6f 64 65 20  69 6e 20 74 68 65 20 66  |he.code in the f|
00001c70  69 6e 61 6c 20 72 6f 62  6f 74 20 6f 72 20 74 68  |inal robot or th|
00001c80  65 20 70 72 6f 74 6f 74  79 70 65 20 69 6e 20 42  |e prototype in B|
00001c90  41 53 49 43 2e 20 4d 61  63 68 69 6e 65 20 63 6f  |ASIC. Machine co|
00001ca0  64 65 20 6e 6f 74 20 6f  6e 6c 79 0d 72 75 6e 73  |de not only.runs|
00001cb0  20 66 61 73 74 65 72 2c  20 62 75 74 20 69 73 20  | faster, but is |
00001cc0  61 6c 73 6f 20 74 68 65  20 6f 6e 6c 79 20 6c 61  |also the only la|
00001cd0  6e 67 75 61 67 65 20 77  68 69 63 68 20 6d 69 63  |nguage which mic|
00001ce0  72 6f 70 72 6f 63 65 73  73 6f 72 73 0d 63 61 6e  |roprocessors.can|
00001cf0  20 69 6e 74 65 72 70 72  65 74 20 77 69 74 68 6f  | interpret witho|
00001d00  75 74 20 73 70 65 63 69  61 6c 20 73 6f 66 74 77  |ut special softw|
00001d10  61 72 65 20 62 65 69 6e  67 20 70 72 65 73 65 6e  |are being presen|
00001d20  74 20 28 77 68 69 63 68  20 77 69 6c 6c 20 6e 6f  |t (which will no|
00001d30  74 20 62 65 0d 74 68 65  20 63 61 73 65 20 69 6e  |t be.the case in|
00001d40  20 74 68 65 20 74 68 65  20 66 69 6e 61 6c 20 72  | the the final r|
00001d50  6f 62 6f 74 29 2e 0d 0d  57 68 65 6e 20 74 68 65  |obot)...When the|
00001d60  20 6d 6f 64 75 6c 65 20  68 61 64 20 62 65 65 6e  | module had been|
00001d70  20 63 6f 6e 76 65 72 74  65 64 20 69 6e 74 6f 20  | converted into |
00001d80  6d 61 63 68 69 6e 65 20  63 6f 64 65 2c 20 49 20  |machine code, I |
00001d90  62 65 67 61 6e 20 74 65  73 74 69 6e 67 20 69 74  |began testing it|
00001da0  0d 6f 6e 20 61 20 42 42  43 2c 20 61 73 20 6f 70  |.on a BBC, as op|
00001db0  70 6f 73 65 64 20 74 6f  20 61 6e 20 41 72 63 68  |posed to an Arch|
00001dc0  69 6d 65 64 65 73 2c 20  61 73 20 74 68 69 73 20  |imedes, as this |
00001dd0  63 6f 6d 70 75 74 65 72  20 72 75 6e 73 20 6f 6e  |computer runs on|
00001de0  20 61 20 36 35 30 32 0d  70 72 6f 63 65 73 73 6f  | a 6502.processo|
00001df0  72 2c 20 61 6e 64 20 73  6f 20 61 63 63 65 70 74  |r, and so accept|
00001e00  73 20 74 68 69 73 20 66  6f 72 6d 20 6f 66 20 6d  |s this form of m|
00001e10  61 63 68 69 6e 65 20 63  6f 64 65 2e 20 46 69 72  |achine code. Fir|
00001e20  73 74 20 49 20 75 73 65  64 20 61 0d 63 6f 6e 76  |st I used a.conv|
00001e30  65 72 73 69 6f 6e 20 6f  66 20 74 68 65 20 73 69  |ersion of the si|
00001e40  6d 75 6c 61 74 69 6f 6e  20 74 6f 20 63 68 65 63  |mulation to chec|
00001e50  6b 20 74 68 61 74 20 74  68 65 20 63 6f 6e 76 65  |k that the conve|
00001e60  72 73 69 6f 6e 20 68 61  64 20 62 65 65 6e 0d 73  |rsion had been.s|
00001e70  75 63 63 65 73 73 66 75  6c 2e 20 49 20 66 6f 75  |uccessful. I fou|
00001e80  6e 64 20 74 68 61 74 20  65 76 65 6e 20 77 69 74  |nd that even wit|
00001e90  68 6f 75 74 20 68 61 76  69 6e 67 20 74 6f 20 72  |hout having to r|
00001ea0  75 6e 20 74 68 65 20 41  49 20 6d 6f 64 75 6c 65  |un the AI module|
00001eb0  20 69 6e 0d 42 41 53 49  43 2c 20 74 68 65 20 42  | in.BASIC, the B|
00001ec0  42 43 20 73 69 6d 75 6c  61 74 69 6f 6e 20 72 61  |BC simulation ra|
00001ed0  6e 20 73 6c 6f 77 6c 79  20 61 74 20 6f 6e 6c 79  |n slowly at only|
00001ee0  20 31 2f 32 30 74 68 20  6f 66 20 72 65 61 6c 20  | 1/20th of real |
00001ef0  73 70 65 65 64 2e 20 45  76 65 6e 0d 73 6f 2c 20  |speed. Even.so, |
00001f00  49 20 77 61 73 20 61 62  6c 65 20 74 6f 20 75 73  |I was able to us|
00001f10  65 20 69 74 20 74 6f 20  66 69 6e 64 20 61 20 66  |e it to find a f|
00001f20  65 77 20 62 75 67 73 20  77 68 69 63 68 20 68 61  |ew bugs which ha|
00001f30  64 20 63 72 6f 70 70 65  64 20 75 70 20 64 75 72  |d cropped up dur|
00001f40  69 6e 67 20 74 68 65 0d  74 72 61 6e 73 66 65 72  |ing the.transfer|
00001f50  2c 20 61 6e 64 20 72 65  6d 6f 76 65 20 74 68 65  |, and remove the|
00001f60  6d 20 66 72 6f 6d 20 74  68 65 20 63 6f 64 65 2e  |m from the code.|
00001f70  0d 0d 44 65 76 65 6c 6f  70 6d 65 6e 74 20 6f 66  |..Development of|
00001f80  20 74 68 65 20 42 61 6c  6c 42 6f 74 20 4d 4f 53  | the BallBot MOS|
00001f90  0d 0d 57 68 65 6e 20 74  68 65 20 41 49 20 6d 6f  |..When the AI mo|
00001fa0  64 75 6c 65 20 68 61 64  20 62 65 65 6e 20 73 75  |dule had been su|
00001fb0  63 63 65 73 73 66 75 6c  6c 79 20 63 6f 6e 76 65  |ccessfully conve|
00001fc0  72 74 65 64 20 74 6f 20  74 68 65 20 42 42 43 2c  |rted to the BBC,|
00001fd0  20 49 20 62 65 67 61 6e  0d 64 65 76 65 6c 6f 70  | I began.develop|
00001fe0  69 6e 67 20 61 20 4d 4f  53 20 28 4d 61 63 68 69  |ing a MOS (Machi|
00001ff0  6e 65 20 4f 70 65 72 61  74 69 6e 67 20 53 79 73  |ne Operating Sys|
00002000  74 65 6d 29 20 75 6e 64  65 72 20 77 68 69 63 68  |tem) under which|
00002010  20 69 74 20 77 6f 75 6c  64 20 6f 70 65 72 61 74  | it would operat|
00002020  65 2e 0d 54 68 69 73 20  72 65 61 64 73 20 69 6e  |e..This reads in|
00002030  70 75 74 20 66 72 6f 6d  20 61 6e 20 55 6c 74 72  |put from an Ultr|
00002040  61 73 6f 6e 69 63 73 20  6d 6f 64 75 6c 65 2c 20  |asonics module, |
00002050  61 6e 64 20 74 68 65 6e  20 70 61 73 73 65 73 20  |and then passes |
00002060  74 68 65 20 64 61 74 61  20 74 6f 0d 74 68 65 20  |the data to.the |
00002070  41 49 20 6d 6f 64 75 6c  65 2e 20 57 68 65 6e 20  |AI module. When |
00002080  74 68 65 20 41 49 20 6d  6f 64 75 6c 65 20 68 61  |the AI module ha|
00002090  73 20 66 69 6e 69 73 68  65 64 20 70 72 6f 63 65  |s finished proce|
000020a0  73 73 69 6e 67 20 74 68  65 20 64 61 74 61 2c 20  |ssing the data, |
000020b0  69 74 0d 74 61 6b 65 73  20 74 68 65 20 6d 6f 74  |it.takes the mot|
000020c0  6f 72 20 63 6f 6e 74 72  6f 6c 20 64 61 74 61 20  |or control data |
000020d0  61 6e 64 20 73 65 6e 64  73 20 69 74 20 74 6f 20  |and sends it to |
000020e0  74 68 65 20 42 42 43 27  73 20 6f 75 74 70 75 74  |the BBC's output|
000020f0  20 70 6f 72 74 73 20 74  6f 20 62 65 0d 61 63 74  | ports to be.act|
00002100  65 64 20 75 70 6f 6e 20  62 79 20 74 68 65 20 68  |ed upon by the h|
00002110  61 72 64 77 61 72 65 2e  0d 0d 54 68 69 73 20 73  |ardware...This s|
00002120  6d 61 6c 6c 20 6d 6f 64  75 6c 65 20 69 73 20 61  |mall module is a|
00002130  63 74 75 61 6c 6c 79 20  61 20 76 65 72 79 20 73  |ctually a very s|
00002140  69 6d 70 6c 65 20 70 69  65 63 65 20 6f 66 20 63  |imple piece of c|
00002150  6f 64 65 20 2d 20 69 74  73 20 73 6f 6c 65 0d 70  |ode - its sole.p|
00002160  75 72 70 6f 73 65 20 69  73 20 74 6f 20 70 61 73  |urpose is to pas|
00002170  73 20 64 61 74 61 20 66  72 6f 6d 20 6f 6e 65 20  |s data from one |
00002180  6d 6f 64 75 6c 65 20 74  6f 20 61 6e 6f 74 68 65  |module to anothe|
00002190  72 2c 20 61 6e 64 20 74  6f 20 6b 65 65 70 20 61  |r, and to keep a|
000021a0  6c 6c 20 6f 66 20 74 68  65 0d 6d 6f 64 75 6c 65  |ll of the.module|
000021b0  73 20 77 6f 72 6b 69 6e  67 20 74 6f 67 65 74 68  |s working togeth|
000021c0  65 72 20 69 6e 20 74 69  6d 65 20 77 69 74 68 20  |er in time with |
000021d0  6f 6e 65 20 61 6e 6f 74  68 65 72 2e 0d           |one another..|
000021dd
BallBot/Part1.m0
BallBot/Part1.m1
BallBot/Part1.m2
BallBot/Part1.m4
BallBot/Part1.m5