Robotics
Potential Field Path Planning
Attractive goal, repulsive obstacles — a robot rolling downhill toward its target
Artificial potential field path planning steers a robot by treating it as a point particle moving through a scalar potential field U(q): the goal digs an attractive well that pulls the robot in, every obstacle raises a repulsive hill that pushes it away within an influence radius, and the negative gradient of the summed field, F = −∇U, is the instantaneous motion vector. Proposed by Oussama Khatib in 1985 for real-time manipulator obstacle avoidance, it is one of the cheapest reactive planners known — a single gradient evaluation costs microseconds and runs comfortably at 1 kHz control rates with no global map. The price is completeness: where attractive and repulsive gradients cancel, the robot stalls in a local-minimum trap. Navigation functions (Rimon–Koditschek, 1992) and harmonic potentials remove those traps at the cost of needing a known map.
- Core ideaGoal attracts, obstacles repel
- Motion lawF = −∇U(q)
- OriginKhatib, 1985
- CharacterReactive, local, map-free
- Failure modeLocal-minima trap (∑∇U = 0)
- FixNavigation function / harmonic field
Interactive visualization
Press play, or step through manually. The visualization is yours to drive — try it before reading on.
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
Why potential fields matter
Almost every mobile robot faces the same real-time question thousands of times a second: given where I am, where the goal is, and what my sensors see right now, which way should I move? A search-based planner answers that by reasoning about the whole map. A potential field answers it with a single vector-arithmetic step — no graph, no tree, no map required. That combination of near-zero compute cost and direct sensor coupling is why the method has survived four decades in production code.
- Real-time obstacle avoidance. Khatib built it precisely so a manipulator could dodge a moving object between servo cycles, at rates a global planner cannot match.
- Sensor-direct. A LiDAR or sonar return is itself a repulsive source; the field can be computed straight from raw range data without building a map first.
- Local layer of a hybrid stack. On real platforms it (or its close cousin the Dynamic Window Approach) is the fast local planner underneath a global route from A*, Dijkstra, or an RRT.
- Swarms and formations. Inter-robot repulsion plus goal attraction gives flocking and collision-free formation keeping almost for free.
- Smooth commands. The gradient is a continuous vector, so the output is a naturally smooth velocity rather than a jagged waypoint list.
- Teaching clarity. "Roll downhill toward the goal, but the obstacles are bumps" is the most intuitive planner there is — a gateway to configuration-space thinking.
How it works, step by step
Model the robot as a point in configuration space at position q (in the plane, q = (x, y)). Build a scalar field U(q) as the sum of an attractive part and a repulsive part, then move opposite to its gradient.
- Attractive potential. A bowl centered on the goal qgoal. A parabolic (quadratic) well Uatt = ½·ζ·‖q − qgoal‖² gives a spring-like pull; far from the goal engineers switch to a conic well so the force does not grow without bound.
- Repulsive potential. Around each obstacle, a barrier that is zero beyond an influence radius ρ₀ and rises sharply as the distance ρ to the obstacle shrinks — the field ignores obstacles you are nowhere near.
- Superposition. U(q) = Uatt(q) + Σ Urep,i(q). Fields simply add, which is why the method scales trivially with obstacle count.
- Take the gradient. The artificial force is F(q) = −∇U(q) = Fatt + Σ Frep,i. It points "downhill," toward the goal but bent away from nearby obstacles.
- Command the robot. Treat F as a desired velocity (v = k·F) or, in Khatib's operational-space form, as a force/acceleration on the manipulator's end-effector. Clamp to the robot's speed limit.
- Repeat every control tick. Re-read the sensors, recompute F, move. No state is carried between steps — the planner is memoryless and purely reactive.
The governing equations
The attractive force from a quadratic well, capped by a switch distance d* to a conic profile beyond it:
Fatt(q) = −ζ (q − qgoal) for ‖q − qgoal‖ ≤ d*, and Fatt(q) = −ζ d* (q − qgoal) / ‖q − qgoal‖ beyond it.
The repulsive force from a single obstacle, active only inside the influence radius:
Frep(q) = η ( 1/ρ − 1/ρ₀ ) (1/ρ²) ∇ρ when ρ ≤ ρ₀, and Frep(q) = 0 when ρ > ρ₀.
The commanded motion is the superposed, negated gradient:
F(q) = Fatt(q) + Σi Frep,i(q) = −∇U(q), vcmd = k · F(q).
| Symbol | Meaning | Typical value / units |
|---|---|---|
| q, qgoal | Robot and goal position in configuration space | metres (m), planar (x, y) |
| U(q) | Total scalar potential | arbitrary "energy" units (J-like) |
| F = −∇U | Artificial force / motion vector | N (or unitless direction · gain) |
| ζ (zeta) | Attractive gain (spring constant) | ~0.5–5 N/m |
| η (eta) | Repulsive gain | ~0.1–2 N·m³ (scenario-tuned) |
| ρ | Shortest distance from robot to obstacle surface | metres (m) |
| ρ₀ | Obstacle influence radius (repulsion cutoff) | ~0.3–1.5 m |
| d* | Switch distance, quadratic → conic well | ~1–3 m |
| k | Force-to-velocity scaling gain | tuned per platform |
Worked example: the force at a point
Take a planar robot at q = (0, 0) m, a goal at qgoal = (10, 0) m, and one circular obstacle whose nearest surface point is 0.8 m away at bearing directly toward the goal. Use ζ = 1.0 N/m, η = 0.5 N·m³, ρ₀ = 1.5 m, and stay inside the switch distance so the well is quadratic.
- Attractive force: Fatt = −ζ (q − qgoal) = −1.0 · (0−10, 0−0) = (+10, 0) N — a strong pull straight toward the goal.
- Repulsive force: ρ = 0.8 m < ρ₀, so it fires. Magnitude = η (1/ρ − 1/ρ₀)(1/ρ²) = 0.5 · (1/0.8 − 1/1.5) · (1/0.64) ≈ 0.5 · (1.25 − 0.667) · 1.5625 ≈ 0.456 N, directed away from the obstacle, i.e. (−0.456, 0) N along the line of approach.
- Net force: F = (10 − 0.456, 0) ≈ (9.54, 0) N. The obstacle sits dead ahead, exactly between robot and goal, so both forces are collinear — the robot slows but keeps pushing straight in.
This is exactly the geometry that breeds trouble: shrink the obstacle gap and crank η, and the repulsion can grow to cancel the attraction. When the two become equal and opposite the net force is zero — a local minimum — and the robot freezes short of the goal even though a clear path exists a metre to either side.
Common misconceptions and failure modes
- "Gradient descent always reaches the goal." False for the basic field. Concave (U-shaped) obstacles, a symmetric obstacle on the goal line, and narrow throats all create local minima where ∑∇U = 0 short of the target.
- "It plans a path." It does not. The basic method has no memory and no lookahead; it emits one vector per tick. What looks like a path is the integral of many reactive steps, and it is not guaranteed to exist.
- "Bigger repulsive gain is safer." Large η makes the robot skittish, causes it to refuse narrow-but-valid passages, and worsens oscillation as it bounces across the influence boundary ρ₀.
- "Obstacles far away still matter." No — repulsion is exactly zero beyond ρ₀. This locality is a feature (cheap, sensor-direct) but means the robot is blind to what it must eventually route around.
- "It is complete." It is not. Unlike a resolution-complete grid search or a probabilistically complete RRT, the basic field can fail to find a path that demonstrably exists.
- "Oscillation is a tuning bug." Partly structural: the repulsive gradient is steep and switches abruptly at ρ₀, so discrete time steps in a narrow corridor produce limit cycles. Damping, potential smoothing, or a vortex/rotational field are the real cures.
Escaping the trap: navigation functions and beyond
Because the trap is fundamental to naive gradient descent, escape strategies fall into two camps — patch the descent, or replace the field with one that has no bad minima.
| Method | Local minima? | Needs a map? | Complete? | Typical cost |
|---|---|---|---|---|
| Basic APF (Khatib) | Yes — traps possible | No (sensor-direct) | No | µs, ~1 kHz |
| APF + random walk / wall-follow | Escapes, not guaranteed | No | No | µs–ms |
| Navigation function (Rimon–Koditschek) | None (single minimum) | Yes (sphere world + diffeomorphism) | Yes* | ms (offline build) |
| Harmonic potential (Laplace) | None (max principle) | Yes (grid BVP) | Yes* | ms–s (grid solve) |
| RRT / RRT* (sampling) | N/A — global search | Yes | Probabilistically complete | ms–s |
*Guaranteed under the stated geometric assumptions (known, well-modelled workspace).
- Navigation function. Rimon and Koditschek (1992) constructed a potential with a single minimum at the goal and no spurious ones on a "sphere world," using a tunable exponent κ; arbitrary domains are mapped to a sphere world by a diffeomorphism. Gradient descent then reaches the goal from almost every start — completeness restored, at the price of a known map.
- Harmonic fields. Solve Laplace's equation ∇²U = 0 over the free space with the goal at low potential and obstacle boundaries at high potential. The maximum principle forbids interior minima, so descent always succeeds; the cost is a numerical boundary-value solve on a grid.
- Vortex / rotational fields. Add a swirl component so the robot circulates around an obstacle instead of stalling in front of it — cheap, keeps reactivity, tames oscillation.
- Hybrid stacks. The industry answer: a global planner (A*, Dijkstra, RRT) supplies a route that dodges concave traps, and a potential field or DWA does the fast, sensor-driven local avoidance along it.
Potential fields vs. RRT: local reflex vs. global search
The two live at opposite ends of the planning spectrum. A potential field is a reflex: from the current sensor snapshot it computes one force in microseconds, needs no model, and runs at control-loop rate — but it is local and can be trapped. An RRT is a search: it grows a tree over the whole configuration space, is probabilistically complete, and finds a route around a concave obstacle a field would stall in — but it needs a model, costs milliseconds to seconds, and outputs a path that still requires a tracking controller. Real robots use both: the sampling planner picks the route, the field keeps you off the walls between waypoints.
Frequently asked questions
What is artificial potential field path planning?
It is a reactive navigation method that treats the robot as a particle moving through a scalar potential field U(q). The goal creates an attractive potential that decreases toward the target, and each obstacle creates a repulsive potential that spikes near its surface. The robot follows the negative gradient of the total field, F = -grad U, which points downhill toward the goal while curving around obstacles. Oussama Khatib introduced it in 1985 for real-time manipulator control.
How is the potential field force calculated?
The attractive force is usually F_att = -zeta (q - q_goal), a spring-like pull whose magnitude grows with distance to the goal (often capped beyond a threshold to avoid huge commands). The repulsive force is F_rep = eta (1/rho - 1/rho_0)(1/rho^2) times the gradient of distance, active only when the distance rho to an obstacle is below the influence radius rho_0, and zero outside it. The total force F = F_att + sum(F_rep) is scaled to a velocity or acceleration command for the robot.
What is the local minima problem in potential fields?
A local minimum occurs where the attractive and repulsive gradients cancel, so the total force is zero even though the robot has not reached the goal. Classic traps are a U-shaped or concave obstacle, a symmetric obstacle directly between robot and goal, and two obstacles forming a narrow throat. The robot stalls or oscillates. Because the basic method is a pure gradient descent, it cannot escape without help such as random walks, wall-following, virtual obstacles, or a globally correct navigation function.
What is a navigation function?
A navigation function is a specially constructed potential, proven by Rimon and Koditschek in 1992, that has exactly one minimum at the goal and no spurious local minima, so gradient descent is guaranteed to reach the goal from almost every start. On sphere worlds a closed-form navigation function exists using a tuning exponent kappa; other domains are mapped to a sphere world by a diffeomorphism. It fixes the trap problem but requires a known, geometrically simple map, unlike the purely local basic field.
How does potential field navigation compare to RRT?
Potential fields are reactive and local: they compute a single force from the current sensor snapshot in microseconds, need no map, and run at kilohertz control rates, but they can get trapped in local minima and are not complete. RRT and other sampling planners are global and search-based: they build a tree over the whole configuration space, are probabilistically complete, and find a path around concave obstacles, but they need a model, take milliseconds to seconds, and produce a path that still needs a tracking controller. In practice a global planner such as RRT provides the route and a potential field or DWA handles fast local avoidance.
Why do potential field robots oscillate near obstacles?
Oscillation comes from the discontinuity and steepness of the repulsive gradient near an obstacle boundary combined with discrete time steps. As the robot crosses in and out of the influence radius rho_0, the repulsive force switches on and off abruptly, and in narrow passages the repulsion from both walls fights the attraction, producing a limit cycle. Fixes include damping the velocity command, smoothing the repulsive potential, widening passages virtually, or adding a rotational or vortex field that biases the robot to circulate around obstacles rather than bounce off them.
What are harmonic potential fields?
Harmonic potential fields solve Laplace's equation, div grad U = 0, over the free space with the goal held at low potential and obstacle boundaries held at high potential. Because a harmonic function obeys the maximum principle, it has no interior local minima, so gradient descent always reaches the goal. The cost is that you must solve a boundary-value problem numerically over the whole workspace, typically by relaxation on a grid, which sacrifices the microsecond, map-free reactivity that made the basic field attractive.