www.RobotBasic.org). As you can see, just displaying a
face on the tablet can give your robot a little personality.
Future articles in this series will discuss the mounting of the
tablet, as well as how to utilize the text-to-speech
capabilities of Windows 8 to give the robot a voice that is
synchronized with the face’s mouth movements.
If you are thinking of purchasing a tablet to control
your robot, the specifications can vary greatly, so it is
important to consider your particular needs. For example,
some models sacrifice speed in exchange for lighter weight
or longer battery life, but remember, even the slowest
models are far more capable than the microcontrollers
typically used in most hobby robots.
Since most Windows tablets support a standard
keyboard docking option, they can also be used as a
development station. This eliminates the need to write code
on one machine and download it to another for testing
— a feature that can reduce development time considerably.
For many people, this feature alone would be worth using a
tablet as a robot controller.
While size, weight, and speed are important
considerations, Windows 8 tablets offer so much more. All
models come with three-axis gyroscopes, accelerometers,
and magnetometers. If you have worked with such sensors,
you know it can take some serious mathematics to blend
their outputs into usable data. Microsoft’s Fusion
technology handles all that for you, creating both a tilt-compensated compass and a virtual inclinometer with
amazing stability and accuracy.
Additionally, all Windows 8 tablets have one (and
sometimes two) camera, an ambient light sensor, and
standardized internal firmware for interfacing with
compatible USB GPS units. Adding all these tablet features
to the standard sensors often found on hobby robots can
produce a robot with amazing capabilities. Accessing the
internal sensors, though, generally requires using Window’s
8 programming tools for Metro-Style-Apps — tools that
might not be your first choice for programming a robot.
In order to make the tablet’s sensors available to a
wide variety of desktop-style programming languages, we
designed a Sensors Interface Utility program and contracted
Windows’ developer Shobhan Taparia to create an initial
shell program for us. This gave us an immediate way to
begin experimenting, and provided us a basic framework
that we could modify and improve upon.
During the design phase, we had to decide how our
utility program would communicate with the desktop
application. We needed an approach that was relatively fast
and reliable, yet one that could be used with a wide variety
of languages, including our preferred language —
RobotBASIC (a free language that can be downloaded from
Since most modern languages have functions for
dealing with the clipboard, we decided that the Sensors
Interface Utility would communicate with primary control
programs using the clipboard. For example, if a program
wants to read the sensors, it would simply put the
command word sensors on the clipboard and the utility
program should respond by filling the clipboard with the
sensor data in a specific format.
The only problem this scheme has is that both the
utility and the application are constantly monitoring the
clipboard. Since the clipboard is generally accessed manually
for copy-and-paste operations, it appears that Microsoft
never worried about two programs accessing it
simultaneously, because our tests showed that such an
action can cause errors in either program.
We solved this problem by developing a hand-shaking
arrangement using a simple text file. When the file’s name
is Sensors Turn.txt, the utility program knows it should look
at the clipboard for a command. After placing the
requested data on the clipboard, the utility renames the file
to RBs Turn.txt, telling RobotBASIC (or another
programming language of your choosing) that the data is
ready to be accessed.
The above process might sound complicated, but it is
actually very easy to implement as shown in the
RobotBASIC program in Figure 2 which obtains and
displays the tilt and compass data using the utility program.
The program is short because RobotBASIC has many
high level commands to perform actions such as renaming
files and parsing strings. If you wish to use a different
language, use the comments in the program to understand
what is happening and duplicate the actions with the
commands available in your language.
The commented program should be easy to follow, but
we will still need a short discussion of how the clipboard
data is formatted. The data placed on the clipboard by the
SERVO 12.2013 59