During a recent discussion with fellow robot enthusiast, Steven Canning, we explored the idea that a proper robot should be able to perform an
internal self-diagnostic routine to verify its operational
status. My first thoughts were somewhat negative. Let’s
look at an example to help clarify my initial concerns.
Assume your robot has a compass to determine its
orientation and wheel encoders to measure the movement
of its wheels. You could attempt to check the compass by
using the wheel encoders to turn the robot 90° and then
verify that the compass readings reflect that movement. If
the readings are wrong though, the error might not be the
compass’ fault because it is possible that the robot is not
making the 90° turn due to problems with its wheel
encoding sensors (or even with the motors themselves). Of
course, you could personally move the robot 90°, but that
defeats the purpose of having the robot perform a self-test.
In general, in order to test any of its sensors, a robot
has to perform some action that alters the sensor’s state in
a predicted way. When the test fails, the question becomes,
how do we know if the sensor is failing, or if the robot is
not performing the action (or at least not performing it
accurately)?
This could be an unsurmountable problem — unless you
know, or can verify, that one of your robot’s sensors is, in
fact, working correctly. If we knew in the previous example,
for instance, that the wheel encoders produced accurate
movements, then it would be easy to test the compass. If a
robot has numerous sensors, this technique can be even
more effective. You could use one working sensor to verify
that a second works — then use either or both of those
sensors to check the operation of a third sensor. At that
point, you would have three sensors to check the operation
of a fourth. The more sensors your robot has, the more
options you have when creating a diagnostic routine.
Using a Robot Simulator
The RobotBASIC simulated robot is a great way to
experiment with this idea for several reasons. First, the
simulation has numerous sensors including wheel encoders,
Since RobotBASIC is free for everyone (download it
from www.RobotBASIC.org), it provides an easy-to-use
common platform for testing a variety of ideas before
implementing them on your own robot using your own
programming tools and sensors. Finally, if your robot is built
using the RobotBASIC Robot Operating System (RROS),
then programs developed on the simulator can be used to
control your real robot with minor modifications. Even if
your robot is based on an entirely different platform,
RobotBASIC’s simple BASIC syntax (which is very much like
its own pseudo code) makes it easy to translate algorithms
to your language of choice.
The goal of this article is to present a program that can
test many of the simulator sensors listed above. Ideally, the
program will demonstrate principles that will inspire others
to create similar functionality for their own robots. To that
end, let’s examine what is needed to write such a program.
As mentioned earlier, it can be difficult — if not
impossible — to determine if various sensors are working
properly unless we have at least one sensor (or sensor
subsystem) that we know is working correctly. After
considering ways of testing each of the simulator’s sensors,
it occurred to me that the line sensors might be testable
without using any of the other sensors, as long as it can be
assumed the robot can perform basic movements (even if
such movements are not perfectly accurate). If this could be
done, the line sensors can be used to test other sensors as
described earlier. Let’s see how the line sensors could be
autonomously tested.
The Testing Environment
We will assume that the robot to be tested is placed in
a known test environment. One of the properties of this
environment is that it will have a line on the floor that is
just wide enough to trigger all three of the line sensors. It
will also be assumed that at the start of the test, the robot
will be placed on this line with all three line sensors
Have you ever packed up your robot and taken it to a club meeting with the
intent of demonstrating all your work to a room full of hobbyists only to find
that a loose connection made both you and your robot look, not just
unprepared, but totally inept? If your robot had an internal self-testing
program, it could have saved the day for you. Read on to discover some
concepts to help you develop such a program for your robot.
38 SERVO 12.2016
Self-Diagnostics