Control Barrier Function Safety Filter: Obstacle QP and Forward Invariance

A rover shuttles between two flags around three pylons; rings are the barrier boundaries, the red arrow is the nominal command, the green arrow the filtered one. Drag to orbit.

Switch to 2D
Controls

Presets

Parameters

Quality

Camera

Model checks

The science

Idea. A control barrier function (CBF) turns "never touch an obstacle" into one linear inequality on the velocity command. For a point robot p' = u and a disc obstacle with centre c and effective radius R (obstacle plus robot), the barrier is h(p) = |p - c|2 - R2; h >= 0 is the safe set. The filter keeps dh/dt = a.u >= -alpha h with a = 2(p - c) (Ames et al. 2017, the standard CBF condition with the linear class-K function alpha h).

The QP. The safety filter edits the nominal command as little as possible: u* = argmin |u - unom|2 subject to the barrier inequality of every obstacle. With one active constraint the answer is closed form, u* = unom + max(0, -(a.unom + alpha h)/|a|2) a, a projection onto a half-plane. With several obstacles this page solves the 2D QP exactly by enumerating the projection onto each line and each pairwise intersection and keeping the cheapest feasible candidate. Because u = 0 always satisfies the condition while h >= 0, the QP is never infeasible inside the safe set.

Forward invariance. The condition gives h' >= -alpha h, hence h(t) >= h(0) e-alpha t >= 0: a robot that starts safe stays safe. The checks verify this on the Euler discretisation, where hk+1 = hk + a.u dt + |u|2 dt2 >= (1 - alpha dt) hk exactly. A larger alpha lets the robot get closer before the filter reacts (less conservative, sharper turns); a small alpha brakes early.

Simplifications and known limits. Single-integrator kinematics (velocity is commanded directly; real robots need a higher-relative-degree CBF, inertia and actuator limits), perfect position knowledge, circular static obstacles, no noise or delay. The filter is local: when the goal lies exactly behind an obstacle the robot slides onto the barrier where unom is anti-parallel to a and stops, a well-known CBF deadlock (the verdict readout reports it). The arena layout, gains and radii are illustrative, not taken from a particular robot.

Loading model...
Loading Blender model...
-
-
Made with 🟠 Blender · Three.js