滑模控制在四旋翼上的应用举例(内含公式手推、simulink框图连接、代码编写)
本文以论文《Research on vertical air–water transmedia control of Hybrid Unmanned Aerial Underwater Vehicles based on adaptive sliding mode dynamical surface control》为例,复现了其中控制结果,并对其控制律的设计进行了公式推导
滑模控制在四旋翼上的应用举例
本文以Zongcheng Ma, Jinfu Feng, Jian Yang的论文《Research on vertical air-water trans-media control of Hybrid Unmanned Aerial Underwater Vehicles based on adaptive sliding mode dynamical sruface control》这篇文章为例,将文章中的结果进行部分复现,展示应用在四旋翼上的滑模控制。具体算法实施过程中可能会用到一部分自适应思想,但不影响理解,也欢迎大家参考笔者关于自适应的文章基于反步法backstepping的自适应控制简介,进一步了解自适应的思想。
1. 论文背景
该论文建立了如下场景:一四旋翼飞行器从固定高度开始下降,穿越水面,并进入到水下一定位置的过程。在入水过程中四旋翼受力复杂,因此需要较好的控制律进行控制。
本文只对高度通道 z z z和姿态通道 φ , θ , ψ \varphi, \theta, \psi φ,θ,ψ设计控制律,目的是在复现该论文过程中,更好地体会滑模控制的思想。由于四旋翼各个通道的耦合性,姿态控制需要得到较好结果后才能进行高度控制,因此在实际应用中往往把姿态控制当做内环,位置控制作为外环,设计复合控制器或级联控制器,这也是本文针对姿态控制和高度通知均设计控制律的原因。
2. 数学建模
设各变量为
η
1
=
[
x
y
z
]
T
η
2
=
[
φ
θ
ψ
]
T
V
=
[
u
v
w
]
T
ω
=
[
p
q
r
]
T
\begin{aligned} \eta _1 &= \left[ \begin{matrix} x & y & z \end{matrix} \right]^T \\ \eta_2 &= \left[ \begin{matrix} \varphi & \theta & \psi \end{matrix} \right]^T \\ V &= \left[ \begin{matrix} u & v & w \end{matrix} \right]^T \\ \omega &= \left[ \begin{matrix} p & q & r \end{matrix} \right]^T \end{aligned}
η1η2Vω=[xyz]T=[φθψ]T=[uvw]T=[pqr]T其中
η
1
,
η
2
\eta_1, \eta_2
η1,η2为地球坐标系下的物理量,
V
,
ω
V, \omega
V,ω为机体坐标系下的物理量。(关于地球坐标系和机体坐标系可以参考文章Backstepping反步法控制四旋翼无人机(一))。
列出欧拉方程
{
m
η
¨
1
=
F
J
ω
˙
+
ω
×
J
ω
=
M
\begin{cases} m \ddot \eta _1 = F \\ J \dot \omega + \omega \times J \omega = M \end{cases}
{mη¨1=FJω˙+ω×Jω=M
对于入水过程,该论文设计了一个临界区间
H
H
H,当无人机高度位于区间内时,作用于其上的浮力
f
(
z
)
f(z)
f(z)、拉力系数
C
0
(
z
)
C_0(z)
C0(z)、总质量(包括机身质量和附加质量)
m
i
(
z
)
m_i (z)
mi(z)、总转动惯量
J
i
(
z
)
J_i(z)
Ji(z)、均拥有不同形式:
f
(
z
)
=
{
0
,
z
>
H
2
(
H
2
−
z
)
m
0
g
,
−
H
2
≤
z
≤
H
2
m
0
g
,
z
<
−
H
2
C
0
(
z
)
=
{
0
,
z
>
H
2
(
H
2
−
z
)
c
0
,
−
H
2
≤
z
≤
H
2
c
0
,
z
<
−
H
2
m
i
(
z
)
=
{
m
0
,
z
>
H
2
(
H
2
−
z
)
(
m
0
+
λ
i
i
)
,
−
H
2
≤
z
≤
H
2
m
0
+
λ
i
i
,
z
<
−
H
2
J
i
(
z
)
=
{
J
i
i
,
z
>
H
2
(
H
2
−
z
)
(
J
i
i
+
λ
i
i
)
,
−
H
2
≤
z
≤
H
2
J
i
i
+
λ
i
i
,
z
<
−
H
2
\begin{aligned} f(z) = \begin{cases} 0, \quad z > \frac{H}{2} \\ \left( \frac{H}{2} - z \right) m_0 g, \quad - \frac{H}{2} \leq z \leq \frac{H}{2} \\ m_0 g, \quad z < - \frac{H}{2} \end{cases}\\ C_0(z) = \begin{cases} 0, \quad z > \frac{H}{2} \\ \left( \frac{H}{2} - z \right) c_0, \quad - \frac{H}{2} \leq z \leq \frac{H}{2} \\ c_0, \quad z < - \frac{H}{2} \end{cases} \\ m_i(z) = \begin{cases} m_0, \quad z > \frac{H}{2} \\ \left( \frac{H}{2} - z \right) \left( m_0 + \lambda_{ii} \right), \quad - \frac{H}{2} \leq z \leq \frac{H}{2} \\ m_0 + \lambda_{ii}, \quad z < - \frac{H}{2} \end{cases} \end{aligned}\\ J_i(z) = \begin{cases} J_{ii}, \quad z > \frac{H}{2} \\ \left( \frac{H}{2} - z \right) \left( J_{ii} + \lambda_{ii} \right), \quad - \frac{H}{2} \leq z \leq \frac{H}{2} \\ J_{ii} + \lambda_{ii}, \quad z < - \frac{H}{2} \end{cases}
f(z)=⎩⎪⎨⎪⎧0,z>2H(2H−z)m0g,−2H≤z≤2Hm0g,z<−2HC0(z)=⎩⎪⎨⎪⎧0,z>2H(2H−z)c0,−2H≤z≤2Hc0,z<−2Hmi(z)=⎩⎪⎨⎪⎧m0,z>2H(2H−z)(m0+λii),−2H≤z≤2Hm0+λii,z<−2HJi(z)=⎩⎪⎨⎪⎧Jii,z>2H(2H−z)(Jii+λii),−2H≤z≤2HJii+λii,z<−2H
那么总的运动公式可以表示为
{
m
3
z
¨
1
=
U
1
cos
φ
cos
θ
−
m
0
g
+
f
(
z
)
−
C
0
z
˙
+
d
f
+
d
k
+
d
l
J
η
¨
2
=
Γ
−
C
η
˙
2
+
d
Γ
(0)
\begin{cases} m_3 \ddot z _1 = U_1 \cos \varphi \cos \theta - m_0 g + f(z) - C_0 \dot z + d_f + d_k + d_l \\ J \ddot \eta_2 = \Gamma - C \dot \eta_2 + d_{\Gamma} \tag{0} \end{cases}
{m3z¨1=U1cosφcosθ−m0g+f(z)−C0z˙+df+dk+dlJη¨2=Γ−Cη˙2+dΓ(0)其中:
m
3
=
m
0
+
Δ
m_3 = m_0 + \Delta
m3=m0+Δ,第二项
Δ
\Delta
Δ为附加质量和未建模的干扰项的和;
Γ
=
[
U
2
U
3
U
4
]
T
\Gamma = \left[ \begin{matrix} U_2 & U_3 & U4 \end{matrix} \right] ^ T
Γ=[U2U3U4]T为控制向量;
C
=
l
×
d
i
a
g
(
K
p
,
M
q
,
N
r
)
C = l \times diag \left(K_p, M_q, N_r \right)
C=l×diag(Kp,Mq,Nr)为科里奥利力;
d
f
,
d
k
,
d
Γ
d_f, d_k, d_\Gamma
df,dk,dΓ分别为浮力线性化的误差、阻力线性化的误差、外部干扰。
3. 姿态控制器设计
设跟踪误差为
e
η
2
=
η
2
−
η
2
d
=
[
φ
θ
ψ
]
−
[
φ
d
θ
d
ψ
d
]
\begin{aligned} e_{\eta_2} &= \eta_2 - \eta_{2d} \\ &= \left[ \begin{matrix} \varphi \\ \theta \\ \psi \end{matrix} \right] - \left[ \begin{matrix} \varphi_d \\ \theta_d \\ \psi_d \end{matrix} \right] \end{aligned}
eη2=η2−η2d=⎣⎡φθψ⎦⎤−⎣⎡φdθdψd⎦⎤求二阶导
e
¨
η
2
=
η
¨
2
−
η
¨
2
d
=
J
−
1
(
Γ
−
C
η
˙
2
+
d
Γ
)
−
η
¨
2
d
\ddot e_{\eta_2} = \ddot \eta_2 - \ddot \eta_{2d} = J^{-1} \left( \Gamma - C \dot \eta_2 + d_\Gamma \right) - \ddot \eta_{2d}
e¨η2=η¨2−η¨2d=J−1(Γ−Cη˙2+dΓ)−η¨2d
设计滑模面为
s
1
=
e
˙
η
2
+
λ
1
e
η
2
(1)
s_1 = \dot e_{\eta_2} + \lambda_1 e_{\eta_2} \tag{1}
s1=e˙η2+λ1eη2(1)此时如果把控制量设计为
{
Γ
=
J
^
Γ
ˉ
+
C
η
˙
2
−
d
^
Γ
Γ
ˉ
=
η
¨
2
d
−
λ
1
e
˙
η
2
−
c
1
s
1
(3)
\begin{cases} \Gamma = \hat J \bar \Gamma + C \dot \eta_2 - \hat d_\Gamma \\ \bar \Gamma = \ddot \eta_{2d} - \lambda_1 \dot e_{\eta_2} - c_1 s_1 \tag{3} \end{cases}
{Γ=J^Γˉ+Cη˙2−d^ΓΓˉ=η¨2d−λ1e˙η2−c1s1(3)亦即
{
Γ
=
J
^
Γ
ˉ
+
C
η
˙
2
−
d
^
Γ
λ
1
e
˙
η
2
=
η
¨
2
d
−
c
1
s
1
−
Γ
ˉ
(4)
\begin{cases} \Gamma = \hat J \bar \Gamma + C \dot \eta_2 - \hat d_\Gamma \\ \lambda_1 \dot e_{\eta_2} = \ddot \eta_{2d} - c_1 s_1 - \bar \Gamma \tag{4} \end{cases}
{Γ=J^Γˉ+Cη˙2−d^Γλ1e˙η2=η¨2d−c1s1−Γˉ(4)
则对(1)求导,并代入(4)有
s
˙
1
=
e
¨
η
2
+
λ
1
e
˙
η
2
=
J
−
1
(
Γ
−
C
η
˙
2
+
d
Γ
)
−
η
¨
2
d
+
λ
1
e
˙
η
2
=
J
−
1
(
Γ
−
C
η
˙
2
+
d
Γ
)
−
η
¨
2
d
+
η
¨
2
d
−
c
1
s
1
−
Γ
ˉ
=
J
−
1
[
(
J
^
Γ
ˉ
+
C
η
˙
2
−
d
^
Γ
)
−
C
η
˙
2
+
d
Γ
]
−
c
1
s
1
−
Γ
ˉ
=
J
−
1
(
J
^
Γ
ˉ
−
d
^
Γ
+
d
Γ
)
−
c
1
s
1
−
Γ
ˉ
(5)
\begin{aligned} \dot s_1 &= \ddot e_{\eta_2} + \lambda_1 \dot e_{\eta_2} \\ &= J^{-1} \left( \Gamma - C \dot \eta_2 + d_\Gamma \right) - \ddot \eta_{2d} + \lambda_1 \dot e_{\eta_2} \\ &= J^{-1} \left( \Gamma - C \dot \eta_2 + d_\Gamma \right) - \ddot \eta_{2d} + \ddot \eta_{2d} - c_1 s_1 - \bar \Gamma \\ &= J^{-1} \left[ \left( \hat J \bar \Gamma + C \dot \eta_2 - \hat d_\Gamma \right) - C \dot \eta_2 + d_\Gamma \right] - c_1 s_1 - \bar \Gamma \\ &= J^{-1} \left( \hat J \bar \Gamma - \hat d_\Gamma + d_\Gamma \right) - c_1 s_1 - \bar \Gamma \tag{5} \end{aligned}
s˙1=e¨η2+λ1e˙η2=J−1(Γ−Cη˙2+dΓ)−η¨2d+λ1e˙η2=J−1(Γ−Cη˙2+dΓ)−η¨2d+η¨2d−c1s1−Γˉ=J−1[(J^Γˉ+Cη˙2−d^Γ)−Cη˙2+dΓ]−c1s1−Γˉ=J−1(J^Γˉ−d^Γ+dΓ)−c1s1−Γˉ(5)
下面设计自适应律:
{
d
^
˙
Γ
=
γ
1
s
1
J
^
˙
=
−
γ
2
Γ
ˉ
s
1
T
(6)
\begin{cases} \dot {\hat d}_\Gamma = \gamma_1 s_1 \\ \dot {\hat J} = - \gamma_2 \bar \Gamma s_1^T \tag{6} \end{cases}
{d^˙Γ=γ1s1J^˙=−γ2Γˉs1T(6)并设计李雅普诺夫函数为以下形式
V
1
=
1
2
s
1
T
s
1
+
1
2
γ
1
d
~
Γ
T
J
−
1
d
~
Γ
+
1
2
γ
2
t
r
(
J
~
T
J
−
1
J
~
)
(7)
V_1 = \frac{1}{2}s_1^Ts_1 + \frac{1}{2\gamma_1} \tilde d_\Gamma^T J^{-1} \tilde d_\Gamma + \frac{1}{2\gamma_2} tr \left( \tilde J^T J^{-1} \tilde J \right) \tag{7}
V1=21s1Ts1+2γ11d~ΓTJ−1d~Γ+2γ21tr(J~TJ−1J~)(7)其中
d
~
Γ
=
d
Γ
−
d
^
Γ
,
J
~
=
J
−
J
^
(8)
\tilde d_\Gamma = d_\Gamma - \hat d_\Gamma, \quad \tilde J = J - \hat J \tag{8}
d~Γ=dΓ−d^Γ,J~=J−J^(8)对李雅普诺夫函数求导:
V
˙
1
=
s
1
T
s
˙
1
+
1
γ
1
d
~
Γ
T
J
−
1
d
~
˙
Γ
+
1
γ
2
t
r
(
J
~
T
J
−
1
J
~
˙
)
(9)
\dot V_1 = s_1^T \dot s_1 + \frac{1}{\gamma_1} \tilde d_\Gamma ^T J^{-1} \dot {\tilde d}_\Gamma + \frac{1}{\gamma_2} tr \left( \tilde J^T J^{-1} \dot {\tilde J} \right) \tag{9}
V˙1=s1Ts˙1+γ11d~ΓTJ−1d~˙Γ+γ21tr(J~TJ−1J~˙)(9)设
d
Γ
d_\Gamma
dΓ和
J
J
J变化缓慢,那么由(8)
d
~
Γ
˙
=
d
˙
Γ
−
d
^
˙
Γ
=
−
d
^
˙
Γ
J
~
˙
=
J
˙
−
J
^
˙
=
−
J
^
˙
(10)
\begin{aligned} \dot {\tilde d_\Gamma} &= \dot d_\Gamma - \dot {\hat d}_\Gamma = - \dot {\hat d}_\Gamma \\ \dot {\tilde J} &= \dot J - \dot {\hat J} = - \dot {\hat J} \tag{10} \end{aligned}
d~Γ˙J~˙=d˙Γ−d^˙Γ=−d^˙Γ=J˙−J^˙=−J^˙(10)把(10)代入(9),可得到下式(11)
V
˙
1
=
s
1
T
s
˙
1
+
1
γ
1
d
~
Γ
T
J
−
1
d
~
˙
Γ
+
1
γ
2
t
r
(
J
~
T
J
−
1
J
~
˙
)
=
s
1
T
s
˙
1
−
1
γ
1
d
~
Γ
T
J
−
1
d
^
˙
Γ
−
1
γ
2
t
r
(
J
~
T
J
−
1
J
^
˙
)
=
s
1
T
[
J
−
1
(
J
^
Γ
ˉ
−
d
^
Γ
+
d
Γ
)
−
c
1
s
1
−
Γ
ˉ
]
−
1
γ
1
d
~
Γ
T
J
−
1
d
^
˙
Γ
−
1
γ
2
t
r
(
J
~
T
J
−
1
J
^
˙
)
=
−
c
1
s
1
T
s
1
+
s
1
T
J
−
1
J
^
Γ
ˉ
+
(
−
s
1
T
J
−
1
d
^
Γ
+
s
1
T
J
−
1
d
Γ
)
−
s
1
T
Γ
ˉ
−
1
γ
1
d
~
Γ
T
J
−
1
d
^
˙
Γ
−
1
γ
2
t
r
(
J
~
T
J
−
1
J
^
˙
)
=
−
c
1
s
1
T
s
1
+
s
1
T
J
−
1
J
^
Γ
ˉ
+
s
1
T
J
−
1
d
~
Γ
−
s
1
T
Γ
ˉ
−
1
γ
1
d
~
Γ
T
J
−
1
d
^
˙
Γ
−
1
γ
2
t
r
(
J
~
T
J
−
1
J
^
˙
)
=
−
c
1
s
1
T
s
1
+
s
1
T
J
−
1
J
^
Γ
ˉ
+
s
1
T
J
−
1
d
~
Γ
−
(
s
1
T
J
−
1
J
Γ
ˉ
)
−
1
γ
1
d
~
Γ
T
J
−
1
d
^
˙
Γ
−
1
γ
2
t
r
(
J
~
T
J
−
1
J
^
˙
)
=
−
c
1
s
1
T
s
1
+
s
1
T
J
−
1
J
^
Γ
ˉ
−
1
γ
1
d
~
Γ
T
J
−
1
d
^
˙
Γ
−
1
γ
2
t
r
(
J
~
T
J
−
1
J
^
˙
)
−
s
1
T
J
−
1
(
J
−
J
^
)
Γ
ˉ
=
−
c
1
s
1
T
s
1
+
s
1
T
J
−
1
J
^
Γ
ˉ
−
1
γ
1
d
~
Γ
T
J
−
1
d
^
˙
Γ
−
1
γ
2
t
r
(
J
~
T
J
−
1
J
^
˙
)
−
s
1
T
J
−
1
J
~
Γ
ˉ
\begin{aligned} \dot V_1 &= s_1^T \dot s_1 + \frac{1}{\gamma_1} \tilde d_\Gamma ^T J^{-1} \dot {\tilde d}_\Gamma + \frac{1}{\gamma_2} tr \left( \tilde J^T J^{-1} \dot {\tilde J} \right) \\ &= s_1^T \dot s_1 - \frac{1}{\gamma_1} \tilde d_\Gamma ^T J^{-1} \dot {\hat d}_\Gamma - \frac{1}{\gamma_2} tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) \\ &= s_1^T \left[ J^{-1} \left( \hat J \bar \Gamma - \hat d_\Gamma + d_\Gamma \right) - c_1 s_1 - \bar \Gamma \right] - \frac{1}{\gamma_1} \tilde d_\Gamma^T J^{-1} \dot {\hat d}_\Gamma - \frac{1}{\gamma_2}tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) \\ &= -c_1 s_1^T s_1 + s_1^T J^{-1} \hat J \bar \Gamma + \left( - s_1^T J^{-1} \hat d_\Gamma + s_1^T J^{-1} d_\Gamma \right) - s_1^T \bar \Gamma - \frac{1}{\gamma_1} \tilde d_\Gamma^T J^{-1} \dot {\hat d}_\Gamma - \frac{1}{\gamma_2}tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) \\ &= -c_1 s_1^T s_1 + s_1^T J^{-1} \hat J \bar \Gamma + s_1^T J^{-1} \tilde d_\Gamma - s_1^T \bar \Gamma - \frac{1}{\gamma_1} \tilde d_\Gamma^T J^{-1} \dot {\hat d}_\Gamma - \frac{1}{\gamma_2}tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) \\ &= -c_1 s_1^T s_1 + s_1^T J^{-1} \hat J \bar \Gamma + s_1^T J^{-1} \tilde d_\Gamma - \left( s_1^T J^{-1} J \bar \Gamma \right) - \frac{1}{\gamma_1} \tilde d_\Gamma^T J^{-1} \dot {\hat d}_\Gamma - \frac{1}{\gamma_2}tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) \\ &= -c_1 s_1^T s_1 + s_1^T J^{-1} \hat J \bar \Gamma - \frac{1}{\gamma_1} \tilde d_\Gamma^T J^{-1} \dot {\hat d}_\Gamma - \frac{1}{\gamma_2}tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) - s_1^T J^{-1} \left( J - \hat J \right) \bar \Gamma \\ &= -c_1 s_1^T s_1 + s_1^T J^{-1} \hat J \bar \Gamma - \frac{1}{\gamma_1} \tilde d_\Gamma^T J^{-1} \dot {\hat d}_\Gamma - \frac{1}{\gamma_2}tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) - s_1^T J^{-1} \tilde J \bar \Gamma \end{aligned}
V˙1=s1Ts˙1+γ11d~ΓTJ−1d~˙Γ+γ21tr(J~TJ−1J~˙)=s1Ts˙1−γ11d~ΓTJ−1d^˙Γ−γ21tr(J~TJ−1J^˙)=s1T[J−1(J^Γˉ−d^Γ+dΓ)−c1s1−Γˉ]−γ11d~ΓTJ−1d^˙Γ−γ21tr(J~TJ−1J^˙)=−c1s1Ts1+s1TJ−1J^Γˉ+(−s1TJ−1d^Γ+s1TJ−1dΓ)−s1TΓˉ−γ11d~ΓTJ−1d^˙Γ−γ21tr(J~TJ−1J^˙)=−c1s1Ts1+s1TJ−1J^Γˉ+s1TJ−1d~Γ−s1TΓˉ−γ11d~ΓTJ−1d^˙Γ−γ21tr(J~TJ−1J^˙)=−c1s1Ts1+s1TJ−1J^Γˉ+s1TJ−1d~Γ−(s1TJ−1JΓˉ)−γ11d~ΓTJ−1d^˙Γ−γ21tr(J~TJ−1J^˙)=−c1s1Ts1+s1TJ−1J^Γˉ−γ11d~ΓTJ−1d^˙Γ−γ21tr(J~TJ−1J^˙)−s1TJ−1(J−J^)Γˉ=−c1s1Ts1+s1TJ−1J^Γˉ−γ11d~ΓTJ−1d^˙Γ−γ21tr(J~TJ−1J^˙)−s1TJ−1J~Γˉ下面引入3个性质:
对于
d
~
Γ
\tilde d_\Gamma
d~Γ与
d
~
Γ
T
\tilde d_\Gamma^T
d~ΓT有
d
~
Γ
T
J
−
1
d
^
˙
Γ
=
d
^
˙
Γ
T
J
−
1
d
~
Γ
\tilde d_\Gamma^T J^{-1} \dot {\hat d}_\Gamma = \dot {\hat d}_\Gamma^T J^{-1} \tilde d_\Gamma
d~ΓTJ−1d^˙Γ=d^˙ΓTJ−1d~Γ且
s
1
T
J
−
1
J
^
Γ
ˉ
=
t
r
(
J
−
1
J
~
Γ
ˉ
s
1
T
)
s_1^T J^{-1} \hat J \bar \Gamma = tr \left( J^{-1} \tilde J \bar \Gamma s_1^T \right)
s1TJ−1J^Γˉ=tr(J−1J~Γˉs1T)且
t
r
(
J
~
T
J
−
1
J
^
˙
)
=
t
r
(
J
−
1
J
~
J
^
˙
)
tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) = tr \left( J^{-1} \tilde J \dot {\hat J} \right)
tr(J~TJ−1J^˙)=tr(J−1J~J^˙)则代入(1)有
V
˙
1
=
−
c
1
s
1
T
s
1
+
s
1
T
J
−
1
J
^
Γ
ˉ
−
1
γ
1
d
~
Γ
T
J
−
1
d
^
˙
Γ
−
1
γ
2
t
r
(
J
~
T
J
−
1
J
^
˙
)
−
s
1
T
J
−
1
J
~
Γ
ˉ
=
−
c
1
s
1
T
s
1
+
s
1
T
J
−
1
J
^
Γ
ˉ
−
1
γ
1
d
^
˙
Γ
T
J
−
1
d
~
Γ
−
1
γ
2
t
r
(
J
−
1
J
~
J
^
˙
)
−
t
r
(
J
−
1
J
~
Γ
ˉ
s
1
T
)
=
−
c
1
s
1
T
+
(
s
1
T
J
−
1
−
1
γ
1
d
^
˙
Γ
T
J
−
1
)
d
~
Γ
−
t
r
(
J
−
1
J
~
Γ
ˉ
s
1
T
+
1
γ
2
J
−
1
J
~
J
^
˙
)
=
−
c
1
s
1
T
+
(
s
1
T
J
−
1
−
1
γ
1
d
^
˙
Γ
T
J
−
1
)
d
~
Γ
−
t
r
[
J
−
1
J
~
(
Γ
ˉ
s
1
T
+
1
γ
2
J
^
˙
)
]
=
−
c
1
s
1
T
+
(
s
1
T
J
−
1
−
1
γ
1
d
^
˙
Γ
T
J
−
1
)
d
~
Γ
−
(
Γ
ˉ
s
1
T
+
1
γ
2
J
^
˙
)
J
−
1
J
~
\begin{aligned} \dot V_1 &= -c_1 s_1^T s_1 + s_1^T J^{-1} \hat J \bar \Gamma - \frac{1}{\gamma_1} \tilde d_\Gamma^T J^{-1} \dot {\hat d}_\Gamma - \frac{1}{\gamma_2}tr \left( \tilde J^T J^{-1} \dot {\hat J} \right) - s_1^T J^{-1} \tilde J \bar \Gamma \\ &= -c_1 s_1^T s_1 + s_1^T J^{-1} \hat J \bar \Gamma - \frac{1}{\gamma_1} \dot {\hat d}_\Gamma^T J^{-1} \tilde d_\Gamma - \frac{1}{\gamma_2}tr \left( J^{-1} \tilde J \dot {\hat J} \right) -tr \left( J^{-1} \tilde J \bar \Gamma s_1^T \right) \\ &= -c_1 s_1^T + \left( s_1^T J^{-1} - \frac{1}{\gamma_1} \dot {\hat d}_\Gamma^T J^{-1} \right) \tilde d_\Gamma - tr \left( J^{-1} \tilde J \bar \Gamma s_1^T + \frac{1}{\gamma_2} J^{-1} \tilde J \dot {\hat J} \right) \\ &= -c_1 s_1^T + \left( s_1^T J^{-1} - \frac{1}{\gamma_1} \dot {\hat d}_\Gamma^T J^{-1} \right) \tilde d_\Gamma - tr \left[ J^{-1} \tilde J \left( \bar \Gamma s_1^T + \frac{1}{\gamma_2} \dot {\hat J} \right) \right] \\ &= -c_1 s_1^T + \left( s_1^T J^{-1} - \frac{1}{\gamma_1} \dot {\hat d}_\Gamma^T J^{-1} \right) \tilde d_\Gamma - \left( \bar \Gamma s_1^T + \frac{1}{\gamma_2} \dot {\hat J}\right) J^{-1} \tilde J \end{aligned}
V˙1=−c1s1Ts1+s1TJ−1J^Γˉ−γ11d~ΓTJ−1d^˙Γ−γ21tr(J~TJ−1J^˙)−s1TJ−1J~Γˉ=−c1s1Ts1+s1TJ−1J^Γˉ−γ11d^˙ΓTJ−1d~Γ−γ21tr(J−1J~J^˙)−tr(J−1J~Γˉs1T)=−c1s1T+(s1TJ−1−γ11d^˙ΓTJ−1)d~Γ−tr(J−1J~Γˉs1T+γ21J−1J~J^˙)=−c1s1T+(s1TJ−1−γ11d^˙ΓTJ−1)d~Γ−tr[J−1J~(Γˉs1T+γ21J^˙)]=−c1s1T+(s1TJ−1−γ11d^˙ΓTJ−1)d~Γ−(Γˉs1T+γ21J^˙)J−1J~再代入自适应律(6)
V
˙
1
=
−
c
1
s
1
T
+
(
s
1
T
J
−
1
−
1
γ
1
d
^
˙
Γ
T
J
−
1
)
d
~
Γ
−
(
Γ
ˉ
s
1
T
+
1
γ
2
J
^
˙
)
J
−
1
J
~
=
−
c
1
s
1
T
+
[
s
1
T
J
−
1
−
1
γ
1
(
γ
1
s
1
T
)
J
−
1
]
d
~
Γ
−
[
Γ
ˉ
s
1
T
−
1
γ
2
(
γ
2
Γ
ˉ
s
1
T
)
]
J
−
1
J
~
=
−
c
1
s
1
T
s
1
≤
0
\begin{aligned} \dot V_1 &= -c_1 s_1^T + \left( s_1^T J^{-1} - \frac{1}{\gamma_1} \dot {\hat d}_\Gamma^T J^{-1} \right) \tilde d_\Gamma - \left( \bar \Gamma s_1^T + \frac{1}{\gamma_2} \dot {\hat J}\right) J^{-1} \tilde J \\ &= -c_1 s_1^T + \left[ s_1^T J^{-1} - \frac{1}{\gamma_1} \left( \gamma_1 s_1^T \right) J^{-1} \right] \tilde d_\Gamma - \left[ \bar \Gamma s_1^T - \frac{1}{\gamma_2} \left( \gamma_2 \bar \Gamma s_1^T \right) \right] J^{-1} \tilde J \\ &= -c_1 s_1^T s_1 \leq 0 \end{aligned}
V˙1=−c1s1T+(s1TJ−1−γ11d^˙ΓTJ−1)d~Γ−(Γˉs1T+γ21J^˙)J−1J~=−c1s1T+[s1TJ−1−γ11(γ1s1T)J−1]d~Γ−[Γˉs1T−γ21(γ2Γˉs1T)]J−1J~=−c1s1Ts1≤0即满足李雅普诺夫稳定性。
4. 高度控制器
设计滑模面为
s
2
=
e
˙
z
+
λ
2
e
z
s_2 = \dot e_z + \lambda_2 e_z
s2=e˙z+λ2ez其中
e
z
=
z
−
z
d
e_z = z - z_d
ez=z−zd。
对其求导
s
˙
2
=
e
¨
z
+
λ
2
e
˙
z
=
z
¨
−
z
¨
d
+
λ
2
e
˙
z
\dot s_2 = \ddot e_z + \lambda_2 \dot e_z = \ddot z - \ddot z_d + \lambda_2 \dot e_z
s˙2=e¨z+λ2e˙z=z¨−z¨d+λ2e˙z
又因为
m
3
z
¨
1
=
U
1
cos
φ
cos
θ
−
m
0
g
+
f
(
z
)
−
C
0
z
˙
+
ρ
m_3 \ddot z _1 = U_1 \cos \varphi \cos \theta - m_0 g + f(z) - C_0 \dot z + \rho
m3z¨1=U1cosφcosθ−m0g+f(z)−C0z˙+ρ因此
z
¨
=
U
1
m
3
cos
φ
cos
θ
−
m
0
m
3
g
+
f
(
z
)
m
3
−
C
0
m
3
z
˙
+
ρ
m
3
\ddot z = \frac{U_1}{m_3} \cos \varphi \cos \theta - \frac{m_0}{m_3} g + \frac{f(z)}{m_3} - \frac{C_0}{m_3} \dot z + \frac{\rho}{m_3}
z¨=m3U1cosφcosθ−m3m0g+m3f(z)−m3C0z˙+m3ρ
因此,
s
˙
2
=
U
1
m
3
cos
φ
cos
θ
−
m
0
m
3
g
+
f
(
z
)
m
3
−
C
0
m
3
z
˙
+
ρ
m
3
−
z
¨
d
+
λ
2
e
˙
z
\dot s_2 = \frac{U_1}{m_3} \cos \varphi \cos \theta - \frac{m_0}{m_3} g + \frac{f(z)}{m_3} - \frac{C_0}{m_3} \dot z + \frac{\rho}{m_3} - \ddot z_d + \lambda_2 \dot e_z
s˙2=m3U1cosφcosθ−m3m0g+m3f(z)−m3C0z˙+m3ρ−z¨d+λ2e˙z
参考公式(0),可以设计控制量
U
1
U_1
U1为
U
1
=
m
^
3
L
+
m
0
g
−
f
(
z
)
+
C
0
z
˙
−
ρ
^
cos
φ
cos
θ
(12)
U_1 = \frac{ \hat m_3 L + m_0 g - f(z) + C_0 \dot z - \hat \rho}{\cos \varphi \cos \theta} \tag{12}
U1=cosφcosθm^3L+m0g−f(z)+C0z˙−ρ^(12)并且其中
L
=
−
τ
s
2
−
k
⋅
s
g
n
(
s
2
)
+
z
¨
d
−
λ
2
e
˙
z
(13)
L = -\tau s_2 - k \cdot sgn \left( s_2 \right) + \ddot z_d - \lambda_2 \dot e_z \tag{13}
L=−τs2−k⋅sgn(s2)+z¨d−λ2e˙z(13)
ρ
\rho
ρ为干扰。
设计自适应律
{
m
^
˙
3
=
−
k
1
L
s
2
ρ
^
˙
=
k
2
s
2
(14)
\begin{cases} \dot {\hat m}_3 = -k_1 Ls_2 \\ \dot {\hat \rho} = k_2 s_2 \tag{14} \end{cases}
{m^˙3=−k1Ls2ρ^˙=k2s2(14)
以及李雅普诺夫函数
V
2
=
1
2
s
2
2
+
1
2
m
3
k
1
m
~
3
2
+
1
2
m
3
k
2
ρ
~
2
(15)
V_2 = \frac{1}{2} s_2^2 + \frac{1}{2m_3 k_1} \tilde m_3^2 + \frac{1}{2m_3 k_2} \tilde \rho^2 \tag{15}
V2=21s22+2m3k11m~32+2m3k21ρ~2(15)求导有
V
˙
2
=
s
2
s
˙
2
+
1
m
3
k
1
m
~
3
m
~
˙
3
+
1
m
3
k
2
ρ
~
ρ
~
˙
(16)
\dot V_2 = s_2 \dot s_2 + \frac{1}{m_3 k_1} \tilde m_3 \dot {\tilde m}_3+\frac{1}{m_3 k_2} \tilde \rho \dot {\tilde \rho} \tag{16}
V˙2=s2s˙2+m3k11m~3m~˙3+m3k21ρ~ρ~˙(16)同样认为
m
3
,
ρ
m_3, \rho
m3,ρ变化缓慢,参考(10)有
m
~
˙
3
=
−
m
^
˙
3
,
ρ
~
˙
=
−
ρ
^
˙
(17)
\dot {\tilde m}_3 = -\dot {\hat m}_3, \quad \dot {\tilde \rho} = - \dot {\hat \rho} \tag{17}
m~˙3=−m^˙3,ρ~˙=−ρ^˙(17)那么有式(18)
V
˙
2
=
s
2
s
˙
2
+
1
m
3
k
1
m
~
3
m
~
˙
3
+
1
m
3
k
2
ρ
~
ρ
~
˙
=
s
2
(
U
1
m
3
cos
φ
cos
θ
−
m
0
m
3
g
+
f
(
z
)
m
3
−
C
0
m
3
z
˙
+
ρ
m
3
−
z
¨
d
+
λ
2
e
˙
z
)
−
1
m
3
k
1
m
~
3
m
^
˙
3
−
1
m
3
k
2
ρ
~
ρ
^
˙
\begin{aligned} \dot V_2 &= s_2 \dot s_2 + \frac{1}{m_3 k_1} \tilde m_3 \dot {\tilde m}_3+\frac{1}{m_3 k_2} \tilde \rho \dot {\tilde \rho} \\ &= s_2 \left( \frac{U_1}{m_3} \cos \varphi \cos \theta - \frac{m_0}{m_3} g + \frac{f(z)}{m_3} - \frac{C_0}{m_3} \dot z + \frac{\rho}{m_3} - \ddot z_d + \lambda_2 \dot e_z \right) - \frac{1}{m_3 k_1} \tilde m_3 \dot {\hat m}_3-\frac{1}{m_3 k_2} \tilde \rho \dot {\hat \rho} \end{aligned}
V˙2=s2s˙2+m3k11m~3m~˙3+m3k21ρ~ρ~˙=s2(m3U1cosφcosθ−m3m0g+m3f(z)−m3C0z˙+m3ρ−z¨d+λ2e˙z)−m3k11m~3m^˙3−m3k21ρ~ρ^˙再把式(12)
U
1
U_1
U1的表达式代入,并考虑自适应律(14)
V
˙
2
=
s
2
(
m
^
3
m
3
L
+
ρ
~
m
3
−
z
¨
d
+
λ
2
e
˙
z
)
+
1
m
3
k
1
m
~
3
k
1
L
s
2
−
1
m
3
k
2
ρ
~
k
2
s
2
=
ρ
~
m
3
s
2
−
z
¨
d
s
2
+
λ
2
s
2
e
˙
z
+
m
^
3
m
3
L
s
2
−
1
m
3
ρ
~
s
2
+
m
^
3
m
3
L
s
2
\begin{aligned} \dot V_2 &= s_2 \left( \frac{\hat m_3}{m_3} L + \frac{\tilde \rho}{m_3} - \ddot z_d + \lambda_2 \dot e_z \right) + \frac{1}{m_3 k_1} \tilde m_3 k_1 L s_2 - \frac{1}{m_3 k_2} \tilde \rho k_2 s_2 \\ &= \frac{\tilde \rho}{m_3} s_2 - \ddot z_d s_2 + \lambda_2 s_2 \dot e_z + \frac{\hat m_3}{m_3} L s_2 - \frac{1}{m_3} \tilde \rho s_2 + \frac{\hat m_3}{m_3} L s_2 \end{aligned}
V˙2=s2(m3m^3L+m3ρ~−z¨d+λ2e˙z)+m3k11m~3k1Ls2−m3k21ρ~k2s2=m3ρ~s2−z¨ds2+λ2s2e˙z+m3m^3Ls2−m31ρ~s2+m3m^3Ls2代入式(13)
V
˙
2
=
−
z
¨
d
s
2
+
λ
2
s
2
e
˙
z
+
s
2
(
−
τ
s
2
−
k
⋅
s
g
n
(
s
2
)
+
z
¨
d
−
λ
2
e
˙
z
)
=
−
z
¨
d
s
2
+
λ
2
s
2
e
˙
z
−
τ
s
2
2
−
k
∣
s
2
∣
+
s
2
z
¨
d
−
λ
2
s
2
e
˙
z
=
−
τ
s
2
2
−
k
∣
s
2
∣
≤
0
\begin{aligned} \dot V_2 &= - \ddot z_d s_2 + \lambda_2 s_2 \dot e_z + s_2 \left( -\tau s_2 - k \cdot sgn \left( s_2 \right) + \ddot z_d - \lambda_2 \dot e_z \right) \\ &= - \ddot z_d s_2 + \lambda_2 s_2 \dot e_z-\tau s_2^2 - k \lvert s_2 \rvert + s_2 \ddot z_d - \lambda_2 s_2 \dot e_z \\ &= -\tau s_2^2 - k \lvert s_2 \rvert \leq 0 \end{aligned}
V˙2=−z¨ds2+λ2s2e˙z+s2(−τs2−k⋅sgn(s2)+z¨d−λ2e˙z)=−z¨ds2+λ2s2e˙z−τs22−k∣s2∣+s2z¨d−λ2s2e˙z=−τs22−k∣s2∣≤0亦满足李雅普诺夫稳定性!
5. simulink仿真
搭建simulink框图如下
其中各个模块内部如下:
- s1模块
- s2模块
- J_hat, dgamma_hat模块
- dgamma模块
- m3_hat, rho_hat模块
- Attitude Control模块
- Altitude Control模块
- dot_eta2模块
- MathModel模块
6. 仿真结果
仿真结果如下。
- 姿态通道
- 高度通道
- 控制量
- 估计转动惯量
J
i
J_i
Ji与估计质量
m
^
3
\hat m_3
m^3
- 高度误差
- 估计扰动
d
Γ
d_\Gamma
dΓ
7. 结论
可以看出:
- 自适应滑模控制可以很好地控制四旋翼飞行稳定性。
- 该方法并不能很好估计扰动 d Γ d_\Gamma dΓ、总质量 m 3 m_3 m3、转动惯量 J i J_i Ji,估计值与真实值有较大差别。但是估计值均为有界值,且能维持飞行稳定。
- 由于控制量 U 1 U_1 U1表达式中的 L L L含有符号项 s g n sgn sgn,因此当调节过程末尾曲线趋于稳定时,真实值会在期望值附近上下摆动,引发 s g n sgn sgn符号在正负之间来回切换,该切换高频且振荡,因此 U 1 U_1 U1为一高频振荡的信号。这也是滑模控制的一个缺点,当实际硬件无法承受这种高频振荡时,往往会无法满足控制需求,进而引发硬件宕机或工作失稳。
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)