wikillm

Concept · 2 papers · updated 2026-10-25

Control barrier function (CBF)

A barrier function defines a safe set as a superlevel set, and a controller keeps the state inside it. Backup CBF builds the safe set from a backup policy and filters the nominal input with a quadratic program. Learned CBFs in a differentiable QP layer, as in LiveNet, predict the barrier penalties with a network. Two sources, both with simulation results only.

safetycontrolsafety-filterdifferentiable-qp

Markdown7 min read

AI-compiled overview, updated 2026-10-25, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

Overview

A control barrier function (CBF) is a scalar function h whose superlevel set is a safe set. The safe set C is the superlevel set of h^C, and the terminal set S_0 ⊆ C is the superlevel set of h^S 2604.02401 §II-A eq. 2 eq. 3. The goal is to keep the state in C for all time, starting from states in a set D ⊆ C, even when the nominal controller does not guarantee this 2604.02401 §II-B.

The two cards use the term in different ways. The Backup-Based Safety Filters review builds the barrier from a backup policy and uses it inside a safety filter. The LiveNet paper writes barrier constraints for collisions and deadlocks into a QP layer on top of a neural controller, and a network predicts the penalty terms in those constraints 2412.04659 §4.

Variants

Backup CBF

The safe set is not written down by hand. It is the recoverable set of a backup policy π_b over the horizon [0, T_B]: states that stay in C on the whole interval and end in S_0 at time T_B 2604.02401 §III eq. 6. The paper cites a result from the literature. If S_0 is forward invariant under the backup, this implicit set is controlled invariant and lies between S_0 and C 2604.02401 §III-A. The backup policy must therefore keep S_0 invariant and recover a neighbourhood of S_0 within T_B 2604.02401 §II-A. Card: Backup-Based Safety Filters.

The filter does not run the backup. At each step it solves a quadratic program that changes the nominal input as little as possible, subject to barrier constraints on the backup trajectory for all times in [t, t+T_B], and on the terminal set 2604.02401 §III eq. 10a eq. 10b eq. 10c. The path constraints are a continuum, which the paper approximates with finitely many collocation points 2604.02401 §III-B. The class-K gain α is not specified in the paper 2604.02401 §III-B.

Learned collision and liveness CBFs in a QP layer

LiveNet trains one network per robot. The network outputs a reference control u_ref and two sets of penalty terms, one for the collision barrier and one for the liveness barrier. A QP layer then returns the control closest to u_ref that satisfies the barrier rows 2412.04659 §4. Card: LiveNet.

  • Collision barrier. For each other robot or static obstacle, the barrier is the squared distance minus the squared sum of radii. The inequality is second order in the control and contains two penalty terms 2412.04659 §4.1. The derivative of the penalty is set to zero 2412.04659 §4.1.
  • Liveness barrier. It is added only when the two heading rays cross. It compares the times at which each robot's critical point reaches the crossing point. The robot that goes second is held back. The path is fixed, so only speed enters the constraint 2412.04659 §4.2.
  • Guarantee. The paper's Theorem 1 gives liveness under the stated conditions, which include the penalty functions having the required relative degree 2412.04659 §4.2. The conclusion says the guarantee needs enough training data for the penalties to be learned 2412.04659 §6.
  • Training. Supervised learning on controls of a receding-horizon MPC that uses the same barrier functions 2412.04659 §5.1.
  • Reported results. In simulation with two robots, 0 collisions and 0 deadlocks in 50 runs per scenario for the doorway and the intersection. The SMG-CBF baseline also had 0 collisions and 0 deadlocks [arxiv:2412.04659 tab. 2]. The paper reports 10 to 20 times lower compute time per step than the specially designed optimisation baseline 2412.04659 §1. In 28 perturbed doorway scenarios, LiveNet solved 25 and SMG-CBF solved 16 2412.04659 §5.2.

Implementation notes from the released code, which differs from the paper in the places below:

  • QP objective sign. The paper writes the layer as maximising (u − u_ref)² 2412.04659 §4. The code minimises 0.5 |u|² + u_refᵀu, so its unconstrained optimum is −u_ref model.py model.py.
  • Liveness critical points. The code builds the direction vector from swapped components, which places the critical points off the line between the robots. Use the paper's direction model.py 2412.04659 §4.2.
  • Solver failure. The paper does not say what happens if the QP cannot be solved. The code returns −u_ref, which breaks the guarantee model.py.
  • Other robots' velocity. The paper does not say how it is observed. The simulator estimates it by finite differences of position 2412.04659 §4 environment.py. A real robot must estimate it another way.
  • Penalty bounds. The code bounds each penalty to (0, 4) through a sigmoid. The paper does not state a bound model.py.

Other backup-based safety filters (not CBFs)

The same review compares Backup CBF with two other backup-based filters in one framework. Model Predictive Shielding (MPS) tests a single switch time, T_S = Δt, and accepts or rejects the nominal input as a whole [arxiv:2604.02401 §IV] eq. 12 eq. 13. Gatekeeper searches for the largest valid switch time in [0, T_H] and keeps the nominal input while that time is positive 2604.02401 §V eq. 15 eq. 16. The safety-filter concept page is not written yet. The review proves that MPS is a special case of gatekeeper when Δt ≤ T_H 2604.02401 §VI-A eq. 19.

When to use which

Both sources report simulation results only. Their scenarios and metrics differ, so their numbers should not be compared with each other.

SituationUseWhy
You want a QP-based filter that changes the nominal input as little as possible, and you have a backup policyBackup CBFIt solves a QP with barrier constraints on the backup path 2604.02401 §III.
You want the nominal controller to run as long as safety allows, and can search a switch timeGatekeeper, not Backup CBFIn the reach-avoid scenario it kept the nominal controller on 87.5% of steps, against 28.8% for Backup CBF 2604.02401 tab. 2.
You need a low per-step cost and accept a coarser filterMPS or a parallel gatekeeperAverage time was 2.64 ms (MPS) and 2.97 ms (parallel gatekeeper) for highway overtake, against 27.90 ms for Backup CBF 2604.02401 tab. 2.
The backup cannot reach S_0 within T_B from the states you care aboutNot statedThe paper gives no rule for this case. Validity depends on the backup and the model 2604.02401 §VI-C.
Several robots must pass each other in a narrow space, and you can produce expert MPC controls for trainingLearned collision and liveness CBFsThe paper reports no collisions or deadlocks in its simulated doorway and intersection runs, with compute far below the optimisation baseline 2412.04659 tab. 2 §1.
Path deviation is the metric that matters mostCheck the baseline firstIn the doorway, SMG-CBF changed the path less than LiveNet (0.001 m against 0.008 m). LiveNet changed speed less (0.002 m/s against 0.009 m/s) 2412.04659 tab. 2.
Hardware deployment with more than two robotsNot statedThe paper tests two robots in simulation only and defers real deployment 2412.04659 §6.

The review says that Backup CBF and MPS both judge safety through the backup maneuver. This can make them give up the nominal controller when it would be safe. The paper calls this a shared weakness of the backup-based approach 2604.02401 §V-A §VI-C.

Implementation sketch

Language-agnostic outlines of two CBF steps. Exact constraint forms are in the cited equations and sections; check them there before coding. The class-K gains of the Backup CBF are a free choice, not stated by the paper.

Pseudocode
# Backup CBF step  [arxiv:2604.02401 §III] [eq. 10a-c]
# Input:  state (x); nominal input (u_nom); backup policy (pi_b)
#         horizon (T_B); collocation times; barrier functions (h^C, h^S)
# Output: filtered input

def backup_cbf_input(x, u_nom, pi_b, T_B, times):
    # Solve for the input closest to the nominal one  [eq. 10a]
    u = qp_solve(objective=distance_to(u_nom))
    # Barrier constraints on the backup path at each collocation time  [§III-B]
    for tau in times:
        add_constraint(barrier_on_backup_path(x, u, pi_b, tau))
    # Terminal barrier constraint at the end of the backup  [eq. 10c]
    add_constraint(terminal_barrier(x, u, pi_b, T_B))
    return u
Pseudocode
# Learned-penalty CBF step for one robot  [arxiv:2412.04659 §4]
# Input:  own state (ego); observed other robots (others); trained net (F)
# Output: control u = (omega, a)

def learned_cbf_step(ego, others, F):
    # Network outputs a reference control and two penalty sets  [§4]
    u_ref, p_collision, p_liveness = F(ego, others)
    rows = []
    # Second-order collision barrier per other robot or obstacle  [§4.1]
    for other in others:
        rows.append(collision_cbf_row(ego, other, p_collision))
    # First-order liveness barrier only where the heading rays cross  [§4.2]
    for other in others:
        row = liveness_cbf_row(ego, other, p_liveness)
        if row is not None:
            rows.append(row)
    # Control closest to u_ref that satisfies all barrier rows  [§4]
    return qp_solve(u_ref, rows)

Contradictions

  • Lie derivative sign. The paper writes the second Lie derivative of the collision barrier with cos(θ^i + θ^j) 2412.04659 §4.1 [code: model.py#L129]. A hand derivation from the drift alone gives cos(θ^i − θ^j). This was not checked numerically, and the paper does not settle it. Check the sign before implementing 2412.04659 §4.1.
  • Headline versus table. The paper's ratio of invasiveness reduction holds only in the doorway. In the intersection, the two methods' speed changes are 0.011 m/s (LiveNet) and 0.012 m/s (SMG-CBF) 2412.04659 tab. 2.
  • Between the two papers. No direct disagreement. The review and LiveNet test different scenarios, so the claims are not comparable.

Papers

Source and license

Compiled from the papers listed on this page, all published under CC BY, CC BY-SA or CC0, with citations. See each paper's page for its authors and license.