【论文笔记】基于Control Barrier Function的二次规划(QP)控制

写在前面

原论文:Control Barrier Function Based Quadratic Programs for Safety Critical Systems.

本文为近期阅读的论文(Ames 2017)[1]的笔记。该论文介绍了两种barrier function,即reciprocal barrier function (RBF)和zeroing barrier function (ZBF),目的是将它们扩展为control barrier function (CBF),并以二次规划(QP)形式与control Lyapunov function (CLF)结合起来,实现带有约束的控制器。

针对给定集合C\mathcal C,如果B(x)B(x)在集合边界处无界,即B(x)→∞B(x)\to \infty as x→∂Cx\to\partial \mathcal C,则称函数BB为RBF;如果h(x)h(x)在集合边界处为0,即h(x)→0h(x)\to 0 as x→∂Cx\to\partial \mathcal C,则称函数hh为ZBF。以上任意一种情况的BB或hh满足Lyapunov-like条件,则可以保证∂C\partial \mathcal C的不变性(forward invariance)。

问题描述

考虑非线性系统

x˙=f(x)(1)\dot x=f(x)\qquad(1)

其中x∈Rnx\in\mathbb R^n,假设ff是locally Lipschitz。集合C\mathcal C对于(1)不变(forward invariant),如果对每一个x0∈Cx_0\in\mathcal C,都有x(t)∈Cx(t)\in\mathcal C,∀t∈[0,∞)\forall t\in[0,\infty)。

RBF

问题1:给定闭集C:={x∈Rn∣h(x)≥0}\mathcal C:=\{x\in\mathbb R^n|h(x)\geq 0 \},确定函数B:int⁡(C)→RB:\operatorname{int}(\mathcal C)\to \mathbb R并构建CBF使得int⁡(C)\operatorname{int}(\mathcal C)不变,其中h:Rn→Rh:\mathbb R^n\to\mathbb R是连续可微函数。同时假设C\mathcal C非空没有孤立点(isolated point),即int⁡(C)≠∅\operatorname{int}(\mathcal C)\neq \emptyset,int⁡(C)‾=C\overline{\operatorname{int}(\mathcal C)}=\mathcal C。

1. Logarithmic

选取logarithmic barrier function candidate

B(x)=−log⁡(h(x)1+h(x))(2)B(x)=-\log\left(\frac{h(x)}{1+h(x)} \right)\qquad (2)

满足inf⁡x∈int⁡(C)B(x)≥0\inf_{x\in\operatorname{int}(\mathcal C)}B(x)\geq 0,lim⁡x→∂CB(x)=∞\lim_{x\to\partial\mathcal C}B(x)=\infty。

设计条件

B˙≤γB,(3)\dot B\leq \frac{\gamma}{B},\qquad (3)

使得BB在远离边界时可以增大,越接近边界增大速率越接近于0。

证明:对(2)求导代入条件中,得到h˙≥γ(h+h2)log⁡(h1+h)\dot h\geq \frac{\gamma(h+h^2)}{\log(\frac{h}{1+h})},由比较引理(Comparison Lemma)得到,如果x0∈int⁡(C)x_0\in\operatorname{int}(\mathcal C),那么∀t≥0\forall t\geq 0,有

h(x(t,x0))≥1exp⁡(2γt+log⁡2(h(x0)+1h(x0)))−1>0h(x(t,x_0))\geq \frac{1}{\exp\left(\sqrt{2\gamma t+\log^2\left(\frac{h(x_0)+1}{h(x_0)}\right)}\right)-1}>0

成立,即x(t,x0)∈int⁡(C)x(t,x_0)\in\operatorname{int}(\mathcal C),∀t≥0\forall t\geq 0。该函数下界收敛于0。

2. Inverse-type

选取inverse-type barrier candidate

B(x)=1h(x)。B(x)=\frac{1}{h(x)}。

同理,有h(x(t,x0))≥12γt+1h2(x0)>0h(x(t,x_0))\geq \frac{1}{\sqrt{2\gamma t+\frac{1}{h^2(x_0)}}}>0。该函数下界始终大于0。

3. Reciprocal

定义1:对动态系统(1),一个连续可微函数B:int⁡(C)→RB: \operatorname{int}(\mathcal C)\to \mathbb R是集合C\mathcal C的RBF,如果存在K\mathcal K类函数α1\alpha_1、α2\alpha_2、α3\alpha_3使得,∀x∈int⁡(C)\forall x\in\operatorname{int}(\mathcal C),

1α1(h(x))≤B(x)≤1α2(h(x)),LfB(x)≤α3(h(x))。\begin{aligned} \frac{1}{\alpha_1(h(x))}\leq B(x)&\leq \frac{1}{\alpha_2(h(x))},\\ L_f B(x)&\leq \alpha_3(h(x))。 \end{aligned}

定理1:给定动态系统(1)和由连续可微函数hh定义的集合C\mathcal C,如果存在BB是一个RBF,那么int⁡(C)\operatorname{int}(\mathcal C)对于(1)是不变的。

ZBF

定义2:对于a,b>0a,b>0,连续函数α:(−b,a)→(−∞,∞)\alpha:(-b,a)\to (-\infty,\infty)被认为属于扩展K\mathcal K类函数,如果它严格单调增且α(0)=0\alpha(0)=0。

扩展K\mathcal K类函数和K\mathcal K类函数区别在于,定义域和值域可以取负数,如果令b=0b=0,值域为[0,∞)[0,\infty),那么扩展K\mathcal K类函数即K\mathcal K类函数。

定义3:对动态系统(1),一个连续可微函数h:Rn→Rh:\mathbb R^n\to \mathbb R是集合C\mathcal C的ZBF,如果存在扩展K\mathcal K类函数α\alpha和集合D\mathcal D(C⊆D⊂Rn\mathcal C\subseteq \mathcal D\subset \mathbb R^n)使得,∀x∈D\forall x\in\mathcal D,

Lfh(x)≥−α(h(x))。L_fh(x)\geq -\alpha(h(x))。

注意:将hh定义在一个比C\mathcal C大的集合D\mathcal D上可以考虑模型扰动的影响。

命题1:给定动态系统(1)和由连续可微函数hh定义的集合C\mathcal C,如果hh是一个定义在D\mathcal D上的ZBF,那么int⁡(C)\operatorname{int}(\mathcal C)对于(1)是不变的。

证明:对任意x∈∂Cx\in\partial \mathcal C,h˙(x)≥−α(h(x))=0\dot h(x)\geq -\alpha(h(x))=0。由Nagumo定理知,集合C\mathcal C是不变的。

Nagumo定理[2]:考虑系统x˙=f(x)\dot x=f(x),假设对每个集合D\mathcal D中的初始值,系统都有一个全局唯一解。令C⊆D\mathcal C\subseteq \mathcal D是闭凸集。那么集合C\mathcal C对系统是不变的,当且仅当f(x)∈TC(x)f(x)\in T_{\mathcal C}(x)(切锥),∀x∈C\forall x\in\mathcal C。

因为当x∈int⁡Cx\in\operatorname{int} \mathcal C,TC=RnT_{\mathcal C}=\mathbb R^n,所以只用关心x∈∂Cx\in\partial \mathcal C的情况。由于h(x)h(x)处处光滑,故切锥为半平面。当x∈∂Cx\in\partial \mathcal C,Lfh(x)=∇hT(x)f(x)≥0L_fh(x)=\nabla h^T(x)f(x)\geq 0,即f(x)f(x)和梯度夹角小于π2\frac{\pi}{2},所以f(x)∈TC(x)f(x)\in T_{\mathcal C}(x),如下图所示。

Nagumo定理对非凸集合也成立,但是唯一解要求必须满足。

命题2:令h:D→Rh:\mathcal D\to \mathbb R为定义在开集D⊆Rn\mathcal D\subseteq \mathbb R^n上的连续可微函数。如果hh是系统(1)的ZBF,那么由hh定义的集合C\mathcal C渐进稳定。

命题2告诉我们,即使初始位置在集合C\mathcal C之外,也有xx渐进收敛于C\mathcal C。

两者的联系

命题3:给定动态系统(1)和由连续可微函数hh定义的集合C\mathcal C。如果C\mathcal C是不变的,那么h∣Ch|_{\mathcal C}是C\mathcal C上定义的ZBF。

命题1和3共同证明,集合C\mathcal C是不变的,当且仅当存在一个ZBF。同样的对RBF,也能证明必要性,见原论文的定理2,这里不再详述。

RBF、ZBF和集合不变性的联系如下图所示。

CBF构建

类似于利用Lyapunov函数构建CLF的方法,我们也可以利用RBF和ZBF构建CBF。

RCBF

考虑仿射控制系统

x˙=f(x)+g(x)u,(4)\dot x=f(x)+g(x)u,\qquad (4)

其中ff和gg局部Lipschitz,x∈Rnx\in\mathbb R^n,u∈U⊂Rmu\in U\subset\mathbb R^m。

定义4:对系统(4)和由连续可微函数hh定义的集合C\mathcal C,一个连续可微函数B:int⁡(C)→RB: \operatorname{int}(\mathcal C)\to \mathbb R是RCBF,如果存在K\mathcal K类函数α1\alpha_1、α2\alpha_2、α3\alpha_3使得,∀x∈int⁡(C)\forall x\in\operatorname{int}(\mathcal C),

1α1(h(x))≤B(x)≤1α2(h(x)),inf⁡u∈U[LfB(x)+LgB(x)u−α3(h(x))]≤0。\begin{aligned} \frac{1}{\alpha_1(h(x))}\leq B(x)&\leq \frac{1}{\alpha_2(h(x))},\\ \inf_{u\in U}[L_f B(x)+L_g B(x)u&-\alpha_3(h(x))]\leq0 。 \end{aligned}

RCBF BB局部Lipschitz连续,如果α3\alpha_3和∂B∂x\frac{\partial B}{\partial x}都局部Lipschitz连续。

给定RCBF BB,∀x∈int⁡(C)\forall x\in \operatorname{int}(\mathcal C),定义集合

Krcbf⁡(x)={u∈U∣LfB(x)+LgB(x)u−α3(h(x))≤0}。K_{\operatorname{rcbf}}(x)=\{u\in U|L_fB(x)+L_g B(x)u-\alpha_3(h(x))\leq 0 \}。

推论1:考虑集合C\mathcal C,令BB是系统(4)的RCBF。那么任意局部Lipschitz连续的控制器u:int⁡(C)→Uu:\operatorname{int}(\mathcal C)\to U使得u(x)∈Krcbf⁡(x)u(x)\in K_{\operatorname{rcbf}}(x)都能保证集合int⁡(C)\operatorname{int}(\mathcal C)的不变性。

ZCBF

定义5:对系统(4)和由连续可微函数h:Rn→Rh:\mathbb R^n\to \mathbb R定义的集合C\mathcal C,hh是定义在集合D\mathcal D上(C⊆D⊂Rn\mathcal C\subseteq \mathcal D\subset \mathbb R^n)的ZCBF,如果存在扩展K\mathcal K类函数α\alpha使得,

sup⁡u∈U[Lfh(x)+Lgh(x)u+α(h(x))]≥0。\sup_{u\in U}[L_f h(x)+L_g h(x)u+\alpha(h(x))]\geq 0 。

ZCBF hh局部Lipschitz连续,如果α\alpha和∂h∂x\frac{\partial h}{\partial x}都局部Lipschitz连续。

给定ZCBF hh,∀x∈D\forall x\in \mathcal D,定义集合

Kzcbf⁡(x)={u∈U∣Lfh(x)+Lgh(x)u+α(h(x))≥0}。K_{\operatorname{zcbf}}(x)=\{u\in U|L_f h(x)+L_g h(x)u+\alpha(h(x))\geq 0 \}。

推论2:考虑集合C\mathcal C,令hh是集合D\mathcal D上的ZCBF。那么任意局部Lipschitz连续的控制器u:D→Uu:\mathcal D\to U使得u(x)∈Kzcbf⁡(x)u(x)\in K_{\operatorname{zcbf}}(x)都能保证集合C\mathcal C的不变性。

QP设计

用QP来协调控制效果和安全约束。考虑仿射控制系统

[x˙1x˙2]=[f1(x1,x2)f2(x1,x2)]+[g1(x1,x2)0]u。\begin{bmatrix} \dot x_1\\ \dot x_2 \end{bmatrix}=\begin{bmatrix} f_1(x_1,x_2)\\ f_2(x_1,x_2) \end{bmatrix}+\begin{bmatrix} g_1(x_1,x_2)\\ 0 \end{bmatrix}u。

其中x1∈Xx_1\in X是可控状态(或输出),x2∈Zx_2\in Z是不可控状态。

ES-CLF

定义6:连续可微函数V:X×Z→RV:X\times Z\to \mathbb R是ES-CLF(exponetial stabilizing control Lyapunov function),如果存在正常数c1,c2,c3>0c_1,c_2,c_3> 0使得∀x=(x1,x2)∈X×Z\forall x=(x_1,x_2)\in X\times Z,下列不等式成立,

c1∥x1∥2≤V(x)≤c2∥x1∥2,inf⁡u∈U[LfV(x)+LgV(x)u+c3V(x)]≤0。c_1\|x_1\|^2\leq V(x)\leq c_2\|x_1\|^2,\\ \operatorname{inf}_{u\in U}[L_f V(x)+L_g V(x)u+c_3V(x)]\leq 0。

定义集合

Kclf⁡(x)={u∈U∣LfV(x)+LgV(x)u+c3V(x)≤0}。K_{\operatorname{clf}}(x)=\{u\in U|L_f V(x)+L_g V(x)u+c_3 V(x)\leq 0 \}。

局部Lipschitz控制器u:X×Z→Uu:X\times Z\to U满足

u(x)∈Kclf⁡(x)⇒∥x1(t)∥≤c2c1e−c32t∥x1(0)∥。u(x)\in K_{\operatorname{clf}}(x) \Rightarrow \|x_1(t)\|\leq \sqrt{\frac{c_2}{c_1}}e^{-\frac{c_3}{2}t}\|x_1(0)\|。

CLF-CBF QP

对于RCBF,考虑如下形式的QP问题

u∗(x)=arg⁡min⁡u=(u,δ)∈Rm×R12uTH(x)u+F(x)Tus.t.⁡LfV(x)+LgV(x)u+c3V(x)−δ≤0LfB(x)+LgB(x)u−α(h(x))≤0\begin{aligned} \boldsymbol u^*(x)&= {\arg\min}_{\boldsymbol{u}=(u,\delta)\in\mathbb R^m\times \mathbb R} \frac{1}{2}\boldsymbol u^TH(x)\boldsymbol u+F(x)^T\boldsymbol u\\ \operatorname{s.t.} &\quad \begin{aligned}L_fV(x)+L_gV(x)u+c_3 V(x)-\delta&\leq 0\\ L_f B(x)+L_g B(x)u-\alpha(h(x))&\leq 0 \end{aligned} \end{aligned}

其中,c3>0c_3>0是常数,α\alpha是K\mathcal K类函数,H(x)∈R(m+1)×(m+1)H(x)\in \mathbb R^{(m+1)\times(m+1)}正定,F(x)∈Rm+1F(x)\in\mathbb R^{m+1}。

下述定理提供u∗(x)\boldsymbol u^*(x)局部Lipschitz连续的充分条件,保证控制器的局部存在性和解的唯一性这些前提条件,从而推论1、2得以应用。

定理3:假设f,g,B,V,H,Ff,g,B,V,H,F都局部Lipschitz连续。再假设相对度为1,即LgB(x)≠0L_g B(x)\neq 0,∀x∈int⁡(C)\forall x\in\operatorname{int}(\mathcal C)。那么CLF-CBF QP的解u∗(x)\boldsymbol u^*(x)在int⁡(C)\operatorname{int}(\mathcal C)上局部Lipschitz连续。另外,u∗(x)\boldsymbol u^*(x)可以写成一个闭环解析式。

证明:令v=u+H−1F\boldsymbol v=\boldsymbol u+H^{-1}F,⟨v,v⟩=vTHv\langle \boldsymbol v,\boldsymbol v\rangle=\boldsymbol v^TH\boldsymbol v,

A=[a1,a2]=[LgVLgB−10],b=[−LfV−c3V−LfB+α(h)]+ATH−1F。A =[a_1,a_2]= \begin{bmatrix} L_g V&L_g B\\ -1&0 \end{bmatrix},b=\begin{bmatrix} -L_f V-c_3 V\\ -L_f B+\alpha(h) \end{bmatrix}+A^TH^{-1}F。

原QP问题重写为

v∗=arg⁡min⁡12⟨v,v⟩s.t.⁡ATv≤b\begin{aligned} \boldsymbol v^*=&\arg\min \frac{1}{2}\langle \boldsymbol v,\boldsymbol v \rangle\\ \operatorname{s.t.}&\quad A^T\boldsymbol v\leq b \end{aligned}

因为代价函数是凸的且不等式为线性,所以KKT条件是充要条件。令G=ATH−1A=[a1TH−1a1a1TH−1a2a2TH−1a1a2TH−1a2]G=A^TH^{-1}A=\begin{bmatrix}a_1^TH^{-1}a_1&a_1^TH^{-1}a_2\\ a_2^TH^{-1}a_1& a_2^TH^{-1}a_2\end{bmatrix}是Gram矩阵,由于a1a_1、a2a_2线性无关,GG是正定的。由KKT条件可知,该问题的唯一解是v∗=H−1Aλ\boldsymbol v^*=H^{-1}A\lambda,其中λ∈R2\lambda\in\mathbb R^2,且满足

{0≥λ,0≥ATH−1Aλ−b=Gλ−b,0=λT(ATH−1Aλ−b)=λT(Gλ−b)。\left\{ \begin{aligned} 0&\geq\lambda,\\ 0&\geq A^TH^{-1}A\lambda-b=G\lambda-b,\\ 0&=\lambda^T(A^TH^{-1}A\lambda-b)=\lambda^T(G\lambda-b)。 \end{aligned} \right.

可知,若[Gλ−b]i<0[G\lambda-b]_i<0,则λi=0\lambda_i=0。(Gλ−bG\lambda-b和λ\lambda不可能同时小于0,相互垂直的向量肯定在不同象限或者坐标轴。) 又因为GG正定,G11>0G_{11}>0,且G11G22−G12G21>0G_{11}G_{22}-G_{12}G_{21}>0。由schur complement condition,G22>0G_{22}>0。

分类讨论:

  • [Gλ−b]1<0[G\lambda-b]_1<0,[Gλ−b]2=0[G\lambda-b]_2=0

  • [Gλ−b]1=0[G\lambda-b]_1=0,[Gλ−b]2<0[G\lambda-b]_2<0

  • [Gλ−b]1<0[G\lambda-b]_1<0,[Gλ−b]2<0[G\lambda-b]_2<0

  • [Gλ−b]1=0[G\lambda-b]_1=0,[Gλ−b]2=0[G\lambda-b]_2=0

情况1:将λ1=0\lambda_1=0代入[Gλ−b]2=0[G\lambda-b]_2=0,解出λ2=b2/G22≤0\lambda_2=b_2/G_{22}\leq 0。再将λ1=0\lambda_1=0代入[Gλ−b]1=0[G\lambda-b]_1=0,得到G12b2−G22b1<0G_{12}b_2-G_{22}b_1<0。即,当G12b2−G22b1<0G_{12}b_2-G_{22}b_1<0,b2≤0b_2\leq 0时,λ=[0b2/G22]\lambda=\begin{bmatrix}0\\b_2/G_{22} \end{bmatrix};

情况2:将λ2=0\lambda_2=0代入[Gλ−b]1=0[G\lambda-b]_1=0,解出λ1=b1/G11≤0\lambda_1=b_1/G_{11}\leq 0。再将λ2=0\lambda_2=0代入[Gλ−b]2=0[G\lambda-b]_2=0,得到G21b1−G11b2<0G_{21}b_1-G_{11}b_2<0。即,当G21b1−G11b2<0G_{21}b_1-G_{11}b_2<0,b1≤0b_1\leq 0时,λ=[b1/G110]\lambda=\begin{bmatrix}b_1/G_{11}\\ 0 \end{bmatrix};

情况3:当b1,b2>0b_1,b_2>0时,λ=[0,0]T\lambda=[0,0]^T;

情况4:此时λ=G−1b≤0\lambda=G^{-1}b\leq 0。

综上所述,对x∈int⁡(C)x\in\operatorname{int}(\mathcal C),λ\lambda可写为如下闭环解析形式:

当G12min⁡{b2,0}−G22b1<0G_{12}\min\{b_2,0\}-G_{22}b_1<0时,λ=[0min⁡{b2,0}/G22]\lambda=\begin{bmatrix}0\\\min\{b_2,0\}/G_{22} \end{bmatrix};当G21min⁡{b1,0}−G11b2<0G_{21}\min\{b_1,0\}-G_{11}b_2<0时,λ=[min⁡{b1,0}/G110]\lambda=\begin{bmatrix}\min\{b_1,0\}/G_{11}\\ 0 \end{bmatrix};其他情况时,λ=[min⁡{G22b1−G21b2}min⁡{G11b2−G12b1}]/(G11G22−G12G21)\lambda=\begin{bmatrix}\min\{G_{22}b_1-G_{21} b_2\}\\ \min\{G_{11}b_2-G_{12}b_1 \}\end{bmatrix}/(G_{11}G_{22}-G_{12}G_{21})。(最后一个情况λ\lambda不可能为0,因为GG的行向量线性无关。)

对于ZCBF,考虑如下形式的QP问题

u∗(x)=arg⁡min⁡u=(u,δ)∈Rm×R12uTH(x)u+FT(x)us.t.⁡LfV(x)+LgV(x)u+c3V(x)−δ≤0−Lfh(x)−Lgh(x)u−α(h(x))≤0\begin{aligned} \boldsymbol u^*(x)&= {\arg\min}_{\boldsymbol{u}=(u,\delta)\in\mathbb R^m\times \mathbb R} \frac{1}{2}\boldsymbol u^TH(x)\boldsymbol u+F^T(x)\boldsymbol u\\ \operatorname{s.t.} &\quad \begin{aligned}L_fV(x)+L_gV(x)u+c_3 V(x)-\delta&\leq 0\\ -L_f h(x)-L_g h(x)u-\alpha(h(x))&\leq 0 \end{aligned} \end{aligned}

其中,c3>0c_3>0是常数,α\alpha是K\mathcal K类函数,H(x)∈R(m+1)×(m+1)H(x)\in \mathbb R^{(m+1)\times(m+1)}正定,F(x)∈Rm+1F(x)\in\mathbb R^{m+1}。同理,我们有关于ZCBF的定理。

定理4:假设f,g,h,V,H,Ff,g,h,V,H,F都局部Lipschitz连续。再假设相对度为1,即Lgh(x)≠0L_g h(x)\neq 0,∀x∈D\forall x\in\mathcal D。那么CLF-CBF QP的解u∗(x)\boldsymbol u^*(x)在D\mathcal D上局部Lipschitz连续,且解可以写成一个闭环解析式。


  1. Ames, A. D., Xu, X., Grizzle, J. W., & Tabuada, P. (2017). Control Barrier Function Based Quadratic Programs for Safety Critical Systems. IEEE Transactions on Automatic Control, 62(8), 3861–3876. https://doi.org/10.1109/TAC.2016.2638961 ↩︎

  2. Blanchini, F. (1999). Set invariance in control. Automatica. Elsevier Science Ltd. https://doi.org/10.1016/S0005-1098(99)00113-2 ↩︎