FIGURE 7.
FIGURE 6.
that the goal has been reached.
MoveToBeacon:
// first face the beacon
rCommand(SetSpeed,40)
rCommand(SetTurnStyle,0)
while not rBeacon(0)
rTurn -1 // rotate to left
wend
// then move to it
rTurn 10
rCommand(SetTurnStyle,0)
while (rSense()&1) and not(rSense()&6)
rForward 1
if rBeacon(0)
rTurn 1
else
rTurn -1
endif
wend
return
Conclusion
This motion helps keep the ball in
the trap. The robot will turn left in this
manner as it looks for the beacon
located at the goal.
When the beacon is found, the
robot turns back to the right slightly
to ensure that it is aimed at the
62 SERVO 03.2013
beacon or a little to the right of it. It
then moves forward, turning to the
left when the beacon is not seen, and
to the right when it is. This action
effectively lets the robot follow the
beacon’s signal. It does so until one or
more of the front trap sensors indicate
We have provided an easy-to-understand example of how a robot
can locate and identify a ball within its
environment, and then move it to a
goal. A more robust algorithm for
obtaining the ball could certainly be
implemented — especially if additional
sensors are utilized.