Skip to the lesson
FixTheRobot Explore Robotics / Navigation / M6 Local Planning and Obstacle Avoidance / M6-T2

Navigation · Theory · M6

M6-T2 — Potential Fields and Local Minima

A robot rolling downhill in an imaginary landscape reaches the goal quickly, unless it settles in a dip on the way.

  • Lesson 2 of 7
  • Module 6: Local Planning and Obstacle Avoidance
  • Theory
  • About 8 minutes to read

The potential field is the shortest local planner you can write: pull towards the goal, push away from obstacles, add the two forces and move. It needs no search and no sampling. It also has one flaw that no choice of constants removes, and every robot that uses it eventually meets it, usually in front of a wall that is not on the path.

Learning objectives

After this lesson, you should be able to:

  • Write the attractive and repulsive potentials and the forces that follow from them.
  • Explain the influence distance and why the repulsive force must be zero beyond it.
  • Show with numbers that the sum of the two fields can have a local minimum.
  • List the usual escapes and cures: recovery rules, wall following, navigation functions and a global path.

The intuition

Imagine the floor of the hospital as a landscape. The goal sits at the bottom of a bowl, obstacles are tall spikes, and the robot is a marble. The marble rolls downhill: towards the goal because the bowl slopes that way, away from the spikes because they push. No planning is needed, only the slope under the marble. This is the idea of artificial potential fields that Khatib introduced for manipulators and mobile robots.

A marble can stop in any dip, not only at the bottom of the bowl. A long wall between the marble and the goal creates a dip in front of it: on one side the bowl pulls it forward, on the other the wall pushes it back, and where the two forces are equal the marble stays. That dip is a local minimum. The robot is not broken. By its own rules it has arrived.

Potential along the line to the goalA plot of the total potential against position. It falls from the start, reaches a local minimum in front of a wall at 5.37 metres, then rises steeply towards the wall. The goal is behind the wall where the potential is zero. wall local minimum x = 5.37 m goal (x = 10 m) startU downhill goal potential is lower,but a wall lies between
The total potential along the line to the goal. Downhill from the start leads to a dip in front of the wall, not to the goal behind it.

The mathematics

Attractive potential

Attractive potential and force
Uatt(q)=12⋅katt⋅∣q−qgoal∣2U_{\text{att}}(q)=\tfrac{1}{2}\cdot k_{\text{att}}\cdot \lvert q-q_{\text{goal}}\rvert ^{2}
Fatt(q)=−∇Uatt=katt⋅(qgoal−q)F_{\text{att}}(q)=-\nabla U_{\text{att}}=k_{\text{att}}\cdot (q_{\text{goal}}-q)

The force grows with the distance to the goal, which makes a fast start and a slow arrival but also a very strong pull far away. Many implementations switch to a constant-magnitude (conic) pull beyond some distance.

Repulsive potential

With ρ the distance from the robot to the surface of an obstacle and ρ₀ the influence distance:

Repulsive potential and force
Urep(ρ)=12⋅η⋅(1ρ−1ρ0)2U_{\text{rep}}(\rho )=\tfrac{1}{2}\cdot \eta \cdot (\frac{1}{\rho }-\frac{1}{\rho _{0}})^{2}
for ρ≤ρ0,\text{for}\,\rho \le \rho _{0},
0 otherwise0\,\text{otherwise}
Frep(ρ)=η⋅(1ρ−1ρ0)ρ2F_{\text{rep}}(\rho )=\frac{\eta \cdot (\frac{1}{\rho }-\frac{1}{\rho _{0}})}{\rho ^{2}}
directed away from the obstacle, for ρ≤ρ0\text{directed away from the obstacle},\,\text{for}\,\rho \le \rho _{0}
katt, η
gains of the attraction and the repulsion.
ρ
distance from the robot to the surface of the nearest part of the obstacle (m).
ρ₀
influence distance: obstacles farther than this exert no force.

The cut-off matters. For ρ > ρ₀ the bracket (1/ρ − 1/ρ₀) is negative, so an expression applied without the test would pull the robot towards far obstacles (lab M6-L1, stage 1). The force is also unbounded as ρ → 0, which is intended: nothing may touch the obstacle.

Following the field

Gradient step
q←q+step⋅F(q)/∣F(q)∣q\leftarrow q+\text{step}\cdot F(q)/\lvert F(q)\rvert
F=Fatt+∑ FrepF=F_{\text{att}}+\sum \,F_{\text{rep}}

Why there are local minima

A point where F = 0 and the field curves upward in every direction is a local minimum. Where the attraction and the repulsion cancel exactly on the line to the goal, the robot stops. Koren and Borenstein listed the practical problems of the method: trap situations, no passage between closely spaced obstacles, oscillations near obstacles, and oscillations in narrow corridors.

Escapes and cures

Ways out of a local minimum
ApproachIdeaCost
Recovery ruleDetect "stuck" from a window of positions, then move sideways, along the wall, or at randomHeuristic; may need several tries
Wall followingSwitch to a tangent field along the obstacle until the way to the goal opensMore states; needs a leave condition
Navigation functionA field designed to have one minimum (Rimon and Koditschek, for known sphere worlds)Needs a known, simple world
Global potentialUse a distance-to-goal field over the grid instead of the straight-line distance (lessons M2-T3 and M3-T1)Needs the map and a wavefront; it is a global planner

A worked example

A wall in front of the goal. Scout is on the line to the goal at x = 0, the goal is at x = 10 m, and a long wall crosses the line at x = 6 m. Take katt = 0.5, η = 1, ρ₀ = 1.5 m. On the line, ρ = 6 − x.

Forces on the line
Fatt(x)=0.5⋅(10−x)F_{\text{att}}(x)=0.5\cdot (10-x)
Frep(x)=16−x−11.5(6−x)2F_{\text{rep}}(x)=\frac{\frac{1}{6-x}-\frac{1}{1.5}}{(6-x)^{2}}
for 6−x<1.5\text{for}\,6-x<1.5

Far from the wall, only Fatt acts: at x = 0 it is 5.0, at x = 4 it is 3.0, and the robot accelerates towards the goal. The repulsion starts at x = 4.5 and rises fast. The two forces balance where Fatt = Frep:

The equilibrium
x≈5.370 mx\approx 5.370\,\mathrm{m}
ρ=0.630 m\rho =0.630\,\mathrm{m}
Fatt=0.5⋅(10−5.370)=2.315F_{\text{att}}=0.5\cdot (10-5.370)=2.315
Frep=10.630−0.6670.6302=2.315F_{\text{rep}}=\frac{\frac{1}{0.630}-0.667}{0.630^{2}}=2.315

This is a minimum, not a saddle: at x = 5.0 the net force is +2.17 (forwards), and at x = 5.6 it is −9.3 (backwards). The potential is 25.0 at the start, 9.0 at x = 4, 6.31 at x = 5, 5.78 at x = 5.37 and 13.8 at x = 5.8. The goal has potential 0, but the robot would have to climb from 5.78 to above 13.8 to get there.

Escaping. The wall extends 1.5 m on one side of the line and 5.0 m on the other, and the escape in the lab drives 3 m along the wall. On the short side 3 m clears the end and the field takes Scout to the goal. On the long side it does not, and the robot slides back into the same minimum. The rule is therefore not “move sideways” but “move sideways towards the nearer end” (lab M6-L1, stage 3).

Engineering implications and limitations

Potential fields are a component

As the only planner they fail at a wall. As a local planner that follows a global path, they are cheap and robust. The global path provides the direction in which the attraction acts, and the repulsion only bends it.

Detect stuck explicitly

Do not rely on the field to know it has stalled. Compare the position now with the position a few seconds ago, and check the distance to the goal, as in the lab. A progress checker with a distance threshold and a time window is the standard form (lesson M7-T6).

Mind the constants

Large η gives oscillation near walls, small η lets the robot touch them. In a corridor the pushes from the two walls cancel at the centre line but amplify any lateral error, which gives the weaving of the fourth problem in the list above. Limit the force, filter it, and scale the step with speed.

Narrow doors

Two obstacles closer than 2·ρ₀ push the robot out of the gap between them even though the robot fits. Use the inflated costmap, not raw obstacles, to decide whether a passage exists (lesson M2-T2).

Common misconceptions

“Better gains remove local minima.”

They only move them. A wall between the robot and the goal produces a minimum for every positive gain.

“Local minima only occur in complicated maps.”

A single straight wall across the line to the goal is enough.

“The robot that is stuck has a bug.”

It has followed its rules to a stable point. The rules are what is incomplete.

“A random push always solves it.”

It may need many tries, and unlucky pushes can return to the same dip. A push towards the nearer end of the obstacle is far more reliable.

Engineering takeaways

  1. The attractive force is katt·(goal − q); the repulsive force η(1/ρ − 1/ρ₀)/ρ² acts only inside ρ₀.
  2. The sum of the two potentials can have local minima where forces cancel, and no gain choice prevents it.
  3. A wall across the line to the goal gives a minimum at the point where Fatt = Frep.
  4. Detect stuck from position history and distance to the goal, then use an escape that heads for the nearer end.
  5. Navigation functions or a global distance field remove the minima, at the price of knowing the map.

References and further reading

The original potential-field papers and the standard critique.

  • O. Khatib, “Real-Time Obstacle Avoidance for Manipulators and Mobile Robots”, International Journal of Robotics Research 5(1), 1986.
  • Y. Koren and J. Borenstein, “Potential Field Methods and Their Inherent Limitations for Mobile Robot Navigation”, IEEE ICRA, 1991.
  • E. Rimon and D. Koditschek, “Exact Robot Navigation Using Artificial Potential Functions”, IEEE Transactions on Robotics and Automation 8(5), 1992.
  • J. Borenstein and Y. Koren, “The Vector Field Histogram: Fast Obstacle Avoidance for Mobile Robots”, IEEE Transactions on Robotics and Automation 7(3), 1991.

Knowledge check

Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

With katt = 0.5, what is the attractive force on a robot 6 m from the goal, and what is the repulsive force (η = 1, ρ₀ = 1.5) from a wall surface 2 m away?

Explanation

Attraction: 0.5 × 6 = 3.0, towards the goal. Repulsion: 0, because 2 m is beyond the influence distance 1.5 m.

Question 2

The repulsive expression is applied to an obstacle at ρ = 3 m with ρ₀ = 1.5 m, with no cut-off. Is the resulting force a push or a pull, and why?

Explanation

A pull. (1/3 − 1/1.5) is negative, so the force points towards the obstacle. The cut-off at ρ₀ is part of the definition.

Question 3

A stuck robot is 0.9 m from a wall that extends 1.5 m to its left and 4.0 m to its right. Which way should the escape go?

Explanation

To the left, along the wall: the nearer end is 1.5 m away, against 4.0 m on the right, so a fixed-length escape clears it.

What’s next

Next: choosing among velocities the motors can reach, and scoring them.

Practice this lesson

Escape the Local Minimum

Scout stops dead facing a wall that is not on the path: add a rule that gets it moving again.

Next lesson

M6-T3 — The Dynamic Window Approach

Sample velocities inside the dynamic window, score them, and explain what each term of the score does.

Nothing below is required to finish this lesson.