8 e Behavioral Coordination Sequences Is there a

8 e Behavioral Coordination: Sequences Is there a way to explicitly string together sequences of behaviors, rather than rely on innate releasers? How can we visualize complex sequences? Where does the sequential knowledge “go”? what kind of programming structure, how does it fit behaviors? © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 1

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary Specific Learning Objectives • Describe two methods for assembling primitive behaviors into abstract behaviors: finite state machines and scripts. • Given a description of a robot system and set of behaviors, be able to generate a finite state machine (both diagram and table) which captures the correct activity of the robot. • Be able to relate goals, places, actors, props, causal chain and subscripts to behavioral concepts • Describe strategic/tactical philosophy of behavioral prioritization, and if given a description of behaviors, be able to distinguish between a strategic and tactical behavior © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 2

8 e Recap: Categories of Algorithms Behavioral Coordination Objectives Review FSM -Case Study 1 Scripts Tactical Summary Concurrent Behaviors Cooperating Methods (blending) Vector Summation (Potential Fields) Fuzzy Logic Sequences Competing Methods (arbitration) Subsumption FSM FSA Scripts Voting © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 3

8 e Outline • Start with Finite State Machines Objectives Review FSM -Case Study 1 Scripts Tactical Summary • Problems which lead to Scripts • Problems which lead back to concurrent behavioral coordination • Which leads to tactical behaviors © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 4

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary FINITE STATE MACHINES © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 5

8 e Example of a Sequence: Catch Suzy! Objectives Review FSM -Case Study 1 Scripts Tactical Summary Chase Suzy, Pick it Up, Carry it Home nd © 2019 Robin Murphy Introduction to AI Robotics 2 Edition (MIT Press 2019) 6

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary Motivation • If have concurrent behaviors, have mechanisms for blending or arbitrating resultant output but what about temporal sequencing? – Ex. Chasing Suzy © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 7

8 e Encapsulating Logical Sequences of Behaviors • Common methods – Finite state machines Objectives Review FSM -Case Study 1 Scripts Tactical Summary • Should be familiar from CS • Has two parts: table, diagram – Scripts • Equivalent to FSM, just more “naturalistic” – RAPs (reaction-action packets) • Similar, programmed in LISP • Two approaches for encapsulation of the sequence: – Stuff the coordination mechanism into a separate controlling program (like a main()) • BUT 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 © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 8

8 e Sequence Method 1: Finite State Machines • Represent what you want the robot to do as a graph Objectives Review FSM -Case Study 1 Scripts Tactical Summary • Think of your behaviors as programming STATES or nodes in a graph • Think of the edges connecting nodes as the possible STATE TRANSITIONS – Not all nodes have to be connected • If I know the state I’m in, a TRANSITION FUNCTION can take the INPUT stimulus and compute the new state I should go to © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 9

8 e Recall 1994 UGV Competition Move-ahead Objectives Review FSM -Case Study 1 Scripts Tactical Summary sonar distraction null Follow-line vision Find-line Adjust-path I turn forward © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 10

8 e Could Represent Graphically Objectives Review FSM -Case Study 1 Scripts Tactical Summary © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 11

8 e FSA: M={K, S, , s, F} Objectives Review FSM -Case Study 1 Scripts Tactical Summary • K: all the states, each is “q”- behaviors – Follow-line, move-ahead © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 12

8 e FSA: M={K, S, , s, F} Objectives Review FSM -Case Study 1 Scripts Tactical Summary • K: all the states, each is “q”- behaviors – Follow-line, move-ahead • q 0: Start state(s)- part of K the start behavior for the program © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 13

8 e FSA: M={K, S, , s, F} Objectives Review FSM -Case Study 1 Scripts Tactical Summary • K: all the states, each is “q”- behaviors – Follow-line, move-ahead • q 0: Start state(s)- part of K the start behavior for the program • : transition function, (q, s)= new behavior – Time-elapsed(move ahead, T)=follow-line © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 14

8 e FSA: M={K, S, , s, F} Objectives Review FSM -Case Study 1 Scripts Tactical Summary • K: set of all the states, each is “q”- behaviors – Follow-line, move-ahead • q 0: Start state(s)- part of K the start behavior for the program • : transition function, (q, s)= new behavior – Time-elapsed(follow-line, T)=move-ahead • S: set of inputs that agent can “perceive”, each is s– stimulus/affordances – Range, time © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 15

8 e FSA: M={K, S, , s, F} Objectives Review FSM -Case Study 1 Scripts Tactical Summary • K: set of all the states, each is “q”- behaviors – Follow-line, move-ahead • q 0: Start state(s)- part of K the start behavior for the program – q 0= follow-line • • : transition function, (q, s)= new behavior S: set of inputs that agent can “perceive”, each is s– stimulus/affordances – Range, time • F: Terminating state(s)- part of K – Follow-line, move-ahead © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 16

8 e FSM: Diagram & Table Objectives Review FSM -Case Study 1 Scripts Tactical Summary q s q, s) Follow-line Range near Move-ahead Follow-line Range far Follow-line Move-ahead Time remaining Move-ahead Time elapsed Follow-line © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 17

8 e Return to Schema Theory Objectives Review FSM -Case Study 1 Scripts Tactical Summary © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 18

8 e Sequencing can be the Data/Knowledge Objectives Review FSM -Case Study 1 Scripts Tactical Summary © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 19

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary Case Study • Georgia Tech 1994 AAAI Mobile Robot Competition team • Each robot hardware and software homogeneous • Reactive behaviors – – – Wander-for-goal Move-to-goal Avoid-other-robots Grab-trash Drop-trash • Affordances – Orange=goal – Green=robot – Blue=trashcan © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 20

8 e Pick Up the Trash Objectives Review FSM -Case Study 1 Scripts Tactical Summary © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 21

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary FSM versus Ethology FSM Ethology • FSM explicitly encode the sequence and permitted variations • Often attempt to specify all behavior with a huge FSM that can be brittle • Sequence emerges as a result of releasers • Often difficult to visualize the emergence in a complex system © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 22

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary FSM 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 – Can be difficult to visualize – 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 © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 23

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary FSM 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 – Can be difficult to visualize – 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 © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 24

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary SCRIPTS © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 25

8 e Sequence Method 2: Scripts • FSM capture all transitions, but Objectives Review FSM -Case Study 1 Scripts Tactical Summary – code is often hard to read – Exceptions or rare “subgraphs” are hard to represent • Need a more naturalistic representation and abstraction • Scripts idea from AI (natural language processing) – There is a primary causal chain – Behaviors are actors, cues can index into sequence © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 26

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary Scripts: Example- Search Script 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, move 2 void, move 2 victim Props, cues Percepts Voids: Dark, concave Victims: heat, motion, color Causal Chain Sequence of behavior Explore, move 2 void, crawl, move 2 victim, drop. Radio Subscripts Exception handling If lose communications, return home © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 27

8 e UGV Searching For Mines Sensor Library Behavioral Library Effector Library Laser Steer Waypoint Search GPS Restablish Comms Drive Vision MTG Raster search, Investigate Look for Explore, Retrace, home © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) Canera Pan/Tilt 28

8 e UGV Searching For Mines: Script for Reestablishing Comms Sensor Library Behavioral Library Effector Library Laser Steer Waypoint Search GPS Restablish Comms Drive Vision MTG Raster search, Investigate Look for Explore, Retrace, home © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) Canera Pan/Tilt 29

8 e UGV Searching For Mines: Script for Searching Sensor Library Behavioral Library Effector Library Laser Steer Waypoint Search GPS Restablish Comms Drive Vision MTG Raster search, Investigate Look for Explore, Retrace, home © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) Canera Pan/Tilt 30

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary Example: Many Combinations of Following Corridors, Moving Through Doors, Moving Through Rooms © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 31

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary Scripts Good for Initialization and Termination • Consider a move-thru-door (mtd) behavior followed by a follow-corridor (fc) behavior, where the robot should go left after it exits the door • Problems – move-thru-door isn’t guaranteed to stop perpendicular to the door – When does move-thru-door stop? © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 32

8 e Casual Chain Components • Default causal chain has 4 components: – Initialization Objectives Review FSM -Case Study 1 Scripts Tactical Summary • Ex. Orient to the correct direction in the corridor – Nominal • Use pfields (or whatever) – Termination • Stopping case: end of hall? , pass so many doors? , – Exceptions • Ex. If go for longer than X minutes, then turn around and go back • Easy to instantiate with values for variables • Note: mtd, mth, etc. , are “abstract” or “meta” behaviors use scripts-- these meta-behaviors are strung together as a plan (later) © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 33

8 e Scripts Summary • Advantages Objectives Review FSM -Case Study 1 Scripts Tactical Summary – 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++ © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 34

8 e Scripts Summary • Will see more of it in Topological Navigation • Advantages Objectives Review FSM -Case Study 1 Scripts Tactical Summary – 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++ © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 35

8 e So Far… • We can use FSM or scripts to “group” or “abstract” behaviors Objectives Review FSM -Case Study 1 Scripts Tactical Summary • But still haven’t addressed where to put behaviors like “avoid” – Lower levels in subsumption – Where in non-subsumption styles? • Or capture implicit sharing between independent behaviors © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 36

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary STRATEGIC AND TACTICAL BEHAVIORS © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 37

8 e CSM at 1997 UGV Competition Objectives Review FSM -Case Study 1 Scripts Tactical Summary • Fully autonomous vehicle, all on-board, navigate a course 10 ft wide, about 800 ft long • Obstacles • Carry a 20 pound payload © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 38

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary 1997 Competition: 3 Behaviors Faster processor, color CCD camera mounted on a pan mechanism. See the turn with lots of obstacles! • Stay-on-path: Turn robot platform to stay in center • Avoid: Turn robot platform to avoid obstacles • Pan-camera: Pan camera to keep lines in view © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 39

8 e 1997 Competition: 3 Do Behaviors you see a problem? Objectives Review FSM -Case Study 1 Scripts Tactical Summary Faster processor, color CCD camera mounted on a pan mechanism. See the turn with lots of obstacles! • Stay-on-path: Turn robot platform to stay in center • Avoid: Turn robot platform to avoid obstacles • Pan-camera: Pan camera to keep lines in view © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 40

8 e Emergent Behavior Isn’t Right © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 41

8 e 1997 Competition All use data at time t, then act independently Objectives Review FSM -Case Study 1 Scripts Tactical Summary Robot moves but “pan camera” doesn’t take that into account • • • Turn robot platform to stay in center Turn robot platform to avoid obstacles Pan camera to keep lines in view Lesson learned: next time make sure the turn camera function took into account that the robot platform was turning © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 42

8 e Observations • Some behaviors would be “factored” out of a sequence because Objectives Review FSM -Case Study 1 Scripts Tactical Summary – Recall factoring from algebra: 3 x 2+9 => 3(x 2+3) – Ex. avoid • Modify the output based on additional knowledge from other behaviors or goals – Ex. Camera pan, Speed control – Ex. Na. Ts (recall from pfields) • Some behaviors come “after” other behaviors – Strategic set general directives • Move to goal, move-thru-door, etc. – Tactical adapts strategic to the situation • Ex. Camera pan, Speed control © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 43

8 e “Tactical” Behaviors Objectives Review FSM -Case Study 1 Scripts Tactical Summary © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 44

8 e UGV Searching For Mines: Tactical Behaviors Sensor Library Behavioral Library Laser Effector Library Avoid Steer Speed Control Drive Gaze control Canera Pan/Tilt Waypoint Search GPS Vision Restablish Comms MTG Raster search, Investigate Look for Explore, Retrace, home © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 45

8 e “Reverse” Subsumption: most basic behaviors get highest priority Sensor Library Behavioral Library Laser Effector Library Avoid Steer Speed Control Drive Gaze control Canera Pan/Tilt Waypoint Search GPS Vision Restablish Comms MTG Raster search, Investigate Look for Explore, Retrace, home © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 46

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary DARPA Grand Challenge 2005 • A priori map with GPS coordinates showed area X was flat and smooth- perfect for going fast and straight • Big robot went through and was so big and mighty that it kicked up lots of big rocks. Area X was no longer smooth • Little robot went next and when it got to area X went very, very fast but had to turn a lot. Finally had to turn suddenly and spun out. What happened in terms of behaviors? How would you fix this with a tactical behavior? © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 47

8 e Good for Guarded Motion Guarded Teloperation: Operator would perform abstract behavior Sensor Library Robot would normally retain control of these Behavioral Library Laser Effector Library Avoid Steer Speed Control Drive Gaze control Canera Pan/Tilt Waypoint Search GPS Vision Restablish Comms MTG Raster search, Investigate Look for Explore, Retrace, home © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 48

8 e Summary • Objectives Review FSM -Case Study 1 Scripts Tactical Summary Principle: Group behaviors which form a sequences into a strategic abstract behaviors, factor out tactical behaviors and allow them to fuse knowledge • Good software engineering, good reuse of modularity • Processing order of behaviors may make a difference; strategic/tactical partitioning is one way of thinking about it • Temporal sequencing is an important part of assemblages • Implicit temporal sequencing can be represented by finite state machines – The table is especially helpful in uncovering unexpected interactions • Scripts are a naturalistic mechanism equivalent to FSM – Useful to think of causal chain as having initialization, nominal, termination • Can be captured within behavioral schema/OOP structure © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 49

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary C is Coordination Function behavior 1 behavior 2 behavior 3 C Output is a single action Overall behavior © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 50

8 e Objectives Review FSM -Case Study 1 Scripts Tactical Summary For Sequences Build “abstract” behaviors capturing a strategic sequence Filter through tactical behaviors behavior 1 C behavior 2 behavior 3 C Output is a single action (for an effector) Overall behavior © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 51

8 e Returning to Questions • Is there a way to explicitly string together sequences of behaviors, rather than rely on innate releasers? – Yes: FSM, Scripts, RAPs, … • How can we visualize complex sequences? – Diagrams (get cluttered), scripts (narratives) • Where does the sequential knowledge “go”? what kind of programming structure, how does it fit behaviors? – Schema-specific knowledge portion of the schema © 2019 Robin Murphy Introduction to AI Robotics 2 nd Edition (MIT Press 2019) 52
- Slides: 52