Skip to main content
$$ \newcommand{\R}{\mathbb{R}} \newcommand{\N}{\mathbb{N}} \newcommand{\Z}{\mathbb{Z}} $$

Lecture 19: control barrier functions

Goal: render a set safe, i.e. forward-invariant.

References

  • Ames, Coogan, Egerstedt, Notomista, Sreenath, Tabuada. Control barrier functions: Theory and applications. European Control Conference (ECC), 2019.

Problem formulation

Definition: for \(\dot{x}=f(x)+g(x) u, x \in \mathbb{R}^{n}\), safety means choosing \(u(x)\) to make safe set \(\subset\R^n\) forward-invariant (and, ideally, asymptotically stable).

Illustration of a safe set in state space that is rendered forward invariant by the right choice of control input.

Solution strategy

Idea: choose \(u(x)\) to “point inward” along boundary \(\partial C\).

Let \(C\) be defined by function \(h: \mathbb{R}^{n} \rightarrow \mathbb{R}\) such that \(C=\{x: h(x) \geq 0\}\), boundary \(\partial C=\{x: h(x)=0\}\).

Definition: an extended class \(K\) function \(\alpha: \mathbb{R} \rightarrow \mathbb{R}\) is strictly increasing and \(\alpha(0)=0\)

Definition: \(h\) is a control barrier function (CBF) if \[ \exists \alpha: \sup _{u}(\underbrace{L_{f} h(x)+L_{g} h(x) u}_{\dot{h}=D h \cdot f+D h \cdot g \cdot u}) \geqslant-\alpha(h(x)) \]

Theorem: if \(h\) is a CBF and \(D h(x) \neq 0\) for \(x \in \partial C\) then any Lipschitz \(u: \mathbb{R}^{n} \rightarrow \mathbb{R}^{m}\) satisfying \[ u(x) \in\{\mu: L_f h(x)+L_g h(x) \mu+\alpha(h(x)) \geq 0\} \] renders \(C\) safe (ie forward-invariant). Furthermore, if \(u\) renders \(C\) safe, then \(h|_{c}\) is a CBF.

Practical implementation

One may ask: how to choose u? There turns out to be a simple answer if we allow orselves to solve a convex optimization problem.

Idea: given nominal policy \(\bar{u}: \mathbb{R}^{n} \rightarrow \mathbb{R}^{m}\), define \(u\) by \[ \begin{aligned} u(x)= & \underset{\mu}{\operatorname{argmin}} \frac{1}{2}\|\mu-\bar{u}(x)\|^{2} \\ & \operatorname{s.t.}\ L_f h(x)+ L_g h(x) \mu \geq \alpha(\ln (x)) \end{aligned} \]

It turns out that this guadratic program has a closed-form solution!

Q: solve this quadratic program (QP).

Rewrite as \(\min _{\mu} \frac{1}{2}\left\|\mu-\mu_{0}\right\|^{2}\) s.t. \(A \mu \geqslant b\).

Augmented cost is \(\widetilde{c}\left(\mu, \lambda\right)=\left\|\mu-\mu_{0}\right\|^{2}+\lambda(A \mu-b)\).

Expanding \(\frac{1}{2}\left(\mu-\mu_{0}\right)^{\top}\left(\mu-\mu_{0}\right)=\frac{1}{2} \mu^{\top} \mu-\mu_{0}^{\top} \mu+\frac{1}{2} \mu_{0}^{\top} \mu_{0}\) enables us to compute derivatives of \(\widetilde{c}\):

\(D_{\mu} \widetilde{c}=\mu^{\top}-\mu_{0}^{\top}+\lambda A=0 \iff \mu=A^{\top} \lambda^{\top}+\mu_{0}\),

\(D_{\lambda} \widetilde{c} = A \mu-b=0 \iff A A^{\top} \lambda^{\top}+A \mu_{0}-b=0 \iff \lambda^{\top}=\left(A A^{\top}\right)^{-1}\left(b-A \mu_{0}\right)\).

The solution is the Lipschitz continuous control law \[ \mu^{*}=\left\{\begin{array}{cc} A^{\top}\left(A A^{\top}\right)^{-1}\left(b-A x_{0}\right)+\mu_{0}, & A \mu^{*}=b \\ \mu_{0}, & \text { else } \end{array}\right. \]

Takeaway: CBF framework provides an optimization-based approach to safety for nonlinear control systems.