Mark Topham continues his look at the Roamer Sensor capability.
Summary: Roamer responds to different inputs by executing specified sense
procedures. The sense procedure is like any other procedure, except it
is referred to in a sense instruction. Once the sense procedure has been
executed, the Roamer returns to where it left the GO Program and executes
the remaining instructions. There are options to change this mode of behaviour;
instead of returning to GO the Roamer can:
Stop - Roamer will complete the procedure then stop.
Keep on repeating the procedure. The Roamer will only stop this if
the repeating the procedure contains its own sense instruction and the
Roamer receives a valid input.
Rescuing Rotherhithe Young Rotherhithe Roamer was a spoilt brat. If he didn't get his own
way he would overload his circuits and fuse his eyes. One summer, on holiday
by Roamoor, he ignored the warning signs and wandered off into the marshes.
The mist came down and a rescue party was called out to look for Rotherhithe.
Unfortunately they found him before his mother arrived to tell them not
to bother.
Place a box in an open area. Make Roamer into a search
and rescue robot. It should have a touch sensor at the front, a search
lamp (Output 1) and beacon light (Output 2). Program the Roamer to
search the area to find the box, send out signals when it has found
it and stay at the location point.
GO Program
Set stop mode.
Sense Instruction. If the object is found execute Sense Procedure
1.
Set output 1 High.
Switch on the torch.
Repeat a search pattern 6 times.
Sense Procedures
Turn off the torch.
Sound a signal and flash the beacon light.
The Roamer switches on its torch and moves on the search pattern defined
in GO. When it finds the box it transmits the sound signal, flashes
its rescue beacon and then stops. Without the stop mode the Roamer
would want to return to GO and continue executing the search pattern.
The Narnia Pool Table Kidnap Prince Roamer was kidnapped several times during his career as a monarch.
Once he was captured by a wicked witch, stolen from another story. The
witch turned everyone to stone in her courtyard. When the royal guards
came to rescue the Prince (he had the keys to the pool table and they
wanted a game) they fooled the witch by standing like statues every time
she came into the courtyard. The Prince signalled by clapping when she
was coming and clapping again when she was gone. The Prince was rescued,
the guards got their game of pool, the witch was sorted out by an escaped
lion and some scruffy kids from the 1950s and everyone lived happily ever
after.
Fit the Roamer with a sound sensor. Program it to move
across an open space. Program it to stop when clapped at, then stay
still until its clapped at again.
In this problem the sense procedure contains a Wait instruction. How
long should the wait be?
GO Program
Change to Repeat mode.
Sense Instruction. If a sound is heard execute Sense Procedure 5.
Move forward 10 units.
Sense Procedures
If a sound is heard execute Sense Procedure 2.
When using the Repeat mode it essential to include another Sense
Instruction in the 'Repeated' Sense Procedure. Otherwise it would
be impossible to stop repeating.
Wait 10 seconds.
Reinstate the first Sense Instruction.
When GO is pressed the Roamer will move forward. If it receives the
correct type of input then Sense Procedure 5 is executed - the Roamer
will wait for 10 seconds. This procedure will be repeated until another
sound is heard. In other words the Roamer will wait for seconds or
hours for another sound. When this occurs sense procedure 2 reinstates
the original sense instruction and Roamer returns to complete the
GO Program.