actions. First, connect a Bluetooth transceiver (or other
serial communication device), two DC motors, and five
digital perimeter sensors (such as the Sharp GP2Y0D810Z0F
from Pololu in Figure 4) as shown in Figure 5.
M1 represents the left motor and M2, the right one.
Notice that the only extra circuitry needed is a regulator to
provide a five volt supply for most of the components.
Mount the motors and perimeter sensors on an appropriate
base and you are done. Yes, that is it!
The program in Figure 2 — with minor modifications —
can now control the robot you have just built. There are no
programs to compile, no complicated syntax, and nothing
to download. You just run the program on a Bluetooth
equipped PC and the remote robot will move forward until
it detects a wall, then turn away based on the sensors that
were triggered — just like the simulation.
The changes that must be made to control the real
robot consist primarily of some initialization procedures that
inform the RROS chip that DC motors and digital sensors
are being used. This can be done by substituting the
Initialization subroutine shown in Figure 6 for the one
shown in Figure 2.
The first line of the subroutine in Figure 6 includes a
library file that — when called by the next line in the figure
— defines numerous constants that make it easier to use
the RROS. The next line in the subroutine uses the
rCommPort command to tell RobotBASIC the number of
the serial port used by your USB Bluetooth transceiver that
communicated with the RROS chip.
Next, the rLocate statement is used to initialize the real
robot just as it was previously used to initialize the
simulation. Finally, two rCommands are used to tell the
RROS chip what motors and sensors are currently in use.
Many rCommands are available for calibrating various
aspects of the RROS.
With this small change, the program in Figure 2 will
automatically communicate with the RROS chip,
telling it what actions are expected from the
motors and what data is needed from sensors.
Once these commands are received, the RROS
will control the robot’s motors on its own
without the need for specific direction from the
application program. Sensory data will
automatically be collected by the RROS and
appropriately formatted before it is returned to
RobotBASIC. Our example robot used DC motors
and digital sensors, but it is important to realize
that this same program could be used to control
a servomotor-powered robot that used PING)))
sensors — or any robot using a supported
sensory configuration. Remember too that the
RROS does not just manage perimeter sensors. It
also oversees tasks dealing with battery
monitoring, line sensors, beacon detection,
reading a compass, and much, much more.
62 SERVO 09.2012