Part II — Behaviour-based robotics · Chapter 7

Fusion: motor schemas, potential fields and fuzzy control

~38 min read4 interactive widgets4 plates

In this chapter

  1. Fusion
  2. Motor schemas
  3. Schema-based behaviour and perceptual schemas
  4. Potential fields
  5. The five basic fields
  6. Programming a single potential field
  7. A worked example, and the local minima problem
  8. Schema-based coordination: pros and cons
  9. Fuzzy logic
  10. Fuzzy systems for robot control
  11. Check your understanding

1. Fusion

Definition

Fusion is the process of combining multiple possible behaviours into a single behaviour for the robot.

The lectures immediately warn that this is a difficult task: some behaviours could be incompatible — how do you combine "go left" and "go right"? — and there are many different ways to achieve fusion.

ImplementationNote
Simple direct combination of output signals into the actuators, e.g. by summingThe Extended Braitenberg Architecture of Chapter 5
Use of mathematical functions for combining signalsWeighted sums, vector addition
Using fuzzy logicSections 9–10 of this chapter

The examples named in the deck are: Motor schemas (Arbib, Arkin), the Extended Braitenberg architecture, the Process description language (Steels), and Potential fields.

Editor note

Keep Chapter 6 side by side. Arbitration selects one behaviour and discards the rest; fusion lets all of them contribute. The immediate practical consequence: with fusion you never have to write a priority ordering, and you never get the abrupt switching of an FSA — but you do get an output that may be a compromise nobody wanted, and that is precisely the local minima problem of section 7.

2. Motor schemas

Seven statements define the model. They are dense; take them one at a time.

For the exam — the sentence that contrasts with Chapter 6

"No predefined hierarchy exists for coordination." This is the exact opposite of the subsumption architecture, whose entire coordination mechanism is a fixed hierarchy of layers. If you are asked to compare the two architectures, this is the first difference to state; the second is that in subsumption an actuator receives signals from at most one level, whereas in motor schemas every schema contributes to every command.

3. Schema-based behaviour and perceptual schemas

A motor schema (MS) is composed with a perceptual schema (PS), which provides the environmental information specific for that particular behaviour. Each motor schema produces an action vector, consisting of both magnitude and orientation components, that defines the way the robot should move in response to the perceived stimuli.

Different motor schemas may exist, such as move-ahead, move-to-goal and avoid-obstacle.

The role of perceptual schemas

Key idea

The PS/MS pairing is the architectural expression of situatedness. Each behaviour gets its own private, purpose-built view of the world — not a slice of one shared global model. The obstacle-avoidance schema does not need to know where the goal is, and the goal-seeking schema does not need to know about walls. This is the same rejection of a central sensor-fusion repository that Genghis demonstrated in Chapter 6, expressed in a cooperative rather than competitive architecture.

Observations on actuation

Even if the description of motor schemas is given in terms of motors — that is, in reference to movements of the robot — the approach can be generalised to any kind of actuators.

When wheel motors are concerned, the question arises of how to use the resulting vector (the sum of all the individual vectors) to manoeuvre the motors. A vector can be used directly on a robot controlled with a roto-translational model. If the robot is controlled by means of a different model — for example differential steering — a conversion is needed from the roto-translational model.

That conversion is the matrix pair from Chapter 5, section 6: vl = v - (L/2)·w, vr = v + (L/2)·w, where the vector magnitude plays the role of v and the vector angle drives w.

THE MOTOR SCHEMA PIPELINE light sens. proximity ground SENSORS PS goal PS obstacles PS floor PERCEPTUAL SCHEMAS move-to-goal avoid-obstacle move-ahead MOTOR SCHEMAS each MS emits a vector (magnitude, orientation) Σ vector addition no hierarchy v , w vl , vr roto-translational → differential Compare Plate 6.2: there, one layer reached the actuators and the rest were silenced. Here every schema reaches the actuators at once, and each contributes in varying degrees to the overall response. Competitive versus cooperative, drawn side by side.
Plate 7.1 — The motor schema pipeline. Each perceptual schema is private to its motor schema; the only meeting point is the summation node, and the only thing that crosses it is a vector.

4. Potential fields

The vectors of a motor schema are defined by means of potential fields:

The metaphor is doing real work here: it lets you design a behaviour by drawing what you want the world to feel like, rather than by writing what the robot should do. The doing follows from the field.

5. The five basic fields

FieldDefinition from the lectures
(a)UniformThe robot feels the same force no matter where it is. Usually used to capture the behaviour "go in direction d"
(b)PerpendicularThe field is directed away from a surface, such as a wall. A perpendicular field can be pointed towards an object as well
(c)AttractiveRepresents a taxis or a tropism — the robot is attracted to an object or a goal. Arrows have decreasing length as they get closer to the object
(d)RepulsiveOpposite to the attractive field. Arrows get shorter as they move away from the object
(e)TangentialTangent around an object, i.e. perpendicular to radial lines. The field can spin either clockwise or counterclockwise. Useful for directing the robot around an obstacle, or having a robot investigate something
THE FIVE BASIC POTENTIAL FIELDS (a) UNIFORM "go in direction d" (b) PERPENDICULAR wall directed away from a surface (c) ATTRACTIVE taxis / tropism; arrows shorten near the goal (d) REPULSIVE arrows shorten with distance (e) TANGENTIAL perpendicular to radial lines; either spin direction Fields are EGO-CENTRIC: the whole field is drawn only for the reader. The robot computes ONE vector, at its own location, every update.
Plate 7.2 — The five basic fields. Note the opposite length gradients in (c) and (d): attractive arrows shorten as they approach the object, repulsive arrows shorten as they recede from it. That asymmetry is what makes a goal a resting place and an obstacle a local disturbance.

Widget — Field explorer

Pick a field type and move the source. The grid shows the whole field for reading; the highlighted arrow is the only vector a real robot would actually compute — the one at its own position.

6. Programming a single potential field

Three implementation facts, and then three worked examples.

Example 1 — move in a given direction

Vangle  = specified compass direction
Vlength = fixed value

This is the uniform field, written out.

Example 2 — random movements

Vangle  = random direction, changed every k steps
Vlength = fixed value

k is a parameter of the motor schema. Note that it requires counting the number of steps — so even this minimal schema carries a little internal state, which is exactly the point made in Chapter 6, observation 3.

Example 3 — repulsive field, single forward-facing range sensor

Vangle  = -pi

           |  (D - d) / D     for d <= D
Vlength = -|
           |  0               for d >  D

where D is the maximum range of the field's effect and d the measured distance. The magnitude is 1 when the obstacle is touching (d = 0), falls linearly to 0 at the range limit, and is exactly 0 beyond it — so a distant obstacle contributes nothing to the sum, which is what keeps the fusion from being dominated by irrelevant stimuli.

7. A worked example, and the local minima problem

The example used in the lectures is the task of lab activity 4: the robot has to reach a goal avoiding obstacles. Three fields are shown: (a) the repulsive field of the obstacle, (b) the attractive field of the goal, and (c) the combined potential field — followed by the path taken by the robot.

Points of concern

Three warnings are given, and the second is the famous one:

  1. Potential fields treat the robot as if it were a particle that could change velocity and direction instantaneously. This is not true in general for real robots.
  2. Fields might sum to 0. If the magnitude is 0 the robot stops and does not move. This is called the local minima problem: in general, the resulting potential field may have minima that trap the robot.
  3. Possible ways of overcoming the local minima issue: noise; constant fields to produce drifts; use history to detect situations in which the robot is stuck.
THE LOCAL MINIMUM GOAL OBSTACLE robot attract repel sum = 0 → magnitude 0 → the robot stops and does not move approach path Fixes named in the lectures: add NOISE; add a CONSTANT field to produce a drift; or USE HISTORY to detect that the robot is stuck. Note that the third one requires state.
Plate 7.3 — The local minimum. The obstacle is directly between the robot and the goal, so the repulsive and attractive vectors are exactly antiparallel and cancel. Nothing is broken; the fusion simply produced a compromise that is a fixed point.

Widget — Vector sum, and getting stuck

Drag the obstacle by clicking in the arena. Line it up between the robot and the goal and the robot stops dead. Then switch on one of the three remedies from the lectures.

8. Schema-based coordination: pros and cons

Schemas are combined by summing their respective vectors. Weights and parameters can be added — and also tuned by means of a learning algorithm. (That last clause is the hinge to Part III: Chapter 11 will tune exactly such parameters automatically with F-race and irace.)

AdvantagesDisadvantages
Modular approachLocal minima in the global potential field might get the robot trapped
The designer has only to define the specific motor schema / potential fieldParameter calibration is often crucial
Careful — lab activity 4

The handout asks you to think in this order: for a given behaviour, decide first what kind of field is suitable. Remember that the goal is to define a force that will be exerted on the robot — do not think about the movement, since that comes for free when you translate the length and angle of the resulting vector into wheel velocities. Then focus on the perceptual schema (one PS per sensor? one PS for a set of sensors? a combination of PSs?) and consequently define the vector.

Practical notes from the same handout: light and proximity readings in ARGoS-Lua return two fields, value and angle; sensors are numbered 1 to 24 counterclockwise, with sensors 1–12 spanning angles from 0 to almost π and 13–24 spanning −π to 0. Vectors are held in polar form as {length = 0.0, angle = 0.0} and summed two at a time with vector.vec2_polar_sum(v1, v2) from the provided vector.lua module.

For the exam — the comparison question

Lab 4 closes with the question the oral exam likes: elucidate the main differences between the subsumption architecture and motor schemas. Which is easiest to implement? How can one assess the performance of the two implementations? Which is best from the viewpoint of extendibility and composition of behaviours? Is there a way to design a hybrid architecture composed of both — and would it be a good idea? Prepare an answer that uses the vocabulary of Chapter 6, section 3: competitive versus cooperative, fixed hierarchy versus no predefined hierarchy, one level per actuator versus all schemas contributing.

9. Fuzzy logic

The third way of doing fusion is with fuzzy logic. First the logic, then the system.

  • Propositions are either true or false.
  • In other terms, a variable either does or does not belong to a set.
  • Boolean logic is crisp: the boundaries between true and false are neat, and there are no truth values except true and false.
  • Both the law of the excluded middle and the law of non-contradiction hold.
  • Propositions assume any truth value in [0, 1].
  • A variable can belong to a set at a given degree — hence the term fuzzy.
  • It is a multi-valued logic, with infinite values in [0, 1].
  • The law of non-contradiction does not hold: both A and ¬A can be true, but at different degrees.

A variable in fuzzy logic is called a linguistic variable — for example cold, warm, hot, slow, fast, far, near. The amount of truth degree of a linguistic variable is defined by means of a membership function.

Operators

Operators can be defined in many ways. Two frequently used families:

BooleanFuzzy (1) — min-maxFuzzy (2) — multiplication
¬x1 − x1 − x
x ∧ ymin(x, y)xy
x ∨ ymax(x, y)1 − (1 − x)(1 − y)
Key idea — why this is fusion

Because a reading can belong to near-left to degree 0.7 and to far-left to degree 0.3 at the same time, several rules fire simultaneously with different strengths, and the defuzzifier blends their conclusions. There is no arbitration step anywhere: the smooth transition between behaviours falls out of the logic. This is the same "each behaviour contributes in varying degrees" of section 2, obtained with membership functions instead of vectors.

10. Fuzzy systems for robot control

Definition

A fuzzy system applies fuzzy reasoning to map input signals (or questions) to output signals (or answers). The core of a fuzzy system is an inference engine working on a fuzzy rule base. The rule base is composed of IF-THEN rules operating on fuzzy variables.

The four components

  1. Fuzzifier — maps a set of sensor readings onto a collection of fuzzy input sets.
  2. Fuzzy rule base — contains a collection of IF-THEN rules.
  3. Fuzzy inference engine — maps fuzzy sets onto other fuzzy sets according to the rule base and the membership functions.
  4. Defuzzifier — maps a set of fuzzy output sets onto a set of actuator commands.
FUZZY SYSTEM — THE FOUR BLOCKS sensorreadings 1 FUZZIFIERcrisp → fuzzy 3 INFERENCEENGINE 2 RULE BASEIF ... THEN ... 4 DEFUZZIFIERfuzzy → crisp actuatorcommands EXECUTION STEPS 1. Read sensor values. 2. Get membership values of the linguistic variables belonging to the IF. 3. Combine them with the fuzzy logic operators to compute the output (THEN) strengths. 4. Defuzzify: take the CENTRE OF MASS of the output membership functions "cut" at those strengths.
Plate 7.4 — The fuzzy pipeline. Only the two end blocks touch numbers; everything in the middle operates on degrees of membership.

Example rule base for obstacle avoidance

IF clear-ahead  THEN forward
IF near-right   THEN hard-left
IF far-right    THEN left
IF near-left    THEN hard-right
IF far-left     THEN right

The worked setup

Suppose we define a perceptual schema that reads the values from the proximity sensors and produces a processed perception value in [−1, 1] with the following semantics: −1 means maximal proximity of an obstacle on the left, 0 means no obstacles, 1 means maximal proximity on the right.

Moreover, assume a function that maps a value in [−1, 1] to proper commands to the motors, where −1 corresponds to maximal left turning, 0 to going straight, and 1 to maximal right turning. In this way we have one input and one output value to the fuzzy system.

Editor note

Notice that the perceptual schema of section 3 has quietly reappeared: it is what turns 24 raw proximity readings into the single number the fuzzy system consumes. The architectures in this chapter are not alternatives to each other so much as layers of the same design — PS to make sense of the world, then some fusion rule to turn sense into a command.

Execution steps

  1. Read sensor values.
  2. Get membership values of the linguistic variables (belonging to the IF).
  3. Combine, by means of the fuzzy logic operators, these values to compute the output (THEN) strengths.
  4. Defuzzification: use the membership functions associated with the output heading to get numerical values. A typical method consists in taking the centre of mass of the membership functions "cut" at the corresponding strength.

Widget — A fuzzy obstacle-avoidance controller

Move the perception value along [−1, 1] and watch all four steps happen at once: memberships, rule strengths, clipped output sets and the centre of mass. Note how often two rules fire together — that is the fusion.

Perception (−1 = obstacle hard left, 0 = clear, +1 = obstacle hard right): 0.00

Check your understanding

Define fusion and list three ways of implementing it.

Fusion is the process of combining multiple possible behaviours into a single behaviour for the robot. It is difficult because some behaviours could be incompatible. Implementations: simple direct combination of output signals into the actuators (e.g. by summing); use of mathematical functions for combining signals; using fuzzy logic. Named examples: motor schemas (Arbib, Arkin), the Extended Braitenberg architecture, the process description language (Steels), potential fields.

Give the seven defining statements of motor schemas.

A concurrent and distributed model of computation; schemas provide a set of behavioural primitives from which more complex behaviours are constructed; behavioural responses are represented by vectors; vectors are defined by means of potential fields; coordination is achieved through vector additions; no predefined hierarchy exists for coordination; each behaviour can contribute in varying degrees to the overall response.

What is a perceptual schema and what is its role?

A motor schema is composed with a perceptual schema, which provides the environmental information specific for that particular behaviour. The robot "makes sense" of the world by means of PSs. There can be one PS per sensor, or one PS combining several sensor readings, possibly of different kinds. As designers, we encapsulate in a PS the relevant information for a given MS.

What does a motor schema produce, and what has to happen before it reaches the wheels?

It produces an action vector with both magnitude and orientation components, defining how the robot should move in response to the perceived stimuli. The resulting vector — the sum of all individual vectors — can be used directly on a robot controlled with a roto-translational model; with a different model such as differential steering, a conversion is needed, namely vl = v - (L/2)w and vr = v + (L/2)w.

Describe the five basic potential fields.

Uniform: the same force everywhere; captures "go in direction d". Perpendicular: directed away from a surface such as a wall (and can also be pointed towards an object). Attractive: a taxis or tropism towards an object or goal, with arrows decreasing in length as they get closer to the object. Repulsive: the opposite, with arrows getting shorter as they move away. Tangential: tangent around an object, perpendicular to radial lines, spinning either clockwise or counterclockwise; useful for going around an obstacle or investigating something.

Write the repulsive field for a robot with a single forward-facing range sensor.

Vangle = -pi, and Vlength = (D - d)/D for dD, 0 for d > D, where D is the maximum range of the field's effect. The magnitude is 1 at contact, decreases linearly with distance, and is exactly zero beyond the range limit.

What does "fields are ego-centric" mean in practice?

The fields are computed on the basis of the robot's own perception, so although the whole field is usually drawn for the reader, only a single vector needs to be computed — the one at the robot's location — and the robot recomputes the effect of the field at every update. Nothing global is ever stored.

State the three points of concern about potential fields.

(1) They treat the robot as if it were a particle that could change velocity and direction instantaneously, which is not true of real robots. (2) Fields might sum to 0; if the magnitude is 0 the robot stops and does not move — the local minima problem, where the resulting field has minima that trap the robot. (3) Remedies: noise, constant fields to produce drifts, and using history to detect when the robot is stuck.

Give the advantages and disadvantages of schema-based coordination.

Advantages: a modular approach, and the designer has only to define the specific motor schema or potential field. Disadvantages: local minima in the global potential field might trap the robot, and parameter calibration is often crucial. Schemas are combined by summing their vectors; weights and parameters can be added and even tuned by a learning algorithm.

Contrast the subsumption architecture with motor schemas.

Subsumption is arbitration (competitive): behaviours are organised in a fixed hierarchy of layers, higher layers subsume lower ones, and at every instant an actuator receives signals from at most one level. Motor schemas are fusion (cooperative): there is no predefined hierarchy, coordination happens by vector addition, and every schema contributes in varying degrees to every command. Subsumption gives clean priority and abrupt switching; motor schemas give smooth blending and the risk of local minima.

How does fuzzy logic differ from Boolean logic?

In Boolean logic propositions are either true or false, a variable either does or does not belong to a set, the logic is crisp, and both the law of the excluded middle and the law of non-contradiction hold. In fuzzy logic propositions take any truth value in [0, 1], a variable belongs to a set to a degree, it is a multi-valued logic with infinite values in [0, 1], and the law of non-contradiction does not hold — both A and ¬A can be true, at different degrees.

Give the two common families of fuzzy operators.

Both define negation as 1 - x. Min-max: x AND y = min(x, y), x OR y = max(x, y). Multiplication-based: x AND y = xy, x OR y = 1 - (1-x)(1-y).

Name the four components of a fuzzy system and the four execution steps.

Components: fuzzifier (maps sensor readings onto fuzzy input sets), fuzzy rule base (IF-THEN rules), fuzzy inference engine (maps fuzzy sets onto other fuzzy sets according to rule base and membership functions), defuzzifier (maps fuzzy output sets onto actuator commands). Steps: read sensor values; get membership values of the linguistic variables in the IF; combine them with the fuzzy operators to compute the output strengths; defuzzify, typically by taking the centre of mass of the output membership functions cut at the corresponding strength.

Write the example fuzzy rule base for obstacle avoidance.

IF clear-ahead THEN forward; IF near-right THEN hard-left; IF far-right THEN left; IF near-left THEN hard-right; IF far-left THEN right. In the worked setup a perceptual schema turns the proximity readings into one value in [−1, 1] (−1 = obstacle hard left, 0 = clear, +1 = obstacle hard right) and the defuzzified output in [−1, 1] is mapped to motor commands (−1 = maximal left turn, 0 = straight, +1 = maximal right turn).