---
title: Control Barrier Function Filters
url: https://www.emergentmind.com/topics/control-barrier-function-cbf-filters
type: topic
---

# Control Barrier Function Filters

A control barrier function (CBF) filter is a real-time control algorithm that enforces system safety by minimally modifying the control input produced by a nominal controller to guarantee that the closed-loop state remains within a safe set defined by barrier functions. CBF filters are central to the modularization of safety in control, enabling complex or learning-based systems to meet safety-critical requirements in a modular, computationally tractable manner. Recent advances generalize the classical (scalar) CBF paradigm through matrix-valued barrier functions and the synthesis of safety filters via semidefinite programming (SDP), enabling the treatment of more general, possibly nonsmooth or Boolean-composite safe sets while guaranteeing continuous, real-time implementable safety filters [2508.11795].

## 1. Matrix Control Barrier Functions: Definitions and Safe Set Classes

Matrix Control Barrier Functions (MCBFs) extend the standard CBF framework from scalar-valued to matrix-valued functions:
- Let $H : \mathbb{R}^n \to \mathbb{S}^p$ be a continuously differentiable mapping from state space to the space of $p \times p$ symmetric matrices.
- The associated semidefinite safe set is defined as
  $$
  \mathcal{C} = \{ x \in \mathbb{R}^n \mid H(x) \succeq 0 \}
  $$
  where $\succeq 0$ denotes positive semidefiniteness.

MCBFs enable the description of a richer class of safe sets:
- Spectrahedral sets and sets defined by linear matrix inequalities (LMIs), notably encompassing connectivity constraints (e.g., weighted Laplacian eigenvalues for multi-agent networks).
- Safe sets defined by Boolean combinations of simpler sets (e.g., disjunctions via the maximum eigenvalue of diagonal $H(x)$).
- Nonsmooth or piecewise-composite sets (e.g., union of polytopes or intersection of complex regions).

For indefinite safe sets, $H(x)$ can be indefinite and $\mathcal{C} = \{x \mid \lambda_p(x) \ge 0\}$, with $\lambda_p(x)$ the largest eigenvalue of $H(x)$.

## 2. MCBF Conditions and Forward Invariance

For dynamics $\dot{x} = F(x)$, define the matrix Lie derivative (applied componentwise):
$$
\left[ L_F H \right]_{ij} (x) = \frac{\partial H_{ij}}{\partial x} \cdot F(x)
$$

The key MCBF invariance condition is:
- **Exponential Matrix Barrier Condition**: If $\exists \, c_\alpha > 0$ such that
$$
L_F H(x) \succeq -c_\alpha H(x) \qquad \forall x \in E \supset \mathcal{C}
$$
then the safe set $\mathcal{C}$ is forward-invariant; i.e., trajectories starting in $\mathcal{C}$ remain in $\mathcal{C}$ for all $t \geq 0$.

For control-affine dynamics $\dot{x} = f(x) + g(x)u$, require that for each $x \in \mathcal{C}$, there exists $u$ such that
$$
L_f H(x) + \sum_{i=1}^m L_{g_i} H(x) u_i \succ -c_\alpha H(x)
$$

For indefinite (OR-type) MCBFs, the barrier condition becomes
$$
L_F H(x) \succeq -\alpha(\lambda_p(x)) I - c_\perp (\lambda_p(x) I - H(x))
$$
with $\alpha$ an extended class–$\mathcal{K}$ function and $c_\perp \geq 0$.

The standard CBF conditions for scalar safe sets are recovered as special cases (when $p = 1$).

## 3. SDP-Based Synthesis of Continuous Safety Filters

At each control interval and state $x$:
- Formulate a convex optimization (semidefinite program, SDP):
  $$
  \begin{aligned}
  &\underset{u \in \mathbb{R}^m}{\text{minimize}} && \|u - k_0(x)\|^2 \\
  &\text{subject to} && L_f H(x) + \sum_{i=1}^m L_{g_i} H(x) u_i \succeq -c_\alpha H(x) \\
  \end{aligned}
  $$
where $k_0(x)$ is the nominal (possibly unsafe) control.

- For generalized barrier conditions (class–$\mathcal{K}$, indefinite), replace $-c_\alpha H(x)$ by the appropriate matrix–function.

- In the case of OR-composed CBFs (e.g., $H(x)=\mathrm{diag}(-h_1(x),\ldots,-h_p(x))$), the SDP constraint enforces that at least one constituent $h_i(x) \geq 0$, corresponding to the semantic disjunction.

Computational complexity is $O(p^3)$ per SDP solve, practical for moderate $p$.

## 4. Continuity and Robustness of the SDP Safety Filter

The MCBF-SDP filter enjoys strong continuity properties:
- The feasible set $U(x)$ in $u$ is convex, lower-semicontinuous, and has nonempty interior due to the strict $\succ$ in the barrier conditions.
- The objective $J(u) = \|u-k_0(x)\|^2$ is strictly convex in $u$ and continuous in $x$.
- By parametric convex optimization theory, the argmin mapping $x \mapsto u^*(x)$ is continuous on a neighborhood of $\mathcal{C}$.

Consequently, the filtered control law is continuous, avoiding chattering or discontinuities even in the presence of eigenvalue crossings or Boolean compositions (unlike standard scalar CBF-QPs, where such transitions may induce nonsmooth behavior).

## 5. Practical Procedure and Algorithm Architecture

The online MCBF safety filter operates as follows:
1. **State Measurement**: Obtain $x_k$ (state estimate at control step $t_k$).
2. **Nominal Control**: Compute $k_0 = k_0(x_k)$.
3. **Barrier Evaluation**: Evaluate $H(x_k)$, $L_f H(x_k)$, and $L_{g_i} H(x_k)$ for all $i$.
4. **SDP Assembly**: Construct the SDP constraint as dictated by the MCBF type (exponential, class–K, or indefinite).
5. **SDP Solve**: Solve (typically via interior-point SDP solvers, e.g., Clarabel or MOSEK), obtaining $u^*$.
6. **Actuation**: Apply $u^*$ until the next update.

For $p \lesssim 10$, solve times are 1–2 ms on modern CPUs, suitable for control frequencies in the hundreds of Hz.

## 6. Applications: Drone Connectivity and Non-Smooth Obstacles

### 6.1 Drone Network Connectivity Maintenance
- **Safety Objective**: Maintain graph connectivity in a multi-UAV network.
- **Barrier Construction**: For a set of $N$ drones, the safe set is defined by the nonnegativity of the second-smallest Laplacian eigenvalue, encoding network connectivity.
- **MCBF Encoding**: $H(x)$ is the modified weighted Laplacian plus perturbation; $\mathcal{C}$ is the set where $H(x) \succeq 0$.
- **Empirical Results**: Both simulation and hardware (Crazyflie quadrotor swarm) confirm that MCBF-SDP centrally enforces continuous, connectivity-preserving controls without eigenvalue-chattering.

### 6.2 Nonsmooth Obstacle Avoidance via OR-CBF SDP
- **Scenario**: Enforce that the state stays outside the union of objects, e.g., keeping outside cylinder and plane constraints.
- **OR-Composition**: $H(x)$ block-diagonalizes scalar functions; enforcement via a single indefinite MCBF-SDP encodes the disjunction exactly.
- **Observations**: The resulting filter yields continuous, minimally relaxing safe controls—unlike soft-max or penalty methods, no relaxation of the true Boolean safe set is incurred.

## 7. Comparative and Broader Implications

MCBF filters unify and generalize many scalar CBF approaches:
- All OR-compositions and Boolean constraint logic are handled natively in the SDP, unlike in QP-based scalar CBFs which typically require soft-min/max relaxations or multi-stage logic.
- Matrix-valued representation conveniently encodes constraints with spectral, graph-theoretic, or multidimensional geometric semantics, such as connectivity or spectrahedral obstacles.
- The continuous dependence on state and control input underpins robust, chattering-free real-time operation, critical for hardware deployment.

In summary, the MCBF-SDP framework establishes a rigorous, computationally viable safety filtering paradigm applicable to a broad range of safety-critical systems with high-dimensional, composite, or nonsmooth safety requirements [2508.11795].

Source: https://www.emergentmind.com/topics/control-barrier-function-cbf-filters