3. Introduction
对于低维度的欠驱动系统已经取得了很多的进展,这个部分从低维度开始,逐渐介绍这些主流算法。
3.1 The acrobot
acrobot 机器人,只有elbow关节是有电机的,在shoulder部分是没有电机的,和体操中的单杠类似。
它的典型任务是摆动到最高点并且保持平衡。
3.1.1 Equations of motion
写成标准形式,
M
(
q
)
q
¨
+
C
(
q
,
q
˙
)
q
˙
=
τ
g
(
q
)
+
B
u
M(q)\ddot{q}+C(q,\dot{q})\dot{q}=\tau_g(q)+Bu
M(q)q¨+C(q,q˙)q˙=τg(q)+Bu
通过拉格朗日方法计算其中的每一项。
3.2 cart-pole system
典型的小车倒立摆模型如下图。
3.2.1 Equations of motion
写成标准形式,对应的项参数如下。
3.3 quadrotors
3.3.1 The planar quadrotor
平面四旋翼的刚体模型如下。
m
x
¨
=
−
(
u
1
+
u
2
)
s
i
n
θ
m
y
¨
=
(
u
1
+
u
2
)
c
o
s
θ
−
m
g
I
θ
¨
=
r
(
u
1
−
u
2
)
\begin{aligned} m\ddot{x} &=-(u_1+u_2)sin\theta \\ m\ddot{y} & = (u_1+u_2)cos\theta -mg \\ I\ddot{\theta} &=r(u_1-u_2) \end{aligned}
mx¨my¨Iθ¨=−(u1+u2)sinθ=(u1+u2)cosθ−mg=r(u1−u2)
3.4 Balancing
控制acrobot 和 cart-pole系统,在unstable fixed point附件,设计线性控制器平衡系统,步骤:
1)在固定点附近线性化;
2)评估线性系统的能控性;
3)使用LQR设计线性控制器;
3.4.1 对动力学方程进行线性化
在fixed point附近进行泰勒展开,
x
˙
=
f
(
x
,
u
)
≈
f
(
x
∗
,
u
∗
)
+
∂
f
∂
x
∣
x
=
x
∗
,
u
=
u
∗
(
x
−
x
∗
)
+
∂
f
(
x
,
u
)
∂
u
∣
x
=
x
∗
,
u
=
u
∗
(
u
−
u
∗
)
\dot{x}=f(x,u)\approx f(x^*,u^*)+\frac{\partial f}{\partial x} |_{x=x^*,u=u^*}(x-x^*)+\frac{\partial f(x,u)}{\partial u} |_{x=x^*,u=u^*}(u-u^*)
x˙=f(x,u)≈f(x∗,u∗)+∂x∂f∣x=x∗,u=u∗(x−x∗)+∂u∂f(x,u)∣x=x∗,u=u∗(u−u∗)
接下来将动力学方程转换成状态转移方程,设x=
[
q
;
q
˙
]
[q;\dot{q}]
[q;q˙],
x
˙
=
[
q
˙
M
−
1
(
q
)
[
τ
g
(
q
)
+
B
(
q
)
u
−
C
(
q
,
q
˙
)
q
˙
]
]
≈
A
l
i
n
(
x
−
x
∗
)
+
B
l
i
n
(
u
−
u
∗
)
\begin{aligned} \dot{x} &= \begin{bmatrix} \dot{q} \\ M^{-1}(q)[\tau_g(q)+B(q)u-C(q,\dot{q})\dot{q}] \end{bmatrix} \\ & \approx A_{lin}(x-x^*)+B_{lin}(u-u^*) \end{aligned}
x˙=[q˙M−1(q)[τg(q)+B(q)u−C(q,q˙)q˙]]≈Alin(x−x∗)+Blin(u−u∗)
对矩阵中的项关于
(
q
,
q
˙
,
u
)
(q,\dot{q},u)
(q,q˙,u)展开,并且利用fixed point的一些特殊性质如:
q
¨
∗
=
τ
g
(
q
∗
)
+
B
(
q
∗
)
u
−
C
(
q
∗
,
q
˙
∗
)
q
∗
˙
=
0
q
˙
∗
=
0
C
(
q
∗
,
q
˙
∗
)
=
0
\begin{aligned} \ddot{q}^* & = \tau_g(q^*)+B(q^*)u-C(q^*,\dot{q}^*)\dot{q^*} &=0 \\ \dot{q}^* &= 0 \\ C(q^*,\dot{q}^*) & = 0 \end{aligned}
q¨∗q˙∗C(q∗,q˙∗)=τg(q∗)+B(q∗)u−C(q∗,q˙∗)q∗˙=0=0=0
得到
对于很多系统,B是constant 矩阵,对应的线性化之后的矩阵更加简单了。
- Linearation of the acrobot
- Linearization of the cart-pole system
得到线性化结果之后,可以通过矩阵的特征值判断稳定性,或者其他传统控制的办法。 - 为什么搞线性化?
1)在第2节内容,如果是一个全驱动的系统,完全可以通过模型转换的方法。把非线性系统变换成一个线性系统。
2)对于欠驱动系统,线性化以后,可以用一些经典控制理论,LQR和PID。
3.4.2 Controllability of linear system
能控性,考察系统是否可以到达状态空间中的任意状态,先看能控的定义。
课程提供了一种直觉理解的方法,通过引入特征向量将问题变得更清晰。
- non-repeated eigenvalues
状态矩阵A的特征向量为 v i v_i vi,特征值为 λ i \lambda_i λi
A v i = λ i v i A V = V Λ \begin{aligned} Av_i &=\lambda_iv_i \\ AV & = V\Lambda \\ \end{aligned} AviAV=λivi=VΛ
将状态空间中的状态量映射到特征向量组成的空间中:
x = V r r ˙ = V − 1 x ˙ = V − 1 ( A x + B u ) = V − 1 A V r + V − 1 B u = Λ r + V − 1 B u r ˙ i = λ i r i + ∑ j β i j u j \begin{aligned} x&=Vr \\ \dot{r} &=V^{-1}\dot{x} \\ & = V^{-1}(Ax+Bu) \\ & = V^{-1}AVr+V^{-1}Bu \\ & = \Lambda r+V^{-1}Bu \\ \dot{r}_i& = \lambda_i r_i+\sum_j{\beta_{ij}u_j} \end{aligned} xr˙r˙i=Vr=V−1x˙=V−1(Ax+Bu)=V−1AVr+V−1Bu=Λr+V−1Bu=λiri+j∑βijuj
只要保证 V i , ∃ β i j ≠ 0 V_i, \exist \beta_{ij} \ne 0 Vi,∃βij=0,能满足能控性。 - general solution
general solution就是传统控制理论上的能控的定义,省略不表。 - controllability vs underactuated
对于典型的欠驱动系统,acrobot 和cartpole 系统,在unstable fixed point附近却是能控的。这说明了我们用一个LQR这样的控制器就能搞定他们了。 -
现
有
的
进
展
和
问
题
\color{red}{现有的进展和问题}
现有的进展和问题
3.5 partial feedback linearization
借用全驱动的直接线性化的方法,探索一下如果进行局部线性化会这么样。根据控制器是否线性化驱动关节,分为:
collocated partial feedback linearization 和non-collocated partial feedback linearization。
3.5.1 PFL for the cart-pole system
先建立一个简化的cart-pole 动力学方程
2
x
¨
+
θ
¨
c
o
s
θ
−
θ
˙
2
s
i
n
θ
=
f
x
x
¨
c
o
s
θ
+
θ
¨
+
s
i
n
θ
=
0
\begin{aligned} 2\ddot{x}+\ddot{\theta}cos\theta-\dot{\theta}^2sin\theta& = f_x \\ \ddot{x}cos\theta+\ddot{\theta} +sin\theta & =0 \end{aligned}
2x¨+θ¨cosθ−θ˙2sinθx¨cosθ+θ¨+sinθ=fx=0
- collocated
把第一项中,欠驱动关节的加速度 θ ¨ \ddot{\theta} θ¨替换掉,得到下面的形式
θ ¨ = − x ¨ c − s x ¨ ( 2 − c 2 ) − s c − θ ˙ 2 s = f x \begin{aligned} \ddot{\theta} &=-\ddot{x}c-s \\ \ddot{x}(2-c^2) &-sc-\dot{\theta}^2s =f_x \end{aligned} θ¨x¨(2−c2)=−x¨c−s−sc−θ˙2s=fx
通过控制 f x f_x fx可以得到目标加速度 x ¨ d \ddot{x}^d x¨d,得到下面的形式:
x ¨ = x ¨ d θ ¨ = − x ¨ d c − s \begin{aligned} \ddot{x} &= \ddot{x}^d \\ \ddot{\theta} &=-\ddot{x}^dc-s \end{aligned} x¨θ¨=x¨d=−x¨dc−s
现在这个模型可以看成是单倒立摆,受到输入力矩 − x ¨ d c -\ddot{x}^dc −x¨dc。 - non-collocated
将第一项中的,驱动关节的加速度 x ¨ \ddot{x} x¨替换掉,得到下面的形式
x ¨ = − θ ¨ + s c θ ¨ ( c − 2 c ) − 2 t a n θ − θ ˙ 2 s = f x \begin{aligned} \ddot{x} & = - \frac{\ddot{\theta}+s}{c} \\ \ddot{\theta}(c-\frac{2}{c}) &-2tan\theta-\dot{\theta}^2s = f_x \end{aligned} x¨θ¨(c−c2)=−cθ¨+s−2tanθ−θ˙2s=fx
同样的,此时控制f_x可以得到目标 θ ¨ \ddot{\theta} θ¨,有
θ ¨ = θ ¨ d x ¨ = − θ ¨ d + s c \begin{aligned} \ddot{\theta} & = \ddot{\theta}^{d} \\ \ddot{x} & = - \frac{\ddot{\theta}^d+s}{c} \end{aligned} θ¨x¨=θ¨d=−cθ¨d+s
需要注意的是,要检查 c o s θ ≠ 0 cos\theta \ne 0 cosθ=0
3.5.2 General form
针对欠驱动系统动力学方程的特殊性,令
M
(
q
)
=
[
M
11
M
12
M
21
M
22
]
M(q)=\begin{bmatrix} M_{11} & M_{12} \\ M_{21} & M_{22} \end{bmatrix}
M(q)=[M11M21M12M22],
τ
=
τ
g
−
C
q
˙
\tau=\tau_g-C\dot{q}
τ=τg−Cq˙,将基本动力学公式转换成下面的形式。
q
1
q_1
q1代表passive joints,
q
2
q_2
q2代表actuated joints,并且M是正定矩阵。
M
11
q
¨
1
+
M
12
q
¨
2
=
τ
1
M
21
q
¨
1
+
M
22
q
¨
2
=
τ
2
+
u
\begin{aligned} M_{11}\ddot{q}_1+M_{12}\ddot{q}_2 & = \tau_1 \\ M_{21}\ddot{q}_1+M_{22}\ddot{q}_2 & = \tau_2+u \end{aligned}
M11q¨1+M12q¨2M21q¨1+M22q¨2=τ1=τ2+u
- Collocated linearization
q ¨ 1 = M 11 − 1 ( τ 1 − M 12 q ¨ 2 ) ( M 22 − M 21 M 11 − 1 M 12 ) q ¨ 2 − τ 2 + M 21 M 11 − 1 τ 1 = u \begin{aligned} \ddot{q}_1 & = M_{11}^{-1}(\tau_1-M_{12}\ddot{q}_2) \\ (M_{22}-M_{21}M_{11}^{-1}M_{12})\ddot{q}_2 &-\tau_2+M_{21}M_{11}^{-1}\tau_1=u \end{aligned} q¨1(M22−M21M11−1M12)q¨2=M11−1(τ1−M12q¨2)−τ2+M21M11−1τ1=u - Non-collocated linearization
- task-space partial feedback linearization
考虑如何控制末端轨迹,
y = h ( q ) y ˙ = H q ˙ = [ ∂ h ∂ q 1 ∂ h ∂ q 2 ] q ˙ y ¨ = H ˙ q ˙ + H 1 q ¨ 1 + H 2 q ¨ 2 = H ˙ q ˙ + H 1 ( M 11 − 1 [ τ 1 − M 12 q ¨ 2 ] ) + H 2 q ¨ 2 \begin{aligned} y & =h(q) \\ \dot{y} & = H \dot{q} = \begin{bmatrix} \frac{\partial h}{\partial q_1} & \frac{\partial h}{\partial q_2} \end{bmatrix} \dot{q} \\ \ddot{y}& = \dot{H}\dot{q}+H_1\ddot{q}_1+H_2\ddot{q}_2 \\ & = \dot{H}\dot{q} + H_1(M_{11}^{-1}[\tau_1-M_{12}\ddot{q}_2])+H_2\ddot{q}_2 \end{aligned} yy˙y¨=h(q)=Hq˙=[∂q1∂h∂q2∂h]q˙=H˙q˙+H1q¨1+H2q¨2=H˙q˙+H1(M11−1[τ1−M12q¨2])+H2q¨2
最终得到下面的公式:
这里非常关键的是, H ˉ \bar{H} Hˉ的秩,如果驱动关节的自由度大于末端的自由度,能保证 H ˉ \bar{H} Hˉ的列数大于行数。
部署顺序:
1)规划末端的轨迹;
2)添加反馈控制器;
y ¨ d = y ¨ r d + K d ( y ˙ d − y ˙ ) + K p ( y d − y ) \ddot{y}^d=\ddot{y}_r^d+K_d(\dot{y}^d-\dot{y})+K_p(y^d-y) y¨d=y¨rd+Kd(y˙d−y˙)+Kp(yd−y)
3)反算驱动关节的加速度;
4)在利用collocated linearization 反算系统的输入量; - examples
1)cart-pole system
只控制cart-pole的竖直高度,轨迹规划:
y = h ( q ) = − l c o s ( θ ) y ˙ = l θ ˙ s i n θ y d ( t ) = 0.5 l + 0.25 l s i n ( t ) \begin{aligned} y & = h(q) = -lcos(\theta) \\ \dot{y} & = l \dot{\theta}sin\theta \\ y^d(t) & = 0.5l+0.25lsin(t) \end{aligned} yy˙yd(t)=h(q)=−lcos(θ)=lθ˙sinθ=0.5l+0.25lsin(t)
2 ) task-space partial linearization 提供了一个框架,非常方便的得到collocated 和non-collocated 结果。
y = q 2 H 1 = 0 , H 2 = I , H ˙ = 0 , H ˉ = I , H ˉ + = I q 2 ¨ = q ¨ 2 d \begin{aligned} y & = q_2 \\ H_1 = 0,H_2 = I, & \dot{H}=0, \bar{H}=I, \bar{H}^+=I \\ \ddot{q_2} &=\ddot{q}^d_2 \end{aligned} yH1=0,H2=I,q2¨=q2H˙=0,Hˉ=I,Hˉ+=I=q¨2d
带入执行关节加速度和输入u关系公式,即可得到collocation的结果
同理,得到non-collocation的形式,但是需要注意为例满足存在唯一解的条件,要求 r a n k ( M 12 ) = l ( n u m o f p a s s i v e d e g r e s s ) rank(M_{12})=l(num \, of \, passive degress) rank(M12)=l(numofpassivedegress)
3.6 swing-up control
这一章的最后提供了一套最基本的框架,来解决两个典型的欠驱动问题。欠驱动问题的难点在于很难把系统搞到上一章提高的phase portait上的一个稳定的轨道上,然后再用LQR处理。
这里的系统比较简单,用energy shaping就完成了phase portait上换轨的任务,这才是关键。
3.6.2 Cart-pole
先简化模型,
x
¨
=
x
¨
d
θ
¨
=
−
x
¨
d
c
−
s
\begin{aligned} \ddot{x}&=\ddot{x}^d \\ \ddot{\theta} &=-\ddot{x}^dc-s \end{aligned}
x¨θ¨=x¨d=−x¨dc−s
带入energy-shaping 的公式
E
(
x
)
=
1
2
θ
˙
2
−
c
o
s
θ
E
d
=
1
,
E
~
(
x
)
=
E
(
x
)
−
E
d
E
~
˙
(
x
)
=
E
˙
(
x
)
=
θ
˙
θ
¨
+
θ
˙
s
=
θ
˙
(
−
x
¨
d
c
−
s
)
+
θ
˙
s
=
−
θ
˙
x
¨
d
c
\begin{aligned} E(x) & = \frac{1}{2}\dot{\theta}^2-cos\theta \\ E^d &=1, \tilde{E}(x)=E(x)-E^d \\ \dot{\tilde{E}}(x) & = \dot{E}(x)=\dot{\theta}\ddot{\theta}+\dot{\theta}s \\ &= \dot{\theta}(-\ddot{x}^dc-s)+\dot{\theta}s \\ & = -\dot{\theta}\ddot{x}^dc \end{aligned}
E(x)EdE~˙(x)=21θ˙2−cosθ=1,E~(x)=E(x)−Ed=E˙(x)=θ˙θ¨+θ˙s=θ˙(−x¨dc−s)+θ˙s=−θ˙x¨dc
令
x
¨
d
=
k
θ
˙
c
o
s
θ
E
~
\ddot{x}^d=k\dot{\theta}cos\theta \tilde{E}
x¨d=kθ˙cosθE~, k>0,有
E
~
˙
=
−
k
θ
˙
2
c
o
s
2
θ
E
~
\dot{\tilde{E}}=-k\dot{\theta}^2cos^2\theta \tilde{E}
E~˙=−kθ˙2cos2θE~
理论可以证明
E
~
→
0
\tilde{E} \to 0
E~→0
设计PD控制器,
x
¨
d
=
k
θ
˙
c
o
s
θ
E
~
−
k
p
x
−
k
d
x
˙
\ddot{x}^d=k\dot{\theta}cos\theta \tilde{E}-k_px-k_d\dot{x}
x¨d=kθ˙cosθE~−kpx−kdx˙
本来根据collocation的公式,有
a
x
¨
d
+
b
=
u
a\ddot{x}^d+b=u
ax¨d+b=u,因为这里有需要认为调节的增益项
k
,
k
p
,
k
d
k,k_p,k_d
k,kp,kd,所以可以直接令
x
¨
d
=
u
\ddot{x}^d=u
x¨d=u。
总结一下,第二章的时候我们解决不了这个问题,只能保证倒立摆的能量完成换轨,因为没有小车的线性模型,没法同时控制小车,现在有了partial feedback linearization。完成了小车控制和倒立摆能量换轨。
energy-shaping 控制方法灵活性太高,并且它还没有考虑到输入受限和状态受限这种约束。