Autonomous systems must navigate a fundamental tension: they need to optimize for performance—such as speed, efficiency, or tracking accuracy—while strictly avoiding unsafe states like collisions, structural damage, or operational bounds. Traditional approaches often bake safety directly into a global planner or a complex trajectory optimization loop. However, re-planning in real-time when unexpected disturbances occur is computationally expensive and often lacks formal guarantees.
Control Barrier Functions (CBFs) offer an elegant alternative by decoupling performance from safety. Instead of forcing the primary controller to constantly worry about safety constraints, we can use a "safety filter." The system runs a nominal controller optimized purely for performance (such as a neural network or a human operator). A safety filter then intercepts the nominal control input and minimally modifies it, but only when the system is on the verge of violating a safety boundary. As reviewed by Xiang Yin 0003 et al. in Formal Synthesis of Controllers for Safety-Critical Autonomous Systems: Developments and Challenges, this approach provides a computationally efficient way to maintain safety in real-time without requiring full state-space discretization.
The Intuition of Forward Invariance
To understand why CBFs work, we must look at the concept of forward invariance. Imagine a safe region of the state space, denoted as a set $\mathcal{C}$. A set is forward invariant if any trajectory starting inside $\mathcal{C}$ remains inside $\mathcal{C}$ for all future time.
Mathematically, we define this safe set using a continuously differentiable scalar function $h(x)$, where:
$$\mathcal{C} = \{x \in \mathbb{R}^n : h(x) \ge 0\}$$
The boundary of the safe set is where $h(x) = 0$. To guarantee that the system never leaves $\mathcal{C}$, the system's dynamics must not push the state across this boundary.
If we had a passive system, Nagumo's theorem tells us that the vector field at the boundary must point parallel to or back into the safe set. For a controlled system $\dot{x} = f(x) + g(x)u$, we have the power to choose the control input $u$ to shape this vector field. A naive requirement would be to demand that $\dot{h}(x) \ge 0$ whenever we are near the boundary. However, this is overly conservative; it prevents the system from ever moving closer to the boundary, even if it is perfectly safe to do so.
The key insight behind CBFs, formalized by Li Wang 0050 et al. in Safety barrier certificates for heterogeneous multi-robot systems, is to relax this condition by allowing $h(x)$ to decrease, provided it does not decrease too fast. We enforce the following inequality:
$$\dot{h}(x) \ge -\alpha(h(x))$$
where $\alpha$ is an extended class-$\mathcal{K}$ function (a strictly increasing function where $\alpha(0)=0$).
Why does this specific formulation work? When the system is deep within the safe set ($h(x)$ is large and positive), $-\alpha(h(x))$ is a large negative number. This means $\dot{h}(x)$ can be highly negative, allowing the system to move rapidly toward the boundary. However, as the system approaches the boundary ($h(x) \to 0$), the term $-\alpha(h(x))$ approaches $0$. This forces $\dot{h}(x) \ge 0$ exactly at the boundary, asymptotically slowing the system down and preventing it from ever escaping. The boundary effectively becomes an impenetrable, yet dynamically soft, cushion.
Real-Time Execution via Quadratic Programs
One of the main reasons CBFs are so widely used in practical robotics is that the safety condition is linear with respect to the control input $u$. By applying the chain rule, we can expand $\dot{h}(x)$:
$$\dot{h}(x) = \frac{\partial h}{\partial x}\dot{x} = \frac{\partial h}{\partial x}f(x) + \frac{\partial h}{\partial x}g(x)u$$
Substituting this into the CBF inequality yields:
$$\underbrace{\frac{\partial h}{\partial x}g(x)}_{L_g h(x)} u \ge -\alpha(h(x)) - \underbrace{\frac{\partial h}{\partial x}f(x)}_{L_f h(x)}$$
This is a linear inequality constraint on $u$. Because the constraint is linear, we can set up a Quadratic Program (QP) to filter a nominal control input $\hat{u}(x)$ in real-time:
$$\begin{aligned} u^* = \arg\min_{u} & \quad \|u - \hat{u}(x)\|^2 \\ \text{s.t.} & \quad L_g h(x) u \ge -\alpha(h(x)) - L_f h(x) \end{aligned}$$
This optimization problem can be solved in microseconds, making it ideal for high-frequency control loops. For instance, Jaemin Lee 0005 et al. in Safety-critical Autonomous Inspection of Distillation Columns using Quadrupedal Robots Equipped with Roller Arms demonstrate how this QP formulation allows quadrupedal robots to enforce geometric boundaries and avoid obstacles in real-time within highly confined industrial environments.
Managing Complex and Non-Convex Boundaries
While a single smooth function $h(x)$ works well for simple geometries (like a circular obstacle), real-world environments are rarely convex or easily parameterized. To capture complex allowable regions, researchers compose multiple barrier functions.
As explored by Michael Schneeberger et al. in SOS Construction of Compatible Control Lyapunov and Barrier Functions, utilizing multiple CBFs allows for a more precise characterization of non-convex safe sets compared to a single, overly conservative function. However, combining multiple constraints can introduce points where the constraints conflict, rendering the QP infeasible.
To address this, Kehan Long et al. in Stabilization of Nonlinear Systems through Control Barrier Functions integrate Boolean logic with nonsmooth barrier functions. This mechanism allows the system to evaluate unions and intersections of safe sets, preventing control failures and maintaining feasibility in complex environments where standard continuous optimization-based controllers typically break down.
The Challenge of Discrete-Time Implementation
While the theoretical foundations of CBFs are rooted in continuous-time differential equations, physical robots operate on digital hardware that samples time discretely. This mismatch introduces a critical vulnerability: a controller might satisfy the safety condition at sample time $t_k$, but the system's natural continuous dynamics could drift outside the safe set before the next sample $t_{k+1}$.
In Practical Considerations for Discrete-Time Implementations of Continuous-Time Control Barrier Function-Based Safety Filters, Lukas Brunke et al. analyze this "blind spot," noting that discrete-time implementations can cause aggressive chattering or safety violations near boundaries where control authority is low. To mitigate this, the authors propose geometric transformations that shift the safe set boundaries away from states where the control input has zero influence, ensuring the system maintains a safety margin between samples.
Alternatively, as shown by Arpan Pallar et al. in Optimal Trajectory Planning for Cooperative Manipulation with Multiple Quadrotors Using Control Barrier Functions, formulating discrete-time control barrier functions directly within a predictive framework creates a proactive safety envelope, adjusting the system's state to avoid obstacles by anticipating collisions before they occur.
Verifying Learning-Based Safety Filters
As autonomous systems increasingly rely on deep learning and reinforcement learning for end-to-end control, CBFs have become vital for wrapping these "black-box" policies in formal safety cocoons. For example, Ryan Kazuo Cosner et al. in End-to-End Imitation Learning with Safety Guarantees using Control Barrier Functions integrate CBFs into imitation learning, ensuring that a policy trained on raw sensor data like images still satisfies the set-invariance condition.
However, if the barrier function itself is parameterized by a neural network (a Neural Control Barrier Function, or NCBF), how can we be sure it is valid? Hongchao Zhang et al. tackle this in Exact Verification of ReLU Neural Control Barrier Functions. By leveraging a generalized version of Nagumo's theorem, the authors provide necessary and sufficient conditions to formally verify ReLU-based NCBFs, even at their non-differentiable boundaries. This decoupling ensures that any control policy respecting the verified barrier's constraints is mathematically guaranteed to remain safe, providing a robust bridge between the flexibility of machine learning and the rigor of control theory.