35
Lecture 4: Command and Behavior Fusion Gal A. Kaminka [email protected] and Multi-Robot Systems Agents in Physical and Virtual Environments

Lecture 4: Command and Behavior Fusion Gal A. Kaminka [email protected] Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

Embed Size (px)

Citation preview

Page 1: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

Lecture 4:

Command and Behavior Fusion

Gal A. Kaminka

[email protected]

Introduction to Robots and Multi-Robot Systems

Agents in Physical and Virtual Environments

Page 2: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

2 © Gal Kaminka

Previously, on Robots …

Behavior Selection/Arbitration Activation-based selection

winner-take-all selection, behavior networks argmax selection (priority, utility, success likelihood, … )

State-based selection world models, preconditions and termination conditions Sequencing through FSA

Page 3: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

3 © Gal Kaminka

This week, on Robots ….

Announcements Programming homework: This is not an option! Project: expectations

Rosenblatt-Payton Subsumption: Command overrideInformation loss An alternative design: Command Fusion

Behavior Fusion Context-dependent merging of behaviors

Page 4: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

4 © Gal Kaminka

Brooks’ Subsumption Architecture Multiple layers, divided by competence All layers get all sensor readings, issue commands Higher layers override commands by lower layers

What happens when a command is overriden?

Page 5: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

5 © Gal Kaminka

Information Loss in Selection

Layer chooses best command for its competence level Implication: No other command is possible

But layer implicitly knows about satisficing solutions Satisficing: Loosely translated as “good enough”

These get ignored if command is overriden

Page 6: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

6 © Gal Kaminka

Why is this a problemExample: Avoid-obstacle wants to keep away from left

[20,160] heading possible Best: +90 degree heading

Seek-goal wants to keep towards goal ahead [-30,30] heading possible Best: +0 degree heading

No way to layer these such that overriding works But [20,30] is good for both

Page 7: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

7 © Gal Kaminka

There is a deeper problem

When a higher-level behavior subsumes another It must take the other’s decision-making into account A higher behavior may have to contain lower behaviors Include within itself their decision-making

Example: Goal-seek overrides avoid Must still avoid while seeking goal May need to reason about obstacles while seeking

Page 8: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

8 © Gal Kaminka

Rosenblatt-Payton Command Fusion

Two principles: Every behavior weights ALL possible commands

Weights are numbers [-inf,+inf] “No information loss”

Any behavior can access weights of another Not just override its output “no information hidden”

Page 9: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

9 © Gal Kaminka

Weighting outputs

AVOID does not choose a specific heading It provides preferences for all possible headings

AVOIDSensor

-20 degrees

20 degrees

30 degrees

160 degrees

-20

-10

+30

+60

Page 10: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

10 © Gal Kaminka

Merging outputs

Now combine AVOID and SEEK-GOAL by adding

AVOIDSensor

-20 degrees

20 degrees

30 degrees

160 degrees

SEEK

-20

-10

+30

+60

+25

+5

+10

-30

Page 11: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

11 © Gal Kaminka

Merging outputs Now combine AVOID and SEEK-GOAL by adding Then choose top one (e.g., winner-take-all)

AVOIDSensor

-20 degrees, +5

20 degrees, -5

30 degrees, +40

160 degrees, +30

SEEK

-20

-10

+30

+60

+25

+5

+10

-30

Page 12: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

12 © Gal Kaminka

Advantages

Easy to add new behaviors that modify heading Their output is also merged

Considers all possibilities—finds useful compromises Negative weights possible, useful

Can forbid certain commands, in principle And….

Page 13: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

13 © Gal Kaminka

Advantages

Easy to add new behaviors that modify heading Their output is also merged

Considers all possibilities—finds useful compromises Negative weights possible, useful

Can forbid certain commands, in principle And…. Intermediate Variables

Page 14: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

14 © Gal Kaminka

Rosenblatt-Payton 2nd Principle:No information hidden

Not only all choices of behavior should be open Internal state can also be important for other layers In Rosenblatt-Payton, a variable is a vector of weights

We operate, combine, and reason about weights Even as internal state variables

Example: Trajectory speed behavior (in article) Combines internal “Safe-Path”, “Turn-choices” output

Page 15: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

15 © Gal Kaminka

A problem Two behaviors

If goal is far, speed should be fast if obstacle is close, speed should be stop

Robot may not slow sufficiently Because overall results compromises between stop and fast

Options: Tweak weights… Hack the numbers Add distance to goal into obstacle-avoidance rules Re-define fast to be slower

Page 16: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

16 © Gal Kaminka

Behavior Weighting Use decision context to weight the behaviors

Dynamic weighting: change weights based on context Have a meta-behavior with context rules

IF obstacle-close THEN increase weight of AVOID IF not obstacle-close THEN increase weight of SEEK

Scale/weight based on context rules Weights of AVOID, SEEK multiplied by the behavior weight

Page 17: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

17 © Gal Kaminka

Merging outputs: Static Combine AVOID and SEEK-GOAL by adding Then choose top one (e.g., winner-take-all)

AVOIDSensor

-20 degrees, +5

20 degrees, -5

30 degrees, +40

160 degrees, +30

SEEK

-20

-10

+30

+60

+25

+5

+10

-30

Page 18: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

18 © Gal Kaminka

When obstacle close Combine AVOID and SEEK-GOAL by adding Then choose top one (e.g., winner-take-all)

AVOIDSensor

-20 degrees, -27.5

20 degrees, -17.5

30 degrees, +65

160 degrees, +105

SEEK

-20

-10

+30

+60

+25

+5

+10

-30

+2

0.5

Page 19: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

19 © Gal Kaminka

When obstacle not close Combine AVOID and SEEK-GOAL by adding Then choose top one (e.g., winner-take-all)

AVOIDSensor

-20 degrees, +40

20 degrees, +5

30 degrees, +35

160 degrees, -30

SEEK

-20

-10

+30

+60

+25

+5

+10

-30

0.5

+2

Page 20: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

20 © Gal Kaminka

Final thoughts… Context rules combine activations and fusion

Activation of behavior by priority Behavior has vector output (rather than single value) When should we use this? What about meta-meta behaviors?

Compromises are a problem: Can cause a selection of non-satisficing solution Sometimes must choose!

Compromises must be on package deals: Otherwise, get behavior X on speed, behavior Y on heading!

Page 21: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

21 © Gal Kaminka

?שאלות

Page 22: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

22 © Gal Kaminka

Potential Fields

Independently developed from Payton-Rosenblatt Inspired by Physics

Robot is particle Moving through forces of attraction and repulsion

Basic idea: Each behavior is a force: Pushing robot this way or that Combination of forces results in selected action by robot

Page 23: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

23 © Gal Kaminka

Example: Goal-directed obstacle-avoidance

Move towards goal while avoiding obstacles We have seen this before:

In Brooks' subsumption architecture (two layers) In Payton-Rosenblatt command fusion

Two behaviors: One pushes robot towards goal One pushes robot away from obstacle

Page 24: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

24 © Gal Kaminka

SEEK Goal

Page 25: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

25 © Gal Kaminka

Avoid Obstacle

Page 26: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

26 © Gal Kaminka

In combination....

Page 27: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

27 © Gal Kaminka

Run-time Robot calculates forces current acting on it Combines all forces Moves along the resulting vector

Page 28: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

28 © Gal Kaminka

But how to calculate these fields?

Translate a position into a direction and magnitude Given X,Y of robot position Generate force acting on this position (dx,dy)

Do this for all forces Combine forces:

Final_dx = sum of all forces dx Final_dy = sum of all forces dy

Page 29: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

29 © Gal Kaminka

Example: SEEKGiven: (Xg, Yg) goal coordinates, (x,y) current position

Calculate: Find distance to goal d = sqrt((Xg-x)^2 + (Yg-y)^2) Find angle to goal a = tan-1((Yg-y)/(Xg-x)) Now:

If d = 0, then dx = dy = 0 If d < s, then dx = d cos(a), dy = d sin(a) If d >= s, then dx = s cos(a), dy = s sin(a)

Page 30: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

30 © Gal Kaminka

Other types of potential fields

Potential fiels useful in more than avoiding obstacles Can set in advance many different types Combine them dynamically

Each field is a behavior All behaviors always active

Page 31: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

31 © Gal Kaminka

Uniform potential field

dx = constant, dy = 0 e.g., for follow wall, or return to area

Page 32: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

32 © Gal Kaminka

Perpendicular field

dx = +constant or -constant, depending on reference e.g., for avoid fence

Page 33: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

33 © Gal Kaminka

Problem: Stuck!

Can get stuck in local minimum All forces in a certain area push towards a sink Once robot stuck, cannot get out One solution: Random field

Distance d and angle a chosen randomly Gets robot unstuck, but also unstable

Page 34: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

34 © Gal Kaminka

A really difficult problem:

Page 35: Lecture 4: Command and Behavior Fusion Gal A. Kaminka galk@cs.biu.ac.il Introduction to Robots and Multi-Robot Systems Agents in Physical and Virtual Environments

35 © Gal Kaminka

A surprising solution

Balch and Arkin found a surprisingly simple solution Avoid-the-past field Repulsion from places already visited This is a field that changes dynamically