0% found this document useful (0 votes)
18 views62 pages

Designing Reactive Behaviors in Robotics

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views62 pages

Designing Reactive Behaviors in Robotics

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Amity School of Engineering & Technology

ARTIFICIAL INTELLIGENCE FOR ROBOTICS


1
Amity School of Engineering & Technology

Module III:

Designing a Reactive: Implementation: (6 Hours)

Behaviors as Objects in OOP,


Steps in Designing a Reactive Behavioral System,
Finite state automata

2
Amity School of Engineering & Technology
Amity School of Engineering & Technology
Amity School of Engineering & Technology

• Schema is a class with coordinated control program

• Perceptual schema, motor schema and behavior are all subclasses of schema

• Behavior has
– One or more perceptual schemas

– One or more motor schemas

– One or more behaviors

• Primitive behavior has only one perceptual schema, one motor schema, no
coordinated control program; often prgrammed as a single method

• Behaviors that are assembled from other behaviors or have multiple perceptual
and motor schemas are abstract behaviors
Amity School of Engineering & Technology

Example: primitive move-to-goal


•behavior
Robot placed in empty office with red and blue coke cans and white cups placed randomly, blue
recycling bins in two corners, different colored trash bin in 2 corners. Goal: pick up the most
trash and place in correct bin; red and blue are more easily perceived, so typical strategy was
recycle coke cans first
• Basic behavior: move_to_goal (goal_color)
• Note: PFields is a class with 5 primitive potential fields, serves as a library; percept is local to
behavior

Object Behavioral analog identifier


Data Percept Goal_angle
Goal_strength

Methods Perceptual_schema Extract_goal (goal_color)


Motor_schama [Link](goal_angle,
goal_strength)
Amity School of Engineering & Technology

Example: abstract follow-corridor


behavior
• Class diagrams for 2 different approaches shown in figure.
Amity School of Engineering & Technology

Example: abstract follow-corridor


behavior
• Class diagrams for 2 different approaches shown in figure.
Amity School of Engineering & Technology

Releasers in OOP
• Releaser is a perceptual schema not bound to a
motor schema
• Two approaches:
[Link] for red with extract_color, signal main
program when red is seen, main instantiates
move_to_goal(red)
[Link] behavior always be active, but if red is not
seen, behavior returns identity function (0,0,0)
for potential field
Amity School of Engineering & Technology

Steps in Designing a Reactive


Behavioral
Describe the task
System
Specification
& Analysis:
Describe the robot ecological
niche
Describe the environment

Describe how the robot should Design


act in response to its environment

Implement & refine each behavior


Implementation
& unit testing
Test each behavior independently

Test behaviors together System


Testing
Amity School of Engineering & Technology
Amity School of Engineering & Technology

CSM 1994 UGV


Competition
(this is from
1996, but it’s
a way better
picture)

• Fully autonomous vehicle, all on-board, navigate


a course 10ft wide, about 800ft long
• Obstacles
• Carry a 20 pound payload
Amity School of Engineering & Technology

1-3. Describe the Task, Robot,


Camcorder on a Environment
Panning mast, going to 33MHz 486 PC running
A framegrabber Lynx (commercial unix)

Sonar on a panning
mast
All coding was done in C++

• Have to use computer vision… black &white, slow processor speeds (didn’t get
to design the robot)
– White (bright) should be in the center of the image
– Reflections on grass are white, but random so average out
• If stay in middle, never encounter an obstacle!
• 150ms update rate needed for steering to stay in control at ~1.5mph
Amity School of Engineering & Technology

4. Describe how robot should act


• Follow the line and stay in the middle
– Follow-line
– Only need the Camcorder!
Amity School of Engineering & Technology

5-6 Refine and test each behavior


• Follow-line
– Worked with toilet paper (indoors),
– Worked with athletic line tape (outdoor)
Amity School of Engineering & Technology

7 Test with other behaviors


• “Full dress rehearsal”
– Oops, bales of hay are bright compared to grass, change
the centroid to cause collision
• Go back to step 4:
– Follow line until “see” an obstacle, then just go straight
until things return to normal
• Hard to do visually in real time
• Sonar! Look to the side and when something is close, it’s
a bale, so go straight
Amity School of Engineering & Technology

Final System
• Round 1
– OOPS: sonar connection off
so it hit the bale
• Round 2
– White shoes and
dandelions, plus Killer Bale
• Demo round
– Hill vs. implicit flat earth
assumption
• Round 3
– Trapped by sand, but $5K
richer!
Amity School of Engineering & Technology

Main Points
• Let the WORLD BE ITS OWN BEST REPRESENTATION
and CONTROL STRUCTURE
– “line” wasn’t a “line” just centroid of brightest
pixels in the image
– Pick up trash: if can is in gripper, then go to the
recycle bin
• 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,
rules, whatever
Amity School of Engineering & Technology

Assemblages of behaviors
Amity School of Engineering & Technology

Assemblages of behaviors
Amity School of Engineering & Technology

Finite State Automata (FSA)


Amity School of Engineering & Technology

Finite State Automata (FSA)


Amity School of Engineering & Technology

A Finite Automata consists of the following :


Q : Finite set of states.
Σ : set of Input Symbols.
q : Initial state.
F : set of Final States.
δ : Transition Function.

Formal specification of machine is


{ Q, Σ, q, F, δ }
Amity School of Engineering & Technology
Amity School of Engineering & Technology

Q : Finite set of states.


Σ : set of Input Symbols.
q : Initial state.
F : set of Final States.
δ : Transition Function.

K : behavior
Σ : stimulus, affordance, represented by arrows
(Each arrow represents the releaser for a behavior)
q : Initial state.
F : set of Final States.
δ : new behavior.
Amity School of Engineering & Technology

FSA representation of the coordination and


control of behaviors in the UGV competition
Amity School of Engineering & Technology

A Pickup the trash FSA


Amity School of Engineering & Technology

A Pickup the trash FSA


Amity School of Engineering & Technology

Implementation
Amity School of Engineering & Technology

FSA Summary
Amity School of Engineering & Technology

Script
• A script is a structure that prescribes a set of circumstances which could be
expected to follow on from one another.
• Various symbols used in Scripts-
Amity School of Engineering & Technology

Write a script for visiting a movie theatre


Amity School of Engineering & Technology
Amity School of Engineering & Technology
Amity School of Engineering & Technology

Scripts
A script is a structured representation describing a
stereotyped sequence of events in a particular
context.
Scripts are used in natural language understanding
systems to organize a knowledge base in terms of the
situations that the system should understand.
Amity School of Engineering & Technology

Scripts
A script is a structure that prescribes a set of circumstances
which could be expected to follow on from one another.

It is similar to a thought sequence or a chain of situations


which could be anticipated.

It could be considered to consist of a number of slots or


frames but with more specialised roles.
Amity School of Engineering & Technology

Scripts are beneficial because:


•Events tend to occur in known runs or patterns.
•Causal relationships between events exist.
•Entry conditions exist which allow an event to take
place
•Prerequisites exist upon events taking
place. E.g. when a student progresses through a
degree scheme or when a purchaser buys a
house.
Amity School of Engineering & Technology

The components of a script include:

Entry Conditions
-- these must be satisfied before events in the script
can occur.
Results
-- Conditions that will be true after events in script
occur.
Props
-- Slots representing objects involved in events.
Amity School of Engineering & Technology

Roles
-- Persons involved in the events.
Track
-- Variations on the script. Different tracks may share
components of the same script.
Scenes
-- The sequence of events that occur. Events are
represented in conceptual dependency form.
Amity School of Engineering & Technology

Scripts are useful in describing certain situations such as robbing a


bank. This might involve:

•Getting a gun.
•Hold up a bank.
•Escape with the money.

Here the Props might be

•Gun, G.
•Loot, L.
•Bag, B
•Get away car, C.
Amity School of Engineering & Technology

The Roles might be:

•Robber, S.
•Cashier, M.
•Bank Manager, O.
•Policeman, P.

The Entry Conditions might be:

•S is poor.
•S is destitute.
Amity School of Engineering & Technology

The Results might be:

•S has more money.


•O is angry.
•M is in a state of shock.
•P is shot.
Amity School of Engineering & Technology

There are 3 scenes: obtaining the gun, robbing the bank and
the getaway.

The full Script could be described in Fig


Amity School of Engineering & Technology
Amity School of Engineering & Technology

Advantages of Scripts:

Ability to predict events.


A single coherent interpretation may be build up
from a collection of observations.
Disadvantages:

Less general than frames.


May not be suitable to represent all kinds of
knowledge.
Amity School of Engineering & Technology

Script
• UGV competition really didn’t have a sequence of
behaviors, just toggling back and forth
• Scripts are equivalent to FSA but may be more
natural or readable for sequences
• Think of robot and task in terms of a screenplay
• Resulting script for an abstract behavior is usually the
same as the programming logic derived from FSA
• Ex: pick up trash
Amity School of Engineering & Technology

Script
Amity School of Engineering & Technology

Script
Script Behavior Analog Examples
Goal Task Find victims in rubble
Places Environment, Collapsed buildings
applicability or
“taskability” for new
tasks
Actors Behaviors explore(), dance(), avoid(),
crawl, move2void,
move2victim
Props, cues Percepts Voids: Dark, concave
Victims: heat, motion, color
Causal Sequence of behavior Explore, dance, move2void,
Chain crawl, move2victim, dropRadio
Subscripts Exception handling If lose communications, return
home
Amity School of Engineering & Technology
Amity School of Engineering & Technology

• Advantages
– A more storyboard like way of thinking about
the behaviors
– If-then, switch style of programming like FSA
– Since a Script is “in” a behavior, other behaviors
such as avoid can be running concurrently
without having to appear “in” the script
– Exception handling is a big plus in Real Life
• Disadvantages
– Can be a bit of overkill for simple sequences,
especially with C++
Amity School of Engineering & Technology

S-R notation:
Coordination Function, C
=C(G*B(S))
Overall response of robot r is a function of the
behaviors B, the gain of each behavior G, and the
coordination function C
C takes the output of multiple behaviors and
produces one response

Intro 51
Amity School of Engineering & Technology

Alternative Formula

Objectives
Motivation
S-R Notation
Categories
Architectures

C Output is a single
action

Intro 52
Amity School of Engineering & Technology

Categories of Coordination
Behavioral
Behavioral
Coordination
Coordination
Objectives
Motivation
S-R Notation
Concurrent
Concurrent
Categories
Sequences
Sequences
Architectures Behaviors
Behaviors

Cooperating
Cooperating Competing
Competing
Methods
Methods Methods
Methods FSA
FSA Scripts
Scripts
(blending)
(blending) (arbitration)
(arbitration)

Vector
Vector
Summation
Summation Fuzzy
Fuzzy Logic
Logic Subsumption
Subsumption Voting
Voting
(Potential
(Potential Fields)
Fields)

Intro 53
Amity School of Engineering & Technology

Categories of Coordination
Behavioral
Behavioral
Coordination
Coordination
Objectives
Motivation
S-R Notation
Concurrent
Concurrent
Categories
Sequences
Sequences
Architectures Behaviors
Behaviors

Cooperating
Cooperating Competing
Competing
Methods
Methods Methods
Methods FSA
FSA Scripts
Scripts
(blending)
(blending) (arbitration)
(arbitration)

Vector
Vector
Summation
Summation Fuzzy
Fuzzy Logic
Logic Subsumption
Subsumption Voting
Voting
(Potential
(Potential Fields)
Fields)

Intro 54
Amity School of Engineering & Technology

Categories of Coordination
Behavioral
Behavioral
Coordination
Coordination
Objectives
Motivation
S-R Notation
Concurrent
Concurrent
Categories
Sequences
Sequences
Architectures Behaviors
Behaviors

Cooperating
Cooperating Competing
Competing
Methods
Methods Methods
Methods FSA
FSA Scripts
Scripts
(blending)
(blending) (arbitration)
(arbitration)

Vector
Vector
Summation
Summation Fuzzy
Fuzzy Logic
Logic Subsumption
Subsumption Voting
Voting
(Potential
(Potential Fields)
Fields)

Intro 55
Amity School of Engineering & Technology
Categories of Coordination
Behavioral
Behavioral
Coordination
Coordination
Objectives
12
Motivation
S-R Notation
Concurrent
Concurrent
Categories
Sequences
Sequences
Architectures Behaviors
Behaviors

11
Cooperating
Cooperating Competing
Competing
Methods
Methods Methods
Methods FSA
FSA Scripts
Scripts
(blending)
(blending) (arbitration)
(arbitration)

9 10
Vector
Vector
Summation
Summation Fuzzy
Fuzzy Logic
Logic Subsumption
Subsumption Voting
Voting
(Potential
(Potential Fields)
Fields)

Intro 56
Amity School of Engineering & Technology

Recall: Types of Architectures


•operational architecture: describes what the systems does, not how it
does it
Objectives The
Thereactive
reactiveparadigm
paradigmis
isan
anoperational
operationalarchitecture
architecture
Motivation
S-R Notation
Categories
Architectures •systems architecture: describes how a system works in terms of
behaviors
behaviorsare
areaasystems architecture,
architecture,which
whichcan
canbe
major subsystems
systems be
implemented
implementedby
byvarious
varioustechnical
technicalarchitectures
architectures

•technical architecture: describes how a system works in terms of


Technical architectures often
oftencommit to
toaaclass
classof
implementation
Technical architecturesdetails, language
commit of
coordination
coordinationalgorithms
algorithmsand
andget
getcalled
calledby
bythat
that
“schema
“schemaarchitecture,”
architecture,”“pfield
“pfieldarchitecture”,
architecture”,
“subsumption
“subsumptionarchitecture,”
architecture,”“fuzzy…”
“fuzzy…”

Intro 57
Amity School of Engineering & Technology
Summary
• Coordination is a function which maps a set of behaviors, each of which may have an
associated gain, onto a single action

• Multiple behaviors may be activated concurrently and sequentially

• Two different approaches to producing a single action from multiple concurrent behaviors are:
cooperating and competing

• The algorithms and associated knowledge representations for implementing the coordination
function are often called architectures since they are technical architectures, but in practice
many technical architectures “mix and match”

Intro 58
Amity School of Engineering & Technology

Return to Questions
• What happens when several behaviors are released (instantiated) at the same time?
– Either blended or arbitrated

• What about sequences of behaviors?


– Implicit through IRM
– Explicit through “skills” represented by FSA, scripts (production rules discouraged)- described
later

• How can you do this and avoid planning, explicit representations of state or the
world?
– Affordances
– Gains, inhibition, homeostasis

59
Amity School of Engineering & Technology
Q) Describe the four categories under which AI is classified with examples

• There are four types of AI or AI-based systems:


1. Reactive machines
2. Limited memory machines
3. Theory of mind
[Link]-aware AI.
Amity School of Engineering & Technology
• 1. Reactive Machines
• Reactive machines are basic in that they do not store ‘memories’ or
use past experiences to determine future actions. They simply
perceive the world and react to it.
• Eg-IBM’s Deep Blue, which defeated chess grandmaster Kasporov,
is a reactive machine that sees the pieces on a chess board and
reacts to them.
• 2. Limited Memory
• Limited Memory machines can retain data for a short period of time.
While they can use this data for a specific period of time, they cannot
add it to a library of their experiences. Many self-driving cars use
Limited Memory technology: they store data such as the recent
speed of nearby cars, the distance of such cars, the speed limit, and
other information that can help them navigate roads.
Amity School of Engineering & Technology

• 3. Theory of Mind
• Theory of Mind researchers hope to build computers that
imitate our mental models, by forming representations
about the world, and about other agents and entities in it.
• 4. Self-Awareness
• Self-aware machines are the stuff of science fiction,
though many AI enthusiasts believe them to be the
ultimate goal of AI development

You might also like