designing a reactive implementation

46
Introduction to AI Robotics (MIT Pres s) Chapter 5: Designing a Reactive Implementati on 1 5 Designing a Reactive Implementation List the steps involved in designing a reactive behavioral system. Use schema theory to program behaviors using object-oriented programming principles. Design a complete behavioral system, including coordinating and controlling multiple concurrent behaviors. Describe the two methods for assembling primitive behaviors into abstract behaviors: finite state machines and scripts. esign Beh. Table Steps ase Study oordination FSA Scripts ummary

Upload: hasad

Post on 05-Feb-2016

54 views

Category:

Documents


0 download

DESCRIPTION

Designing a Reactive Implementation. List the steps involved in designing a reactive behavioral system. Use schema theory to program behaviors using object-oriented programming principles. Design a complete behavioral system, including coordinating and controlling multiple concurrent behaviors. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 1

5 Designing a Reactive Implementation

• List the steps involved in designing a reactive behavioral system.

• Use schema theory to program behaviors using object-oriented programming principles.

• Design a complete behavioral system, including coordinating and controlling multiple concurrent behaviors.

• Describe the two methods for assembling primitive behaviors into abstract behaviors: finite state machines and scripts.

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 2: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 2

5 Steps in Designing a Reactive Behavioral System

Describe the task

Describe the robot

Describe the environment

Specification& Analysis:ecologicalniche

Implement & refine each behavior

Test each behavior independently

Implementation& unit testing

Test behaviors together SystemTesting

Describe how the robot should act in response to its environment

Design

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 3: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 3

5 CSM 1994 UGV Competition

• Fully autonomous vehicle, all on-board, navigate a course 10ft wide, about 800ft long

• Obstacles• Carry a 20 pound payload

(this is from1996, but it’sa way betterpicture)

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 4: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 4

5 1-3. Describe the Task, Robot, Environment

• 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

Camcorder on aPanning mast, going toA framegrabber

Sonar on a panningmast

33MHz 486 PC runningLynx (commercial unix)Design

-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 5: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 5

5 4. Describe how robot should act• Follow the line and stay in the middle

– Follow-line– Only need the Camcorder!Design

-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 6: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 6

5 5-6 Refine and test each behavior• Follow-line

– Worked with toilet paper (indoors), – Worked with athletic line tape (outdoor)Design

-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 7: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 7

5 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

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 8: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 8

5 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!

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 9: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 9

5 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

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 10: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 10

5 Other Lessons Learned• Don’t count on getting much work done in the field!

“A river runs through it…”

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 11: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 11

5 Case Study and Field Trip:Polar Robotics

• Existing robots– DANTE, DANTE II– Nomad

Page 12: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 12

5 DANTE• Task

– explore volcanoes in Antarctica (reduce risk to vulcanologists)

• Environment– steep, rocky slopes

• Robot– legged “framewalker”

• Behaviors– rappel down

• Refine and test• Test with other behaviors

– 1997 South America, failed– 1998 Antarctica, med. success

Page 13: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 13

5 Lessons to Be Learned• A robot is part of a system, must design system

– example tether breaking

• Testing and evaluation really does take ~30% of the time allocated (just like software engineering)– and more to fix the problem

• NASA technical readiness levels– Level 1: just an idea– Level 6: demonstrated on a realistic test bed– Level 9: has flown, fully operational

Page 14: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 14

5 Nomad• Task

– search for and analyze metorities • Environment

– Antarctica• Robot

– hybrid mobility, LADAR, omnivision, sample sensors

• Behaviors– search an area using GPS, avoid

negative/positive obstacles, stop at possible metorities and alert user. Can be controlled by human

• Refine and Test• Test with other behaviors

– 1999 – 2000 success

Page 15: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 15

5 Nomad Omnivision

Page 16: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 16

5 Hyperion (really about Mars)• Task

– navigate Arctic• Environment

– Arctic• Robot

– wheeled, uses solar• Behaviors• Refine and test• Test with other behaviors

– 2002 success

Page 17: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 17

5 NASA HMP / Mars Society Flashline Project Robotics Support

• Confined space inspection of Mars habitat• Marsupial deployment for fault identification• Human robot team for collaborative exploration of •hazardous areas & narrow fissures in search of micro-organisms

Page 18: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 18

5 Field Trip• (this can be substituted for worksheet for chapter 5)• Define a task for a fully autonomous robot(s) to

perform in a polar environment• Describe the ideal robot, including sensors.• Describe the environment. Describe what it affords the

task.• Describe how you would test the robot to reach a

NASA TRL 6• What are the “unknowns” where you might encounter

problems and time delays?

Page 19: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 19

5 Case Study in Pfields:Docking

• Needed for marsupial robots• Note

– use of reactivity – simple perception– pfields– improvement over human

Page 20: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 20

5 Daughter-centric Docking Behavior

Potential field methodology:

orientation, Xbar=

tangent vectoroverall size=

attraction vector(Arkin, Murphy 90)

Silver Bullet:AMD K-6 400MHz

clearance=+/-2cm+/-5 degrees

Bujold: Inuktun mVGTVPan only, color camera,optics at about 2ms,skid steering,no on-board processor

Page 21: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 21

5 Docking Behavior Results

Pfields weren’tintended to workbehind thegate

Optics dictated 120 deg, 2mApproach Zone

• 48 data points (3 per 16 stations) on time to completion

– by angle– by radial position

• Larger angles, the slower, and farther away the slower

• 2 failures: 3, 7• Fastest: 26 sec.• Slowest: 81 sec.

Page 22: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 22

5 Docking Behavior Results: teleoperation

Performance comparison:- 66 data points, 22 teleoperators- paired sample t-test (conf>95%)Communications data:-36 data points, 6 teleoperators

Autonomous vs. Teleoperated Performance

01020304050607080

time

collisions

commands/meter

commands/min

autonomous

teleoperated

Teleoperators did better only at 1,3 where the robot wasn’tsupposed to be able to dock from. Noticed that teleoperators used a different strategy; opportunity for improvement

17% faster

Page 23: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 23

5 Docking Vision

• Spherical Coordinate Transform space instead of HSV, RGB

• Biomimetic vision: gradient, looming• O(m x n) lighting insensitive color segmentation• 8-10 frames/sec on commercial hardware vs. 30

frames/sec for Cognachrome hardware• Robust algorithm

– 2-colored landmark to prevent confusion– imprinting and time of day look up tables (LUT)– if time-out, mother moves

a color is a circle on the plane

Page 24: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 24

5

Initialvalues

Computeregion

statistics

new values for region

Light insensitive color segmentation

Imprint AdaptExtractregions

Performconnected

components

>15 tries

LUT(time of day,

weather)

Page 25: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 25

5 Indoor Data Collection and Demonstrations

Page 26: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 26

5 Outdoor Demonstrations

Imprint at dawn (light mist), return 6 hours later

As expected, mediocre performance from dusk to night (~50%) due to headlight reflection

Page 27: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 27

5 Additional Case Studies:Commercial Products

• Robomow– cutting grass in residential areas

• My Real Baby– toy dolls

Page 28: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 28

5 Robomow• Behaviors?• Random• Avoid

– Avoid(bump=obstacle)– Avoid(wire=boundary)

• Stop– Stop(tilt=ON)

• All active www.friendlymachines.com

OverviewHistoryReactive USARSummary

Page 29: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 29

5 My Real Baby• Behaviors?• Touch-> Awake• Upside down & Awake-> Cry• Awake & Hungry -> Cry• Awake & Lonely -> Cry

• Note can get crying from multiple behaviors• Note internal state (countdown timer on Lonely)

www.irobot.com

OverviewHistoryReactive USARSummary

Page 30: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 30

5 Commercial Case Studies• Purely reactive• May not need subsumption or pfields, very

straightforward• State of practice is much less complicated than state of

art!

Page 31: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 31

5 Design Tool: Behavior TableAn agent is attracted to light. If it sees light, it heads in that direction. If it encounters an obstacle, it turns either left or right, favoring the direction of the light. If there is no light, it sits and waits. But if an obstacle appears, the agent runs away.

1. photropism

2. Obstacle avoidance

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 32: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 32

5 Behavior Table

Releaser Behavior Motor Schema

Percept Perceptual Schema

Light phototropism move2Light():Attraction

Light: direction & strength

Brightest(dir), atLight()

Range<tasked level>

Obstacle avoidance

avoid(): turn left or right;runaway()

proximity Obstacle()

An agent is attracted to light. If it sees light, it heads in that direction. If it encounters an obstacle, it turns either left or right, favoring the direction of the light. If there is no light, it sits and waits. But if an obstacle appears, the agent runs away.

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 33: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 33

5 RobomowReleaser Behavior Motor

SchemaPercept Perceptual

SchemaDesign-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 34: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 34

5 My Real BabyReleaser Behavior Motor

SchemaPercept Perceptual

SchemaDesign-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 35: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 35

5 Assemblages of Behaviors• What to do if have a SEQUENCE of behaviors as well

as CONCURRENCY?• Two equivalent methods

– Finite state automata (FSA)– Scripts– (other ways too)

• Two approaches:– Stuff the coordination mechanism into a separate controlling

program (like a main())• Hurts portability, adding new behaviors “on top”

– Stuff the coordination mechanism into a meta-behavior or abstract behavior using recursive-ness of schemas

• Coordination mechanism is the coordinated control program part of the behavioral schema

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 36: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 36

5 Example of a Sequence:Catch Suzy!

Page 37: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 37

5 Example Continued• “Tracking Phase”

– move to goal– avoid obstacle

• “Pick up Phase”– fine position– pick up

• “Return Home Phase”– move to goal– avoid obstacle

same behaviors, just DIFFERENT

INSTANTIATION OF GOAL

Page 38: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 38

5 FSA: M={K,,,s,F}

• K: all the states, each is “q”- behaviors : transition function, (q,)= new behavior : inputs that agent can “see”, each is –

stimulus/affordances• q0: Start state(s)- part of K• F: Terminating state(s)- part of K

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 39: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 39

5 Class Exercise:Catch Suzy

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 40: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 40

5 Class Exercise:Pick Up Trash

Page 41: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 41

5 FSA Summary• “State” doesn’t mean “state of world” (bad); it means

more “where the innate releasing mechanism is currently at” (good)

• Advantages– Formal mechanism– Have to fill in the table, so a way of spotting unforseen effects

• Disadvantages– Hard to keep up with implicit behaviors

• Ex. Avoid obstacle is often running throughout ALL states, gets tedious to express it formally

– Tend to add explicit variable for transitions, rather than rely on emergent behavior from environment

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 42: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 42

5 Scripts• UGV competition really didn’t have a sequence of

behaviors, just toggling back and forth• USAR victim detection has more of a typical sequence

or order of behaviors (like digger wasps mating)• Imagine trying to do an FSA for the USAR task• Scripts are equivalent to FSA but may be more natural

or readable for sequences

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 43: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 43

5 ScriptsScript Behavior Analog Examples

Goal Task Find victims in rubble

Places Environment, applicability or“taskability” for new tasks

Collapsed buildings

Actors Behaviors explore(), dance(), avoid(), crawl, move2void, move2victim

Props, cues Percepts Voids: Dark, concaveVictims: heat, motion, color

Causal Chain

Sequence of behavior Explore, dance, move2void, crawl, move2victim, dropRadio

Subscripts Exception handling If lose communications, return home

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 44: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 44

5 Scripts Summary• Will see more of it in Ch10: Topological Navigation• 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++

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 45: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 45

5 Summary• Design of reactive systems is identical to design of

object-oriented software systems– Highly modular, can test behaviors independentl

• Follows the basic steps in the Waterfall Lifecycle– Describe task, robot, environment, how robot should act, refine

behaviors, test independently, test together. – Except lots more iteration, making it more like Spiral

• Behavior tables can help keep track of what’s a behavior and its releasers and percepts

• Sequences of behaviors, rather than combinations, can be controlled by a separate routine or by adding a routine to the coordinated control program in the behavioral schema– FSA and Scripts are two main methods

Design-Beh. Table-StepsCase StudyCoordination-FSA-ScriptsSummary

Page 46: Designing a Reactive Implementation

Introduction to AI Robotics (MIT Press) Chapter 5: Designing a Reactive Implementation 46

5 Thought Question• Should Moore’s Law factor into reactive design? If had

more processor speed, should a different approach been used for the UGV competition?