Top Banner
Theory of Computation Using Finite State Machines to Investigate Animal Behaviors & Implement them in Mobile Robots Vladimir Kulyukin
52

Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Dec 15, 2014

Download

Science

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Theory of Computation

Using Finite State Machines to Investigate Animal Behaviors &

Implement them in Mobile Robots

Vladimir Kulyukin

Page 2: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Outline

Biological Foundations of Behavior

Innate Release Mechanisms

Reactive Paradigm

Schemas & Behaviors

Subsumption in Reactive Robots

Page 3: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Motivational Videos

http://www.youtube.com/watch?v=UMNQftn9zIQ

http://www.youtube.com/watch?v=D_mbH1MdJEY

http://www.youtube.com/watch?v=Dblw3CJTE8M

http://www.youtube.com/watch?v=-0FnGY-E3D4

http://www.youtube.com/watch?v=9LKhAarNWng

Page 4: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Biological Foundations of Behavior

Page 5: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Biological Foundations Of Behavior

• Animal Behavior

• Behavior Coordination & Control

• Computational Theory Of Agency

• Schema Theory

Page 6: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Why Study Animal Behavior?

• Animals provide existence proofs of various aspects of intelligence

• Many animals exhibit intelligent behaviors with virtually no brain assistance

Page 7: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Animal Behavior

• A Behavior is a mapping of sensory inputs to a pattern of motor actions which are used to achieve a task (Murphy 2000)

• Three categories of behavior:

• Reflexive behavior

• Reactive behavior

• Conscious behavior

Page 8: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Reflexive Behavior

• Reflexive behavior is a stimulus-response pair

• Reflexive behavior is hardwired

• Reflexive behavior produces the fastest response time

Page 9: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Reactive Behavior

• Reactive behavior is acquired (learned)

• Reactive behavior is executed without conscious thought

• Examples of reactive behavior:

• Riding a bike

• Swimming

• Skiing

Page 10: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Conscious Behavior

• Conscious behavior involves deliberation

• Conscious behavior tends to show up when the agent has to evaluate longer term consequences of its actions

• Conscious behavior is characterized by slower response time

Page 11: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Reflexive Behavior

• Reflexes – response is present as long as stimulus is present

• Taxes – response to move in a specific direction to a stimulus

• Baby turtles go to brightest light

• Ants follow pheromones

• Fixed-Action Pattern – response continues longer than stimulus

Page 12: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Innate Release Mechanisms (IRMs)

Page 13: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Innate Releasing Mechanisms (IRMs)

• An IRM presupposes that there is a specific stimulus (internal or external) which releases or triggers the stereotypical pattern of action

• A releaser is a latch or a boolean variable that has to be set

• The releaser acts as a control signal to activate a behavior

Page 14: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Behavior Coordination & Control

• Innate Releasing Mechanisms (IRM)

• A IRM = A Stimulus (Internal or External) + A Triggered Pattern Of Action

BEHAVIOR Sensory Input

Releaser

Pattern Of Action +/-

Page 15: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

IRM: Simple Release

enum Releaser = {Present, Absent};

Releaser predator;

while ( true ) {

predator = sensePredator();

if ( predator == Present ) runAway();

}

Page 16: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

IRM: Compound Release

• A Releaser can consist of multiple releasers

• Releasers can be either external or internal

• Any logical combination of releasers is possible

Page 17: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

IRM: Compound Release

enum Releaser = {Present, Absent};

Releaser food, hunger;

while ( true ) {

food = senseFood();

hunger = checkHunger();

if ( food == Present && hunger == Present )

feed();

}

Page 18: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

IRM: Implicit Chaining

• Releasers can be arranged to chain behaviors

• An initial releaser triggers the first behavior

• Behavior is executed until Its releaser is gone

• Control goes on to the next behavior

Page 19: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Implicit Chaining

• In the previous example, if the agent wakes up and is not hungry, what will it do?

• Let us add a behavior to flee from predators to the previous code

Page 20: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

IRM: Implicit Chaining

enum Releaser = {Present, Absent};

Releaser food, hunger, child, nursed;

while ( true ) {

food = senseFood();

hunger = checkHunger();

child = checkChild();

nursed = checkNursing();

if ( hunger == Present ) seekFood();

if ( hunger == Present && food == Present) feed();

if ( hunger == Absent && child == Present) nurse();

if ( nursed == Present ) sleep();

}

Page 21: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Inhibiting Behaviors

• The addition of the if-else loop prevents other, less important behaviors from executing

• What if the predator is not seen (say it is behind the agent) for a while?

Page 22: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

IRM: Behavior Inhibition

• What happens of there is a Predator?

• The fleeing behavior must be triggered

• The feeding & nursing behaviors must be suspended

• The fleeing behavior inhibits the feeding & nursing behaviors

Page 23: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Behavior Inhibition & Fixed-Pattern Action Effect

#define T LONG_TIME

while(true)

{

predator = sensePredator();

if (predator == PRESENT)

for (time = T; time > 0; time--)

flee();

else

{

food = senseFood();

...

}

}

Page 24: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Concurrent Behaviors

• Behaviors can and do exist concurrently and independently

• What happens when two or more behaviors (that are usually not executed concurrently) get released at the same time?

• Equilibrium

•Dominance

•Cancellation

Page 25: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Equilibrium

• Behaviors seem to balance each other out

• Consider feeding vs. fleeing in a baby squirrel when the food is close enough to a person

• The squirrel is visibly undecided as to whether to go for the food or stay away

Page 26: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Dominance

• One behavior dominates over the other and only the dominant behavior gets executed

• You are hungry and sleepy - you either eat or sleep, not both

Page 27: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Cancellation

• The behaviors cancel each other out

• Male sticklebacks (fish), when their territories overlap, get caught between the need to defend their nest and attach the other fish

• Both stimuli cancel out leaving only the stimuli associated with nest building – so they build another nest

Page 28: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Reactive Paradigm

Page 29: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Three Levels of Reactive Paradigm

• Level 1: Existence Proof Of What Can/Should Be Done

• Level 2: Decomposition Of Existence Proof Into Inputs, Outputs, And Transforms

• Level 3: Implementation

Page 30: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Level 1: Existential Proof

• Sample Task: To seek out humans trapped in a building after an earthquake

• Existential proof: A mosquito can seek out people and so it provides an existence proof that it is possible for a computationally simple agent to find a human being

• At Level 1, agents share a commonality of purpose or functionality

Page 31: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Level 2: Behavior decomposition into inputs, outputs and transformations

• Creating a flowchart of black-boxes

• Each black-box transforms input to an output

• For mosquito, input = thermal image, output = steering command

• At Level 2, agents can exhibit common processes

Page 32: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Level 3: How to implement the process

• This level focuses on how each transformation or black-box is implemented

• At Level 3, agents may have little or no commonality in their implementation

Page 33: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Reactive Paradigm

SENSE ACT SENSE ACT

SENSE ACT SENSE ACT

Reactive Paradigm is organized into multiple, concurrent behaviors

Page 34: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Hierarchical Paradigm vs. Reactive Paradigm

SENSE PLAN ACT

SENSE ACT

Page 35: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Action-Perception Cycle

World

Perception of Environment

Cognitive Activity

Agent acts and modifies world

Decides what to look for

Agent samples and finds potential actions

Page 36: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Gibson’s Ecology

• “The world is its own best representation.”

• It makes little sense to discuss an agent’s perception independent of the agent’s environment

• Gibson proved the Existence of Affordances

• Affordance is a perceivable potentiality of the environment for an Action

Page 37: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Affordance & Perception

• Affordances are perceivable potentialities of the environment for an action

• Perception serves two functions:

• To release a behavior

• To perceive information needed to accomplish the behavior

Page 38: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Schemas & Behaviors

Page 39: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Schema Theory: History

• Schemas were conceived by psychologists around 1900

• Schemas represent a basic unit of activity

• Michael Arbib was a computer scientist who first brought schemas into AI Robotics

Page 40: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Definition Of Schema

A schema is a basic unit of behavior from which complex actions can be constructed; it consists of the knowledge of how to act or perceive as well as the computational process by which it is enacted. (Ron Arkin 1998)

Page 41: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Arbib’s Application Of Schemas

• A Behavior Is A Schema Composed Of A Perceptual Schema & Motor Schema

• Perceptual Schema Embodies The Sensing

• Motor Schema Embodies Physical Activity

Page 42: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Schema Theory

• A schema can be used to express the basic unit of activity

• A schema consists of:

• Knowledge on how to act and/or perceive and

• The computational process by which it uses to accomplish that activity

Schema:

Data

Methods

Page 43: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Behaviors as Perceptual and Motor Schemas

Pattern of Motor Actions BEHAVIOR Sensory Input

Releaser

Perceptual Schema Motor Schema

Page 44: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Behaviors as Perceptual and Motor Schemas

• Motor schema represents the template for physical activity

• Perceptual schema represents the template for sensing

• The motor schema and the perceptual schema are derived from the schema class

Page 45: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Schema Theory Example: Frog’s Behavior

motor schema snap

perceptual schema locate_fly

fly 1 activation condition

motor SI snap(fly1)

perceptual SI locate_fly(fly1)

behavior

percept, gain

Snap at (x, y, z)

(x, y, z)

Page 46: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Subsumption in Reactive Robots

Page 47: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Reactive Robots

• Robots are situated agents operating in an ecological niche

• Behaviors serve as the basic building blocks for robotic actions, and the overall behavior of the robot is emergent

• Only local behavior-specific sensing is permitted

• These systems inherently follow good software design principles

• Animal models of behavior are often cited as a basis for these systems or a particular behavior

Page 48: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Subsumption Architecture

• Rodney Brooks invented this architecture

• Behaviors are released in a Stimulus – Response way

• No external program coordinates and controls them

• Four interesting aspects of subsumption in terms of releasing and control

Page 49: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Subsumption Layers of Competence

• Modules are grouped into layers of competence

• They reflect a hierarchy of intelligence or competence

• Lower levels encapsulate basic survival functions

• Higher levels create more goal-directed actions as mapping

Page 50: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Example: Level 0: Move

SONAR

COLLIDE

FEEL FORCE

RUN AWAY TURN

FORWARD

Polar plot

force heading

halt

heading encoders

Page 51: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

Example: Level 1: Wander

SONAR

COLLIDE

FEEL FORCE

RUN AWAY TURN

FORWARD

Polar plot

force heading

halt

heading encoders

AVOID WANDER

heading

S

modified heading

Page 52: Theory of Computation (Fall 2014): Using Finite State Machines to Investigate Animal Behaviors & Implement Them in Mobile Robots

References