9
Potential Fields Tutorial Michael A. Goodrich 1 Introduction Rodney Brooks introduced the concept of reactive robotics, often referred to as behavior-based robotics, wherein robot architectures are built on activity-generating building blocks rather than on centralized representations and deductive logic. You will soon be familiar with these concepts when you read the paper by Brooks, Intelligence without Representation which we will discuss next time. In addition to the seminal work by Brooks, two references that I like on reactive robotics are [3, 1]. Much of this tutorial is adapted from these references. (Note that Arkin identifies different behaviors as schemas. I don’t see much advantage in using this term, but it has been around in cognitive psychology at least since the time of Piaget so maybe Arkin uses the term because it is somewhat grounded in science.) The basic idea of behavior-based robotics is that robots should be built from the bottom up using ecologically adapted behaviors. These behaviors are often simple stimulus-response loops, meaning that the robot senses some environmental stimulus (like light) and generates some action in response (like turn toward the light). In Murphy’s words, a behavior is a mapping from sensor input to a pattern of motor action; see Figure 1. Behavior Sensor Input Pattern of Motor Action Figure 1: Graphical definition of a behavior, adapted from Murphy [3]. There are two approaches to managing multiple behaviors: always-on and sometimes-on. Always- on behaviors are always looking at the environment and issuing actuator commands. Sometimes-on behaviors only issue actuator commands when some environmental signal triggers their behavior. We will only talk about always-on behaviors, but you should know that there is some cool work on sometimes-on behaviors too (can you think of a technique for managing when behaviors are triggered?). You should also know that there are techniques (e.g., Brooks’s subsumption architec- ture [2]) where the actuator commands issued by always-on behaviors are suppressed or inhibited by other behaviors. In this class, we will talk about two different always-on techniques: potential fields and utilitarian voting. As we discuss these techniques (in this and another tutorial), we will address how behaviors are represented and how they are combined. 1

Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

  • Upload
    others

  • View
    6

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

Potential Fields Tutorial

Michael A. Goodrich

1 Introduction

Rodney Brooks introduced the concept of reactive robotics, often referred to as behavior-basedrobotics, wherein robot architectures are built on activity-generating building blocks rather thanon centralized representations and deductive logic. You will soon be familiar with these conceptswhen you read the paper by Brooks, Intelligence without Representation which we will discuss nexttime. In addition to the seminal work by Brooks, two references that I like on reactive roboticsare [3, 1]. Much of this tutorial is adapted from these references. (Note that Arkin identifies differentbehaviors as schemas. I don’t see much advantage in using this term, but it has been around incognitive psychology at least since the time of Piaget so maybe Arkin uses the term because it issomewhat grounded in science.)The basic idea of behavior-based robotics is that robots should be built from the bottom up

using ecologically adapted behaviors. These behaviors are often simple stimulus-response loops,meaning that the robot senses some environmental stimulus (like light) and generates some actionin response (like turn toward the light). In Murphy’s words, a behavior is a mapping from sensorinput to a pattern of motor action; see Figure 1.

BehaviorSensorInput

Patternof MotorAction

Figure 1: Graphical definition of a behavior, adapted from Murphy [3].

There are two approaches to managing multiple behaviors: always-on and sometimes-on. Always-on behaviors are always looking at the environment and issuing actuator commands. Sometimes-onbehaviors only issue actuator commands when some environmental signal triggers their behavior.We will only talk about always-on behaviors, but you should know that there is some cool workon sometimes-on behaviors too (can you think of a technique for managing when behaviors aretriggered?). You should also know that there are techniques (e.g., Brooks’s subsumption architec-ture [2]) where the actuator commands issued by always-on behaviors are suppressed or inhibitedby other behaviors.In this class, we will talk about two different always-on techniques: potential fields and utilitarian

voting. As we discuss these techniques (in this and another tutorial), we will address how behaviorsare represented and how they are combined.

1

Page 2: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

2 Basic Potential Fields Concepts

When you think of potential fields, picture in your mind either a charged particle navigating througha magnetic field or a marble rolling down a hill. The basic idea is that behavior exhibited by theparticle/marble will depend on the combination of the shape of the field/hill. Unlike fields/hillswhere the topology is externally specified by environmental conditions, the topology of the potentialfields that a robot experiences are determined by the designer. More specifically, the designer(a) creates multiple behaviors, each assigned a particular task or function, (b) represents each ofthese behaviors as a potential field, and (c) combines all of the behaviors to produce the robot’smotion by combining the potential fields. We will deal with very simple behaviors, show howto represent these simple behaviors using potential fields, and then show how to combine thesebehaviors.

2.1 Representing Behaviors

The fundamental building block of potential fields is the action vector, which corresponds, roughly,to the speed and orientation of a moving robot. Each behavior outputs a desired output vector. Forexample, consider a SeekGoal behavior that is assigned the task of making the robot head towardan identified goal. The output of the SeekGoal behavior is a vector that points the robot toward thegoal. If I took the robot on a pretend journey through every point in a two-dimensional world andrecorded the output vector at each point, the collection of these vectors would look something likethe diagram illustrated in Figure 2. This collection of vectors is called a potential field because it

Figure 2: An attractive potential field, corresponding to the SeekGoal behavior.

2

Page 3: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

represents synthetic energy potentials that the robot will follow. The potential field associated withthe SeekGoal behavior is an example of an attractive potential because the field causes the robot tobe attracted to the goal (i.e., all vectors point to the goal). You should note that this whole fieldis never actually computed. I computed it so that you could get a ”god’s eye” perspective on whatthe robot would experience at any point in the space, but the robot only sees that portion of thefield that it directly encounters.You might be interested in how I generated the above potential field. One way to think of a

potential field is to think of it as a mapping from one vector into another vector. For the 2-Dnavigation in the figure, it is the mapping from the vector v = [x, y]T into the gradient vector∆ = [∆x,∆y]T (the superscript T represents ”transpose” — I use it because I like column vectorsbetter than row vectors). Now, we could find ∆ by defining some vector function of v and thentaking the gradient of this function, but I prefer a more direct approach. To generate the abovefields, I just defined ∆x and ∆y in terms of v as follows:

• Let (xG, yG) denote the position of the goal. Let r denote the radius of the goal. Let v = [x, y]T

denote the (x, y) position of the agent.

• Find the distance between the goal and the agent: d =√

(xG − x)2 + (y − yG)2.

• Find the angle between the agent and the goal θ = tan−1(

yG−y

xG−x

)

. (I use the atan2 function

because it gives you the angle in the correct quadrant.)

• Set ∆x and ∆y according to the following:

if d < r ∆x = ∆y = 0if r ≤ d ≤ s+ r ∆x = α(d− r) cos(θ) and ∆y = α(d− r) sin(θ)if d > s+ r ∆x = αs cos(θ) and ∆y = αs sin(θ)

This sets up a goal as a circle with radius r. When the agent reaches the goal no forces from thegoal act upon it, whence when d < r both ∆x and ∆y are set to zero. The field has a spread of sand the agent reaches the extent of this field when d = s + r. Outside of this circle of extent, thevector magnitude is set to the maximum possible value. Within this circle of extent but outside ofthe goal’s radius, the vector magnitude is set proportional to the distance between the agent andthe goal. I include the constant α > 0 so that the strength of the field can be easily scaled.

2.2 Combining Potential Fields

In the world diagrammed in Figure 2, the robot would easily glide to the origin so this is not a veryinteresting problem. It gets interesting when, in addition to the SeekGoal behavior, we have otherbehaviors such as the AvoidObstacle behavior diagrammed in Figure 3. I defined the AvoidObstaclepotential field as follows:

• Let (xO, yO) denote the position of the obstacle. Let r denote the radius of the obstacle. Letv = [x, y]T denote the (x, y) position of the agent.

• Find the distance between the obstacle and the agent: d =√

(xO − x)2 + (y − yO)2.

3

Page 4: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

Figure 3: A reject potential field, corresponding to the AvoidObstacle behavior.

• Find the angle between the agent and the obstacle θ = tan−1(

yO−yxO−x

)

. (I use the atan2 function

because it gives you the angle in the correct quadrant.)

• Set ∆x and ∆y according to the following:

if d < r ∆x = −sign(cos(θ))∞ and ∆y = −sign(sin(θ))∞if r ≤ d ≤ s+ r ∆x = −β(s+ r − d) cos(θ) and ∆y = −β(s+ r − d) sin(θ)if d > s+ r ∆x = ∆y = 0

Within the obstacle, the repulsive potential field is infinite and points out from the center of theobstacle (the sign function returns the sign of an argument). Outside of the circle of influence, therepulsive potential field is zero. Within the circle of influence but outside the radius of the obstacle,the magnitude of the vector grows from zero (when β(s+ r− d) = 0 when d = s+ r correspondingto the agent being on the edge of the circle of influence) to β(s) (β(s + r − d) = β(s) when d = r

corresponding to the agent being on the edge of the obstacle). The constant β > 0 is given to allowthe agent to scale the strength of this field. Notice that the vector points away from the obstacle;this done by introducing the negative sign into the definitions of ∆x and ∆y.Since many problems will have both goals (e.g., a flag, in the capture the flag game) and

obstacles (e.g., an opponent, in the capture the flag game), we have to figure out how to combinethese potential fields. We combine multiple potential fields by adding them together. Doing thisfor our two-behavior robot in a world with both an obstacle and a goal gives the new potentialfield diagrammed in Figure 4. This field was generated by first finding ∆Gx and ∆Gy, the vector

4

Page 5: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

40 45 50 55 60 65

40

45

50

55

60

65

Goal

Obst

Figure 4: The potential field generated by our two-behavior robot when there is a goaland an obstacle.

generated by the attractive goal, second finding ∆Ox and ∆Oy, the vector generated by the repulsiveobstacle, and third adding these vectors together to find

∆x = ∆Ox+∆Gx (1)

∆y = ∆Oy +∆Gy. (2)

2.3 Choosing Actions

Suppose that we put our two-behavior robot near the origin in the world diagrammed in Figure 4.How does the robot choose its behavior? It determines the ∆x using Equation (1) of the potentialfield generated by its two behaviors, determines ∆y using Equation (2), finds the velocity v =√

(∆x2 + ∆y2) and the angle θ = tan−1(

∆y

∆x

)

, and then sets the speed to v and the direction toθ. As it moves through the world, it makes observations of the environment, identifies new actionvectors, and chooses new directions/speeds. The resulting trajectory of the robot looks somethinglike the path diagrammed in Figure 5.

3 Types of Potential Fields

We have introduced two types of fields, but there are others that might be useful. I’ll let you figureout kinds of worlds where they may might be useful, though I might give you a couple of ideasalong the way. Some of the fields are well summarized in [3], and others in [1].The first field is the uniform potential field, and is illustrated in Figure 6. It is obtained by

setting ∆x = c and ∆y = 0 (or other constant values that represent the direction desired). It might

5

Page 6: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

20 30 40 50 60 70 8020

30

40

50

60

70

80

Figure 5: The trajectory experienced by our two-behavior robot when there is a goaland an obstacle.

be useful for a FollowWall behavior or a ReturnToTerritory behavior.The second field is the perpendicular potential field, and is illustrated in Figure 7. It might be

useful for a AvoidWall or aAvoidTerritory behavior. It is obtained by setting ∆x = ±c and ∆y = 0(or other constant values that represent the direction directions).The fourth field is the tangential potential field, and is illustrated in Figure 8. This field is

obtained by finding the magnitude and direction in the same way as for the repulsive obstacle.However, θ is modified before ∆x and ∆y are defined by setting θ ← θ ± 90◦ which causes thevector to shift from pointing away from the center of the obstacle to pointing in the direction of thetangent to the circle. The sign of the shift controls whether the tangential field causes a clockwiseour counterclockwise spin. It might be useful for a PatrolFlag or CircleOpponent behavior.The sixth field is the Random potential field. This field is useful because it helps the agent

bounce around and avoid getting stuck in local minima that might arise when multiple fields areadded together. It is obtained by randomly selecting d from a uniform distribution (i.e., pickingany point with equal probability) over the interval [0, γ] and θ from a uniform distribution over theinterval [0, 2 ∗ π].The final field is the AvoidPast potential field. Let me motivate why we might want this field.

Consider the world with a box canyon diagrammed in Figure 10. If the robot starts at the bottomof the world, it will be attracted into the box canyon by the goal. As it enters the box canyon, itwill begin to experience the forces from the AvoidWall behavior which will cause it to center in thecanyon. Eventually, it will reach a point where the attractive potential from the goal is insufficientto overcome the repulsive potentials from the walls and the robot will be stuck.One way to handle this box canyon effect is to introduce an AvoidPast behavior which sets ups

repelling potential fields for each location that it has visited — more recently visited areas have more

6

Page 7: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

Figure 6: The uniform potential field.

Figure 7: The perpendicular potential field.

7

Page 8: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

Figure 8: The tangential potential field.

Figure 9: The random potential field.

8

Page 9: Potential Fields Tutorial - Goucher Collegejillz/cs325_robotics/goodrich_potential_fields.pdf40 45 50 55 60 65 40 45 50 55 60 65 Goal Obst Figure4:Thepotentialfleldgeneratedbyourtwo-behaviorrobotwhenthereisagoal

Goal

Figure 10: A world with a box canyon.

repelling force. If set up right, the robot would explore down the box canyon, retreat as it avoids itspast locations, and eventually find its way around the canyon. A very simple implementation is tointroduce a series of repulsive potentials with zero radius located at recently visited (x, y) positions.β can be decreased as time progresses so that recently visited locations are more repulsive thanpositions visited long ago. If you are interested, you can find a paper by Balch and Arkin aboutavoiding the past on the web.

References

[1] R. C. Arkin. Behavior-Based Robotics. MIT Press, Cambridge, Massachusetts, 1998.

[2] R. A. Brooks. Cambrian Intelligence: The Early History of the New AI. MIT Press, Cambridge,Massachusetts, 1999.

[3] R. R. Murphy. Introduction to AI Robotics. MIT Press, 2000.

9