Beacons
| There is a beacon at each end of the RoboRugby table, on the
centre-line of the table. The
two beacons transmit different signals, so your robot can tell which
beacon it can "see".
You can use these beacons to orient your robot, and
perhaps to guide it towards the correct scoring area in the RoboRugby
competition. |

|
Each beacon transmits bursts of infra-red light at regular intervals
in time. The beacon at one end of the table transmits about
every 5ms, the other about every 12ms. Note that these times
are approximate - 12ms could mean anything between 11ms and 13ms.
The beacons are mounted so that the light source is about 160mm
above the surface of the table, and about 90mm behind the inner
surface of the end wall. A shield is fitted just below the
light source, and extends about 85mm in front of the beacon.
Note that the shield does not overhang the playing surface, but
it does overhang the end wall. The purpose of the shield is
to reduce the amount of infra-red light close to the table surface,
and thus reduce interference with distance
sensors.
Beacon Receivers
To use the beacon signals, you need a beacon receiver. There is a beacon receiver built in to the
Handyboard, and we also provide an external beacon receiver (see
pictures below).
 |
 |
| Handyboard beacon receiver (arrow) |
External beacon receiver - connect to port 8 |
If you want to be able to receive a signal while
close to the beacon, you will have to mount the beacon receiver
at least 160mm above the table surface. This means mounting
the Handyboard high in your robot or using the external beacon
receiver. To use the external beacon receiver, you must connect
it to port 8 on the Handy-Board.
| If you want to use
a beacon signal to get direction information, you will have to shield
the beacon receiver so that it can only receive light from the
beacon over a small
range of angles.
Two possible shields are provided - you can
cut these to suit your needs, or devise an alternative. |

|
Software:
We provide software which returns the beacon time interval in micro-seconds. This
is contained in the beacons.icb
file. It should be saved in the lib/handyboard folder under Interactive C.
This software is written in assembly language - the native
language of the microprocessor on the Handyboard. When you
initialise it, it runs in the background, constantly measuring the
time interval of the signals received by the beacon receiver.
It also provides two new functions which you can call from your C
program.
To use this software, put the line
#use beacons.icb at the top of your program.
You now have two functions available to control and use the beacon receivers:
- beacon_init() is used to initialise the beacon
receivers, and to stop them if you no longer need them in your
program:
- beacon_init(0) disables both beacon receivers;
- beacon_init(1) enables the internal receiver,
disables the external receiver;
- beacon_init(2) enables the external receiver,
disables the internal receiver;
- beacon_init(3) enables both beacon receivers.
- beacon() is a function which returns the
time interval between the last two bursts of infra-red light received
by a beacon receiver:
- beacon(1) returns the time interval from
the internal receiver;
- beacon(2) returns the time interval from
the external receiver.
- The time value is in micro-seconds, and is returned as an integer.
If no infra-red light has been received recently, or if the beacon
receiver requested is not enabled, the function will return 0.
Note that having beacon receivers enabled puts a small
extra load on the Handyboard processor. You should only enable
the beacon receiver which you are using.
Suggestion: Make your programs easier to write and
to understand by hiding the details of the beacon time checking in a
function. See the example program below.
Interference
The two beacon signals on the table can
interfere with each other. Shielding around the beacon receiver
will normally prevent it from receiving the signals from both beacons
at the same time. However, the signals can bounce off objects
on the table, or just outside it, and arrive at the receiver from
unexpected directions.
If both beacon signals are received at the same time, the beacon
software can return a wide range
of time values. As the two beacons are not synchronised,
these false time values will change constantly, so your program
should be able to reject them.
The distance sensors also emit
infra-red light of similar frequency or wavelength to the beacons. The beam is very narrow, and it is very
unlikely to fall on a shielded beacon receiver. If light from a distance sensor
does reach a beacon receiver, it can prevent the receiver from receiving the beacon
signal - the software will return 0. It can also cause the beacon receiver software to
return the time interval of the light pulses from the distance sensor (around 1ms) instead
of the time interval of the beacon. Your program should reject such values.
Test Program
This program allows you to test your beacon receiver. It
is written for the internal beacon receiver. To use the
external
receiver, just change the definition of beaconRX.
// first tell compiler to use beacon software
#use beacons.icb
// note - cannot put comment on #use or # define
// define which beacon receiver to use: 1 internal, 2 external
#define beaconRX 1
void main()
{
int bcn; // define variable for beacon result
beacon_init(beaconRX); // turn on internal beacon receiver
while( !stop_button() ) // repeat until stop button pressed
{
bcn = checkbeacon(beaconRX); // get beacon value using function
printf("Beacon: %d\n", bcn); // print message
if( bcn == 12 ) // double beep for 12ms beacon
{
beep();
sleep(0.1);
beep();
}
else if (bcn ==5) //single beep for 5ms beacon
{
beep();
sleep(0.3);
}
sleep(0.4); // delay a bit anyway so display doesn't flicker
} // end of while
beacon_init(0); // turn off all receivers
printf("Stopped, Goodbye\n"); // print message
} // end of main function
/* Function to check beacon time, return 5 or 12 for beacon time or 0 if no valid signal.
Pass argument 1 for internal receiver or 2 for external receiver.
Main function must enable appropriate receiver first! */
int checkbeacon(int beacon_receiver)
{
int btime = beacon(beacon_receiver); // create variable and get beacon time
if((btime > 11000) && (btime < 13000)) return 12; //is it about 12ms?
else if((btime > 4000) && (btime < 6000)) return 5; // is it about 5ms?
else return 0; // if neither, return 0
} // end of checkbeacon function
Note the range of time values accepted as valid for each beacon.
This allows for some variation in the beacons, but should still
reject most false values due to interference. This simple example
does not do any more complicated checking - you can test it in various
situations and see how reliable it is.
|