|
Vision provided by
|
Pi Robot Theory
Pi Robot's Goals and Aspirations
Last updated: 02/15/10
Pi Robot was designed to provide a test bed for a number of ideas
in robotics, cognitive science and artificial intelligence. The
overall goal of the project is to build a robot that can move about
autonomously in both indoor and outdoor environments while
interacting with objects and people in the following basic ways:
Avoid obstacles and drop offs (like stairs). No point in
breaking the robot on its first trial run! (Although I have a funny
story about that...)
Navigate between any two locations in a known environment, or
generate an internal map of a new environment through exploration.
Orient and attend to interesting events such as moving
objects, sounds and specific targets. (e.g. "Watch the moving
baby while ignoring everything else.")
Be able to pick up, carry and otherwise manipulate objects in
the environment.
Recognize basic objects (balls, boxes, bushes, beer cans),
animals (dogs, cats) and people.
Recognize familiar individuals by name.
Follow a moving person in an appropriate way; e.g. three feet
to one side while facing forward.
Respond to basic verbal instructions using speech recognition
and text-to-speech.
Understand basic conceptual relationships among object
categories (e.g. semantic network).
Learn from experience.
Over the past several years, I have made some progress toward
several of these goals. However, one learns very quickly how complex
even the simplest tasks can be to program. Indeed, one of the
strengths of robotics is that it is nearly impossible to fake an
understanding of a particular perceptual or behavioral process. For
example, if your obstacle avoidance algorithm has a flaw, the robot
will run into things. By the same token, it is very gratifying when
you get an algorithm "right": suddenly the robot is able to
do something new right before your eyes.
In the following sections, I briefly summarize the approaches I
have taken toward the goals listed above. As more progress is made, I
will post updates on the Pi Robot blog.
Overall Programming Architecture
Pi Robot's control algorithms are part of a multi-threaded
behavioral program. The multi-threaded nature of the program allows
more than one action to be executed in parallel. For example, if you
watch the video of Pi
Robot tracking the yellow balloon with both his head and arms,
two behaviors are actually being executed simultaneously in two
separate threads: the head tracking routine that moves the servos to
keep the balloon centered in the visual field, and the arm tracking
routine that keeps the hands pointed at the current location of the
balloon.
The two key components of Pi's programming are a pair of
constructs called services and behaviors. (These are
implemented as classes in programming code.) Services are wrappers
around the raw data provided by Pi's various sensors such as sonar,
infrared, video, etc., while behaviors are wrappers around motor
actions involving servos and drive motors. A fuller explanation is
given in the next two sections.
Services
An service for a given sensor can be queried or polled for
a number of different values or functions involving that sensor's
data. For example, the service for a particular sonar sensor can
report the following information about the data stream coming from
that sensor:
Current distance reading.
Running average of the distance reading.
Current speed and acceleration; i.e. the rate of change of
the reading, and the rate of change of the rate of change. In the
case of distance sensors like sonar and infrared, these translate
directly into the physical speed and acceleration of an object or
the robot.
Current "trend" of the reading, either -1, 0 or +1
for decreasing, staying the same or increasing.
ETA or estimated time of arrival. For distance sensors, this
can provide the estimated time-to-collision between the sensor and a
moving object. This value is used in the video called "Pi Robot
Plays Catch" to predict the moment at which the arms should
start moving toward each other to intercept the approaching ball.
Short term memory: successive sensor readings are stored in a
variable length buffer so that earlier values can be retrieved if
needed. This is particularly useful during learning. For example, if
the goal is to avoid dead ends while exploring a new environment,
then it helps to know the series of actions and sensor readings that
were experienced just before getting into a dead end in the first
place.
A status message indicating the current state of the sensor
reading. For example, one can set a threshold value such that the
expert returns an "Alert" message when that value is
exceeded.
Other sensor calculations can be added to the expert class at
any time without affecting existing code.
Services are similar to another programming construct common in
robotics and AI research called agents. The notion of
cognitive agents was popularized by Marvin Minsky in his book The
Society of Mind which grew out of his research with Seymour
Papert in the early 1970s.
Behaviors
A behavior is a single action thread that controls some
subset of Pi Robot's servos or drive wheels and moves them in a
certain way. The behavior can be a fixed sequence of motor
movements—also called "ballistic"—or it can
depend on the output of one or more services in a continual
manner—such actions are also called "closed loop". An
example of a ballistic behavior is the moving of the arms into a
fixed position, such as up and open, regardless of the starting
position or sensor input. Parameters to this action might include the
speed at which the movement takes place. An example of a closed loop
behavior is the moving of the two head servos (pan and tilt) to track
a visual object. In this case, the motor commands are precisely
dependent on the output of the vision service which reports back the
x-y coordinates of the target object in the video stream.
If two behaviors do not compete for the same set of servos or
drive wheels, then they can be executed in parallel in their own
threads. Returning to the video of Pi Robot tracking the yellow
balloon with both his head and arms, two behaviors are running
simultaneously—the head tracking behavior and the arm behavior
action. Since the two behaviors use different sets of servos, they
can run at the same time without conflicts.
Behaviors are assigned a priority and one action can block another
if it has higher priority. This is accomplished by setting a status
parameter on an behavior. If a behavior's status is set to "Blocked",
then the thread will be suspended for one action cycle. Once the
"Blocked" status is cleared, the behavior is free to
continue running. An example of this can be seen in the video Pi
Robot and his Yellow Balloon. There are six threads working
together in this video: visual search, head tracking, orienting,
approach, pickup and throw. When Pi rotates to orient toward the
ball, the approach thread is blocked. The reason is that both
orienting and approaching require use of the drive wheels. Therefore,
Pi must finish orienting toward the balloon before he can start
moving toward it.
To be continued...
|
|