CBF vs potential fields for robot obstacle avoidance
Both make a robot steer away from obstacles, and both fit in a few lines of code. They answer different questions: a potential field says where the robot would like to go, while a control barrier function says where it is allowed to go.
Potential fields in one paragraph
The artificial potential field method, introduced by Oussama Khatib in 1986, treats the robot as a particle in a force field. The goal attracts it; obstacles repel it. The commanded velocity is the negative gradient of the total potential:
A typical repulsive term is zero beyond an influence distance d₀ and grows without bound as the robot approaches the obstacle surface. The method is attractive for the same reasons it is still taught everywhere: it is intuitive, cheap to compute and reactive to new obstacles.
Control barrier functions in one paragraph
A CBF approach starts from a controller you already have, any controller, and adds a safety filter. You define a function h(x) whose zero-superlevel set is the safe set, and at each step you choose the command closest to the nominal one that satisfies ḣ ≥ −α·h. This is a small quadratic program. If it is feasible at every step, the robot never leaves the safe set. The full derivation for a mobile robot is here.
The differences that matter in practice
| Potential field | CBF safety filter | |
|---|---|---|
| What it is | A complete controller: attraction and repulsion summed | A filter on top of any nominal controller |
| Safety guarantee | None in general: attraction and the other repulsive terms can outweigh one obstacle's repulsion | Forward invariance of h ≥ 0, provided the QP stays feasible and the model is right |
| Changes nominal behaviour | Whenever the robot is inside an influence radius, even when it is not in danger | Only when the nominal command would violate the CBF condition |
| Local minima and deadlocks | Well known: forces cancel in front of obstacles and in U-shaped layouts | Also possible: the QP can create undesired equilibria. Safety is guaranteed, progress is not |
| Narrow passages | Repulsion from both sides can close gaps and cause oscillation | Passes any gap the constraints allow; behaviour set by α |
| Input limits | Handled by clipping afterwards | Can be written into the QP as constraints |
| Tuning | Gains and influence distances interact; hard to reason about | One rate α per constraint with a clear meaning |
| Computation | A gradient evaluation | A small QP per step (closed form for one constraint) |
Why "no guarantee" is not a technicality
With a potential field, safety depends on a balance of forces. Increase the attractive gain to reach the goal faster, add a second obstacle whose repulsion pushes the same way as the attraction, or let the robot arrive at high speed, and it can reach the obstacle. The designer has to find gains that work for the layouts they tested and hope the next layout behaves.
A CBF inverts that logic. The constraint ḣ ≥ −α·h is enforced at every step no matter what the nominal controller asks for, so a faster or more aggressive nominal controller changes how often the filter acts, not whether the robot stays safe. That separation is why CBF filters show up in safety-critical work on legged robots, drones and automated driving, and why they are a natural way to add safety to learned controllers.
Where potential fields still make sense
Potential fields are a reasonable way to generate a nominal behaviour: smooth goal attraction with gentle avoidance. The two ideas combine well, with a potential field or any planner proposing a command and a CBF filter guaranteeing that the command is safe. CBF-QPs also share the local-minimum problem: Reis, Aguiar and Tabuada showed in 2021 that CBF-based QPs can introduce undesirable asymptotically stable equilibria. In practice, deadlocks are handled by the planner or nominal controller, not by the filter.
See the difference in a simulator. In the free lab you watch the unfiltered controller crash, then write a CBF filter that keeps the same controller safe across 20 random layouts.
Try the CBF labSummary
- Use a potential field when you need a simple reactive behaviour and safety is handled elsewhere.
- Use a CBF filter when you need to state, and check, that the robot stays in a safe set, whatever the nominal controller does.
- Use both when you want smooth nominal behaviour and a guarantee on top.
References: O. Khatib, "Real-time obstacle avoidance for manipulators and mobile robots", International Journal of Robotics Research, 1986. A. D. Ames et al., "Control Barrier Function Based Quadratic Programs for Safety Critical Systems", IEEE Transactions on Automatic Control, 2017. M. F. Reis, A. P. Aguiar, P. Tabuada, "Control barrier function-based quadratic programs introduce undesirable asymptotically stable equilibria", IEEE Control Systems Letters, 2021.
Get notified when new robotics labs are released.
One email per new lab.