creating enthusiasm for a lecture on
proportional or PID control.
The primary image in Figure 3 is a picture
of a motor assembly actually used by a college
student in a microprocessor lab. RobotBASIC’s
ability to resize, rotate, and position photos of
actual motors made it easy to create these
realistic demonstrations. When you use the
program, the animated pointers quickly feel
like they are part of the picture. The top of
the screen graphically displays the positions
of both pointers over time (simulating an
oscilloscope), making it easy to see how
well the motor tracks the manual pointer.
Figure 4 shows a simulated hobby servo
that can be controlled by sending it the pulse
width (in microseconds) of a periodic signal.
The servo’s 3D actuator moves a plate that
moves two eyes. Learning how to move a
robot’s eyes can be far more motivational than
just moving a stand-alone motor — especially if you don’t
have to spend a week constructing a model before you can
even start programming.
RobotBASIC has commands that allow vision algorithms
to be implemented using a standard webcam (see our
previous article on vision in the April ‘09 issue of SERVO).
Imagine developing a program that allows the eyes in
Figure 4 to track objects moving in front of your webcam-equipped laptop’s screen.
Using these techniques, a lecturing professor can easily
move the laboratory environment into the classroom where
students can immediately see the relevance of the material
being presented. Distance learning curricula can be
enhanced immensely because even students without access
to a laboratory can be given assignments to develop
algorithms for interesting applications.
Hobbyists can experiment with a wide variety of
situations without the frustrations and expenses associated
with constructing physical models (not to mention replacing
parts that are often damaged or destroyed during the
learning phase of many projects involving hardware
Figure 3: A DC motor and two
a platform for studying
It’s hard to imagine how realistic these simulations
can be without seeing them in action. If you select the
EDUCATION tab at www.RobotBASIC.com, the section
on Distance Learning provides a link to a video that
demonstrates each of the simulations we’ve discussed.
There is also a link to a zip file containing all the programs
(and the required image files), so you can try your hand
at programming solutions to these problems (don’t forget
to download your free copy of RobotBASIC). Commented
source code has been provided for all the programs
to encourage interested readers to create their own
The virtual environments described in this article are
aimed at mid-level students and hobbyists, but more
complex, high-level simulations are also possible. The
Distance Learning reference above also provides a link to
numerous videos showcasing various aspects of
RobotBASIC. One video entitled RobotBASIC Control
Application shows how quadrature-encoded position
data was used to implement heading control of both a
simulation and an actual model of a satellite in a friction
free environment. Source code for this demo is also
available on the RobotBASIC web page.
RobotBASIC is a general-purpose
programming language with an
integrated robot simulator. The
language has many features that
make it easy to develop professional
looking simulations. These include
double-buffered video output (for
flicker-free animation), the ability to
resize, rotate, and position pictures
of actual hardware, an easy-to-use
3D graphics engine, matrix math,
and extensive mathematical
functions. The new Version 4.0 of
the program is available for free
Figure 4: These simulated servo-controlled eyes can
be programmed to follow objects moving in front
of the screen on any webcam equipped PC.