Objectives
Use schema theory to
design and program
behaviors
Design a complete behavioral system
Understand how to develop a “
behavioral table
”
for behaviors
Objectives
Use schema theory to
design and program
behaviors
Design a complete behavioral system
Understand how to develop a “behavioral table”
for behaviors
Designing Behaviors
Issues
:
More “art” than “science”
How to build up to integrated systems?
Approaches
:
View behaviors as objects in object-oriented
programming (OOP)
Sequence behaviors using:
Finite state automata Scripts
Behaviors as Objects in OOP
Object-Oriented Programming: data-centered view of
programming
Schema theory is well suited for transferring theoretical
concepts to OOP
An object consists of:
Data (attributes)
Methods (operations)
A Schema contains:
Knowledge of how to act and/or perceive (knowledge, data
structures, models)
Computational process (the algorithms)
Following Arbib, a schema as a programming object will be a
Behaviors as Objects in OOP
Coordinated control program:
A function that coordinates any methods or schemas in the derived class Perceptual schema:
Has at least one method, which takes sensor input and transforms it into a data
structure, called a percept
Linked to sensor(s) Motor schema:
Has at least one method, which transforms percept into a vector representing an
action
Linked to actuator(s)
Behaviors are composed of at least one perceptual schema and one motor
Primitive vs. Abstract Behaviors
Primitive behaviors
:
Only one perceptual schema Only one motor schema
No need for coordinated control
Usually programmed as single method
Abstract behaviors
:
Behaviors that are assembled from other behaviors or have
multiple perceptual schema and motor schema
Since they are farther removed from the sensors and
Example: Pick Up the Trash
1994 AAAI Mobile Robot Competition:
Robot is placed in an empty arena about the size
of an office
Coca-Cola cans (
red
) and
white
Styrofoam cups
at random locations
Blue
recycling bin in two corners; two trash bin
with a different color in the other two corners
The winner robot is the one who picks up the
Example Primitive Behavior: Move_to_goal
Rather than write
:
Move_to_red
Move_to_blue
Instead, write a single generic behavior
:
Move_to_goal(color)
Minimizes opportunity for introducing
Move_to_goal as Primitive Behavior
“pfields” is a class
“Attraction” is a method within the pfields class
how to calculate goal_angle
and goal_strength?
Important Points about Programming with Behaviors
Behavior is the “glue” between perceptual and
motor schemas
The schemas don’t communicate with each other
Behavior puts “percept” created by perceptual schema in a
local place where the motor schema can get it
Behaviors can (and should) use libraries of schemas
E.g., “pfields” class can encapsulate five primitive potential
fields, which any motor schema can use
Behaviors can be reused if written properly
More Complex Example: Follow-Corridor
Two different implementations possible:
An Abstract Follow-Corridor Behavior
find-walls
will examine the sonar polar plot and extract the
relative location of the corridor walls and return the
Second Implementation: Summation of Behaviors
Here, follow corridor composed of two instances of follow wall
Objectives
Use schema theory to design and program
behaviors
Design a complete behavioral system
Understand how to develop a “
behavioral table
”
for behaviors
Case Study: 1994 Unmanned Ground
Robotics Competition
Objective: have small unmanned
vehicle autonomously navigate
around an outdoor course of white lines painted on grass
Step 1: Describe the task
Follow path with hairpin turns,
stationary obstacles, and sand pit
Robot that went furthest without
going out of bounds is winner
Tie breaker: robot that goes
fastest
Max. velocity: 5mph
Penalties: for going out of bounds,
for hitting and moving obstacles
3 runs allowed, after 2 days of
practice
Case Study (Con’t.)
Step 2: Describe the robot
Usually: robot provided, which gives fixed
constraints on what is possible
Sensors: only specific sensors available Effectors: max speed, turning radius
In this case study, additional constraints
specified:
Robot footprint within given size
at least 3ft by 3.5ft but no bigger than a golf cart
The Robot
Camcorder on a Panning mast Sonar on a panning mast 33MHz 486 PC running Lynx (commercial unix)3 ft wide Omnibot
Case Study (Con’t.)
Step 3: Describe the environment
Grassy field with gentle slopes
Ten-foot wide lane marked in white paint Exact length and layout of course not
known in advance
Obstacles were stationary, and were
bales of hay wrapped in white or red plastic
2x4 ft obstacle that never extended
more than 3 feet into the lane
Sonar could detect hay bales at 8 feet Run times would be between 9AM and
Given the task, the environment and the
robot
Think about how this robot is able to
accomplish its task
Analysis of the Above
Identify the affordance for controlling the robot
white line, which should have a high contrast to the green grass
Potential problem?
lighting value of the white line changed with the weather
Solution?
have the camera pointing directly at one line, instead of trying to see both
lines
reduction in the signal to noise ratio
Have to use computer vision
White should be in the center of the image
Reflections on grass are white, but random, so average out
If stay in the middle, never encounter any obstacle
10-foot wide lane, 2x4 ft obstacle that never extended more than 3 feet
Case Study (Con’t.)
Step 4: Describe how the robot should act in
response to its environment
Define candidate primitive behaviors
In case study: follow-line
Behavior Table
Helpful organizing tool
•
stay-on-path
is reflexive (stimulus-response) and
taxis (it orients the robot relative to the stimulus)
•
compute-centroid
: extracts an affordance of the
centroid of white from the image as being the line
Case Study (Con’t.)
Step 5: Refine each behavior
:
Focus on design of each individual behavior Consider:
Both normal range of environmental conditions And conditions in which behavior will fail
Example: follow-line()
Bales of hay are bright compared to grass, change the
centroid to cause collision
Refinement
:
Follow line until “see” an obstacle, then just go straight
until things return to normal
Sonar! Look to the side and when something is close, it’s a
Oops
In case study:
Follow-line behavior analysis assumed only white things in
environment were lines and plastic bales of hay
Case Study (Con’t.)
Step 6: Test each behavior independently
Helpful to use simulation
Keep in mind that simulators do not usually
incorporate accurate models of the robot’s
perceptual abilities
Often, only way to verify perceptual schema is to
Case Study (Con’t.)
Step 7: Test with other behaviors
Integration testing, where behaviors are combined Testing in actual environment
In case study:
Follow_line fooled by hay bales
Perceptual schema included bright pixels from the hay bales Solution: “close robot eyes” for about 2 seconds if hay bale
Finally, $5K
Round 1
OOPS: sonar connection
off so it hit the bale
Round 2
White shoes and
dandelions, plus Killer Bale
Round 3
Trapped by sand, but $5K
Some Important Points
Let
the world be its own best representation
“line” wasn’t a line, but just centroid of brightest pixels in
the image
Design process was
iterative
; rarely get a workable
emergent behavior on the first try
There is
no single right answer
Could have been done with subsumption, pfields,
Assemblages of Behaviors
Many applications: require some concurrent behaviors and
some behaviors in sequence
Question: How to formally represent the releasers so that the
robot execute the behaviors correctly, and so that the human designer can understand what is going on?
Three common methods for behavior sequencing:
Finite state automata (FSA)
Scripts
Skills
Key concept: make world trigger, or release, the next step in
the sequence, rather than on an internal model of what the robot has done recently
Recall: FSA Sequencing of Motor Schemas
Can sequence motor schemas if one activity
Summary
Describe the task
Describe the robot
Describe the environment
Describe how the robot should act in
response to its environment
Refine each behavior
Test each behavior independently
Test with other behaviors
In-Class Team Design
Form a group of 2 for your lego project
Discuss what you want to do for your lego project
Design the behavior-based system for your
proposed lego project