本专栏基于深蓝学院《多传感器融合定位》课程基础上进行拓展,对多传感器融合SLAM的学习过程进行记录
文章目录
第五章 基于图优化的建图方法
基于预积分的优化流程
优化问题分析
滤波与图优化是融合的两种方式,不改变原始信息的性质。优化问题可以等效为如下形式
min
x
{
Σ
∣
∣
r
L
(
L
k
k
+
1
,
X
)
∣
∣
2
(激光里程计约束)
+
Σ
∣
∣
r
B
(
B
k
k
+
1
,
X
)
∣
∣
2
(
I
M
U
约束)
+
Σ
∣
∣
r
G
(
G
k
,
X
)
∣
∣
2
(
R
T
K
约束)
}
\min_x \{ \Sigma||r_L(L_k^{k+1},X)||^2(激光里程计约束) + \Sigma||r_B(B_k^{k+1},X)||^2(IMU约束) + \Sigma||r_G(G_k,X)||^2(RTK约束)\}
xmin{Σ∣∣rL(Lkk+1,X)∣∣2(激光里程计约束)+Σ∣∣rB(Bkk+1,X)∣∣2(IMU约束)+Σ∣∣rG(Gk,X)∣∣2(RTK约束)}
三种约束分别通过以下方式获得:
- 激光里程计约束:使用激光里程计,计算每个关键帧的位姿,进而得到相对位姿
- IMU约束:在上一个关键帧位姿基础上,进行惯性积分,从而得到两关键帧的相对位姿
- RTK约束:直接测量得到
预积分的作用
问题:位姿每次优化后会发生变化,其后的IMU惯性积分就要重新进行,运算量过大
解决思路:直接计算两帧之间的相对位姿,而不依赖初始值影响,即所谓的预积分
作用:只提高效率,不提高精度;利用IMU的值形成帧间约束
预积分模型设计
预积分的均值
连续时间的IMU预积分
已知导航的微分方程如下(推导见第三章三维运动微分性质)
p
˙
w
b
t
=
v
t
w
v
˙
t
w
=
a
t
w
q
˙
w
b
t
=
q
w
b
t
⊗
[
0
1
2
ω
b
t
]
\dot p_{wb_t} = v_t^w \\ \dot v_t^w = a_t^w \\ \dot q_{wb_t} = q_{wb_t} \otimes \begin{bmatrix} 0 \\ \frac{1}{2}\omega^{b_t}\end{bmatrix}
p˙wbt=vtwv˙tw=atwq˙wbt=qwbt⊗[021ωbt]
根据该微分方程,可知从i时刻到j时刻的IMU积分结果为
位移
p
w
b
j
=
p
w
b
i
+
v
i
w
Δ
t
+
∫
∫
t
∈
[
i
,
j
]
(
q
w
b
t
a
b
t
−
g
w
)
δ
t
2
速度
v
j
w
=
v
i
w
+
∫
t
∈
[
i
,
j
]
(
q
w
b
t
a
b
t
−
g
w
)
δ
t
姿态
q
w
b
j
=
∫
t
∈
[
i
,
j
]
q
w
b
t
⊗
[
0
1
2
ω
b
t
]
δ
t
\begin{aligned} &位移 \ p_{wb_j} = p_{wb_i}+v_i^w\Delta t + \int \int _{t\in[i,j]} (q_{wb_t}a^{b_t}-g^w)\delta t^2\\ &速度 \ v_j^w = v_i^w + \int_{t\in[i,j]}(q_{wb_t}a^{b_t}-g^w)\delta t \\ &姿态\ q_{wb_j} = \int_{t\in[i,j]} q_{wb_t} \otimes \begin{bmatrix} 0 \\ \frac{1}{2}\omega^{b_t}\end{bmatrix} \delta t \end{aligned}
位移 pwbj=pwbi+viwΔt+∫∫t∈[i,j](qwbtabt−gw)δt2速度 vjw=viw+∫t∈[i,j](qwbtabt−gw)δt姿态 qwbj=∫t∈[i,j]qwbt⊗[021ωbt]δt
其中
a
b
t
(
真实值
)
=
a
^
t
(
观测值
)
−
b
a
t
(
零偏
)
−
n
a
(
随机游走
)
w
b
t
=
w
^
t
−
b
w
t
−
n
w
a^{b_t}(真实值) = \hat a_t(观测值) - b_{a_t}(零偏) - n_a(随机游走)\\ w^{b_t} = \hat w_t - b_{w_t} - n_w
abt(真实值)=a^t(观测值)−bat(零偏)−na(随机游走)wbt=w^t−bwt−nw
可以发现每个积分都依赖着上个时刻的全局位姿状态,如
q
w
b
t
q_{wb_t}
qwbt。根据预积分的要求,需要求相对结果,而且不依赖于上一时刻的位姿状态,因此需要对上式进行转换。由于
q
w
b
t
=
q
w
b
i
⊗
q
b
i
b
t
q_{wb_t} = q_{wb_i}\otimes q_{b_ib_t}
qwbt=qwbi⊗qbibt,将其带入上式可得预积分式:重要
p
w
b
j
=
p
w
b
i
+
v
i
w
Δ
t
−
1
2
g
w
Δ
t
2
+
q
w
b
i
⊗
∫
∫
t
∈
[
i
,
j
]
(
q
b
i
b
t
a
b
t
)
δ
t
2
=
p
w
b
i
+
v
i
w
Δ
t
−
1
2
g
w
Δ
t
2
+
q
w
b
i
⊗
α
b
i
b
j
v
j
w
=
v
i
w
−
g
w
Δ
t
+
q
w
b
i
⊗
∫
i
∈
[
i
,
j
]
(
q
b
i
b
t
a
b
t
)
δ
t
=
v
i
w
−
g
w
Δ
t
+
q
w
b
i
⊗
β
b
i
b
j
q
w
b
j
=
q
w
b
i
⊗
∫
t
∈
[
i
,
j
]
q
b
i
b
t
⊗
[
0
1
2
ω
b
t
]
δ
t
=
q
w
b
i
∫
t
∈
[
i
,
j
]
1
2
Ω
(
ω
⃗
b
t
)
q
b
i
b
t
δ
t
=
q
w
b
i
⊗
γ
b
i
b
j
\begin{aligned} & p_{wb_j} = p_{wb_i} + v_i^w\Delta t - \frac{1}{2} g^w\Delta t^2 + q_{wb_i}\otimes\int \int_{t\in[i,j]}(q_{b_ib_t}a^{b_t})\delta t^2 =p_{wb_i} + v_i^w\Delta t - \frac{1}{2} g^w\Delta t^2 + q_{wb_i}\otimes\alpha_{b_ib_j} \\ & v_j^w = v_i^w - g^w\Delta t + q_{wb_i}\otimes\int _{i\in[i,j]}(q_{b_ib_t}a^{b_t})\delta t = v_i^w - g^w\Delta t + q_{wb_i}\otimes \beta_{b_ib_j} \\ & q_{wb_j} = q_{wb_i}\otimes \int_{t\in[i,j]} q_{b_ib_t}\otimes \begin{bmatrix} 0 \\ \frac{1}{2}\omega^{b_t}\end{bmatrix} \delta t = q_{wb_i} \int_{t\in[i,j]} \frac{1}{2}\Omega(\vec \omega^{b_t})q_{b_ib_t} \delta t = q_{wb_i}\otimes \gamma_{b_ib_j} \end{aligned}
pwbj=pwbi+viwΔt−21gwΔt2+qwbi⊗∫∫t∈[i,j](qbibtabt)δt2=pwbi+viwΔt−21gwΔt2+qwbi⊗αbibjvjw=viw−gwΔt+qwbi⊗∫i∈[i,j](qbibtabt)δt=viw−gwΔt+qwbi⊗βbibjqwbj=qwbi⊗∫t∈[i,j]qbibt⊗[021ωbt]δt=qwbi∫t∈[i,j]21Ω(ωbt)qbibtδt=qwbi⊗γbibj
此时积分项就完全和i时刻的位姿状态无关了,即积分不会随着第i时刻的状态改变而改变(积分中的是相对量不会随着全局位姿的优化而改变)。再次整理公式,把积分项用符号做标记有
α
b
i
b
j
=
∫
∫
t
∈
[
i
,
j
]
(
q
b
i
b
t
a
b
t
)
δ
t
2
β
b
i
b
j
=
∫
i
∈
[
i
,
j
]
(
q
b
i
b
t
a
b
t
)
δ
t
γ
b
i
b
j
=
∫
t
∈
[
i
,
j
]
q
b
i
b
t
⊗
[
0
1
2
ω
b
t
]
δ
t
\alpha_{b_ib_j} = \int \int_{t\in[i,j]}(q_{b_ib_t}a^{b_t})\delta t^2 \\ \beta_{b_ib_j} = \int _{i\in[i,j]}(q_{b_ib_t}a^{b_t})\delta t \\ \gamma_{b_ib_j} = \int_{t\in[i,j]} q_{b_ib_t}\otimes \begin{bmatrix} 0 \\ \frac{1}{2}\omega^{b_t}\end{bmatrix} \delta t
αbibj=∫∫t∈[i,j](qbibtabt)δt2βbibj=∫i∈[i,j](qbibtabt)δtγbibj=∫t∈[i,j]qbibt⊗[021ωbt]δt
离散时间的IMU预积分递推式
实际使用中使用离散形式,而不是连续形式,在解算中一般采用中值积分方法,即
α
b
i
b
k
+
1
=
α
b
i
b
k
+
β
b
i
b
k
δ
t
+
1
2
a
δ
t
2
β
b
i
b
k
+
1
=
β
b
i
b
k
+
a
δ
t
γ
b
i
b
k
+
1
=
q
b
i
b
k
⊗
[
1
1
2
ω
b
t
]
ω
=
1
2
[
(
ω
b
k
−
b
k
g
)
+
(
ω
b
k
+
1
−
b
k
g
)
]
a
=
1
2
[
q
b
i
b
k
(
a
b
k
−
b
k
a
)
+
q
b
i
b
k
+
1
(
a
b
k
+
1
−
b
k
a
)
]
\alpha_{b_ib_{k+1}} = \alpha_{b_ib_k} + \beta_{b_ib_k}\delta t + \frac{1}{2} a\delta t^2 \\ \beta_{b_ib_{k+1}} = \beta_{b_ib_k} + a\delta t \\ \gamma_{b_ib_{k+1}} = q_{b_ib_k} \otimes \begin{bmatrix} 1 \\ \frac{1}{2}\omega^{b_t}\end{bmatrix} \\ \omega = \frac{1}{2}[(\omega^{b_k} - b_k^g) + (\omega^{b_{k+1}} - b_k^g)] \\ a = \frac{1}{2}[q_{b_ib_k}(a^{b_k} - b^a_k)+q_{b_ib_{k+1}}(a^{b_{k+1}} - b_k^a)]
αbibk+1=αbibk+βbibkδt+21aδt2βbibk+1=βbibk+aδtγbibk+1=qbibk⊗[121ωbt]ω=21[(ωbk−bkg)+(ωbk+1−bkg)]a=21[qbibk(abk−bka)+qbibk+1(abk+1−bka)]
经过以上推导,此时状态更新的公式可以整理为
[
p
w
b
j
v
j
w
q
w
b
j
b
j
a
b
j
g
]
=
[
p
w
b
i
+
v
i
w
Δ
t
−
1
2
g
w
Δ
t
2
+
q
w
b
i
α
b
i
b
j
v
i
w
−
g
w
Δ
t
+
q
w
b
i
β
b
i
b
j
q
w
b
i
⊗
γ
b
i
b
j
b
i
a
b
i
g
]
\begin{bmatrix} p_{wb_j} \\ v_j^w \\ q_{wb_j} \\ b_j^a \\ b_j^g \end{bmatrix} = \begin{bmatrix} p_{wb_i} + v_i^w\Delta t - \frac{1}{2}g^w\Delta t^2 + q_{wb_i}\alpha_{b_ib_j} \\ v_i^w - g^w\Delta t + q_{wb_i}\beta_{b_ib_j} \\ q_{wb_i}\otimes \gamma_{b_ib_j} \\ b_i^a \\ b_i^g\end{bmatrix}
pwbjvjwqwbjbjabjg
=
pwbi+viwΔt−21gwΔt2+qwbiαbibjviw−gwΔt+qwbiβbibjqwbi⊗γbibjbiabig
零偏Bias的递推式
需要注意的是,陀螺仪和加速度计的模型为
b
k
+
1
a
=
b
k
a
+
n
b
k
a
δ
t
b
k
+
1
g
=
b
k
g
+
n
b
k
g
δ
t
b_{k+1}^a = b_k^a + n_{b^a_k}\delta t \\ b_{k+1}^g = b_k^g + n_{b^g_k}\delta t
bk+1a=bka+nbkaδtbk+1g=bkg+nbkgδt
即认为bias是在变化的,这样有助于估计不同时刻的bias值,而不是整个系统运行时间内都当做常值对待。这更符合低精度mems的实际情况。但是在预积分时,有一两次相邻采样之间的时间较短,因此认为i和j时刻的bias相等。
需要注意的是,预积分的结果中包含了bias。在优化过程中,bias作为状态量也会发生变化,从而引起预积分结果变化。为了避免bias变化后重新做预积分,可以把预积分结果在bias处进行泰勒展开,表达成下面的形式。这样就可以根据bias的变化量直接算出新的预积分结果。
α
b
i
b
j
=
α
ˉ
b
i
b
j
+
J
b
i
a
a
δ
b
i
a
+
J
b
i
g
a
δ
b
i
g
β
b
i
b
j
=
β
ˉ
b
i
b
j
+
J
b
i
a
β
δ
b
i
a
+
J
b
i
g
β
δ
b
i
g
q
b
i
b
j
=
q
ˉ
b
i
b
j
⊗
[
0
1
2
J
b
i
g
q
δ
b
i
g
]
\alpha_{b_ib_j} = \bar \alpha_{b_ib_j} + J_{b_i^a}^a \delta b_i^a + J_{b_i^g}^a\delta b_i^g \\ \beta_{b_ib_j} = \bar \beta_{b_ib_j} + J_{b_i^a}^\beta \delta b_i^a + J_{b_i^g}^\beta \delta b_i^g \\ q_{b_ib_j} = \bar q_{b_ib_j} \otimes \begin{bmatrix} 0 \\ \frac{1}{2}J_{b_i^g}^q\delta b_i^g\end{bmatrix}
αbibj=αˉbibj+Jbiaaδbia+Jbigaδbigβbibj=βˉbibj+Jbiaβδbia+Jbigβδbigqbibj=qˉbibj⊗[021Jbigqδbig]
其中
J
b
i
a
a
=
∂
a
b
i
b
j
∂
δ
b
i
a
J
b
i
g
a
=
∂
a
b
i
b
j
∂
δ
b
i
g
J
b
i
a
β
=
∂
β
b
i
b
j
∂
δ
b
i
a
J
b
i
β
g
=
∂
β
b
i
b
j
∂
δ
b
i
g
J
b
i
g
q
=
∂
q
b
i
b
j
∂
δ
b
i
g
J_{b_i^a}^a = \frac{\partial a_{b_ib_j}}{\partial \delta b_i^a} \\ J_{b_i^g}^a = \frac{\partial a_{b_ib_j}}{\partial \delta b_i^g} \\ J_{b_i^a}^\beta = \frac{\partial \beta_{b_ib_j}}{\partial \delta b_i^a} \\ J_{b_i^\beta}^g = \frac{\partial \beta_{b_ib_j}}{\partial \delta b_i^g} \\ J_{b_i^g}^q = \frac{\partial q_{b_ib_j}}{\partial \delta b_i^g} \\
Jbiaa=∂δbia∂abibjJbiga=∂δbig∂abibjJbiaβ=∂δbia∂βbibjJbiβg=∂δbig∂βbibjJbigq=∂δbig∂qbibj
在预积分的协方差部分将得到
δ
x
k
+
1
=
F
⋅
δ
x
k
+
G
⋅
n
\delta x_{k+1} = F\cdot\delta x_{k}+G\cdot n
δxk+1=F⋅δxk+G⋅n 形式的式子,对上式改写为
x
k
+
1
=
f
(
x
k
)
x
k
+
1
+
δ
x
k
+
1
=
f
(
x
k
+
δ
x
k
)
x
k
+
1
+
δ
x
k
+
1
=
f
(
x
k
)
+
J
δ
x
k
δ
x
k
+
1
=
J
k
δ
x
k
x_{k+1} = f(x_k) \\ x_{k+1} + \delta x_{k+1} = f(x_k+\delta x_k) \\ x_{k+1} + \delta x_{k+1} = f(x_k) + J\delta x_k \\ \delta x_{k+1} = J_k\delta x_k\\
xk+1=f(xk)xk+1+δxk+1=f(xk+δxk)xk+1+δxk+1=f(xk)+Jδxkδxk+1=Jkδxk
事实上雅可比矩阵是
x
k
x_k
xk对自身
x
x
x 的导数,即
J
k
=
∂
x
k
∂
x
,
J
k
+
1
=
∂
x
k
+
1
∂
x
J_k = \frac{\partial x_{k}}{\partial x},J_{k+1} = \frac{\partial x_{k+1}}{\partial x}
Jk=∂x∂xk,Jk+1=∂x∂xk+1
上式和
δ
x
k
+
1
=
F
⋅
δ
x
k
+
G
⋅
n
\delta x_{k+1} = F\cdot\delta x_{k}+G\cdot n
δxk+1=F⋅δxk+G⋅n 合并同时忽略噪声项(与雅克比无关)将得到
F
=
∂
x
k
+
1
∂
x
k
F = \frac{\partial x_{k+1}} {\partial x_k}
F=∂xk∂xk+1
因此,可以得到
J
k
+
1
=
F
J
k
J_{k+1} = FJ_k
Jk+1=FJk
即可以通过k时刻的雅可比矩阵推导出k+1时刻的雅可比矩阵。算出来的雅可比矩阵是最终的预积分量对自身的雅可比矩阵。
预积分的协方差
-
误差卡尔曼滤波:预测值与观测值都是误差,协方差算的是误差的协方差。误差状态帮助IMU预积分计算协方差时避免四元数的过参数化问题以及旋转向量的周期性问题。
四元数是过参数化的,需要用4x4的矩阵来描述置信度;在误差卡尔曼滤波中,用旋转向量作为参数,这样就可以用3x3的协方差矩阵来衡量旋转的置信度;误差通常是很小的,接近0,这样就避免了旋转向量的周期性问题;误差量很小,可以忽略二阶导数的计算,只计算一阶导数更快;误差变化很慢,用卡尔曼滤波进行状态修正时,可以降低观测频率。
-
为什么要计算误差状态传递方程
我们想知道上一帧的误差是怎么传递到下一帧的,即想得到误差状态传递方程
δ i k + 1 = F k δ i k + G k n k \delta _{ik+1} = F_{k}\delta _{ik} +G_{k}n_{k} δik+1=Fkδik+Gknk
其中,状态量误差为 δ i k = [ δ p i k , δ v i k , δ θ i k ] \delta_{ik} = [\delta p_{ik}, \delta v_{ik},\delta \theta_{ik}] δik=[δpik,δvik,δθik],测量噪声为 n k = [ n k a , n k g ] n_k = [n_k^a, n_k^g] nk=[nka,nkg]。如果已知上面的误差状态传递方程,那么一段时间内的IMU预积分的协方差就可以计算为
P i , k + 1 = F k P i , k F k T + G k Q n G k T P_{i,k+1} = F_kP_{i,k}F_k^T +G_kQ_nG_k^T Pi,k+1=FkPi,kFkT+GkQnGkT
其中, Q n Q_n Qn是测量噪声的协方差矩阵。递推从i时刻开始, P i , k = 0 P_{i,k}=0 Pi,k=0因此需要计算误差状态传递方程。如果能够推导状态误差随时间变化的导数关系,如
δ x ˙ = A δ x + B n \delta \dot x = A\delta x +Bn δx˙=Aδx+Bn
则误差状态的传递方程为
δ x k + 1 ≈ δ x k + δ x ˙ k Δ t = ( I + A Δ t ) δ x k + B Δ t n k \delta x_{k+1} \approx \delta x_{k} +\delta \dot x_k\Delta t = (I +A\Delta t)\delta x_k +B\Delta t n_k δxk+1≈δxk+δx˙kΔt=(I+AΔt)δxk+BΔtnk
因此先计算 δ x \delta x δx 的导数。
连续时间的IMU误差状态传递
- 姿态误差方程
(1)写出不考虑误差的微分方程
q
˙
t
=
q
t
⊗
1
2
[
0
ω
t
−
b
w
~
t
]
\dot q_{t} = q_{t} \otimes \frac{1}{2} \begin{bmatrix}0 \\ \omega_{t} - b_{\tilde w_t} \end{bmatrix}
q˙t=qt⊗21[0ωt−bw~t]
(2)写出考虑误差的微分方程
q
~
t
˙
=
q
~
t
⊗
1
2
[
0
ω
~
t
−
b
~
w
t
]
\dot {\tilde q_{t}} = \tilde q_{t} \otimes \frac{1}{2} \begin{bmatrix}0 \\ \tilde \omega_{t} - \tilde b_{w_t}\end{bmatrix}
q~t˙=q~t⊗21[0ω~t−b~wt]
(3)写出带误差的值与理想值之间的关系
q
~
t
=
q
t
⊗
δ
q
ω
~
t
=
ω
t
−
n
w
b
~
w
t
=
b
w
t
+
δ
b
w
t
\tilde q_t = q_t \otimes \delta q \\ \tilde \omega_t = \omega_t- n_w \\ \tilde b_{w_t} = b_{w_t} + \delta b_{w_t}
q~t=qt⊗δqω~t=ωt−nwb~wt=bwt+δbwt
其中
n
w
n_w
nw为陀螺仪白噪声,
δ
q
=
[
c
o
s
(
∣
δ
θ
2
∣
)
δ
θ
∣
δ
θ
∣
s
i
n
(
∣
δ
θ
∣
2
)
]
≈
[
1
δ
θ
2
]
\delta q = \begin{bmatrix} cos(|\frac{\delta \theta}{2}|) \\ \frac{\delta \theta}{|\delta \theta|} sin(\frac{|\delta \theta|}{2}) \end{bmatrix} \approx \begin{bmatrix}1 \\ \frac{\delta \theta}{2}\end{bmatrix}
δq=[cos(∣2δθ∣)∣δθ∣δθsin(2∣δθ∣)]≈[12δθ]
δ
θ
\delta \theta
δθ是姿态误差对应的旋转矢量(失准角)。
(4)将(3)中的关系带入(2)
(
q
t
⊗
δ
q
)
=
1
2
q
t
⊗
δ
θ
⊗
[
0
ω
^
t
−
n
ω
−
b
ω
t
−
δ
b
ω
t
]
(q_t \otimes \delta q ) = \frac{1}{2} q_t\otimes \delta \theta \otimes \begin{bmatrix} 0 \\ \hat \omega_t - n_\omega - b_{\omega_t} -\delta b_{\omega_t}\end{bmatrix}
(qt⊗δq)=21qt⊗δθ⊗[0ω^t−nω−bωt−δbωt]
(5)将(1)中的关系带入(4)并化简得
δ
θ
˙
=
−
[
ω
^
t
−
b
ω
t
]
×
δ
θ
−
n
ω
−
δ
b
ω
t
\delta \dot \theta = -[\hat \omega_t - b_{\omega_t}]_\times \delta \theta - n _\omega -\delta b_{\omega t}
δθ˙=−[ω^t−bωt]×δθ−nω−δbωt
- 速度误差方程
(1)不考虑误差时的微分方程
v
˙
t
=
R
t
(
a
t
−
b
a
t
)
\dot v_t = R_t( a_t - b_{a_t})
v˙t=Rt(at−bat)
(2)考虑误差时的微分方程
v
~
t
˙
=
R
~
t
(
a
~
t
−
b
~
a
t
)
\dot{\tilde v_t} = \tilde R_t(\tilde a_t - \tilde b_{a_t})
v~t˙=R~t(a~t−b~at)
(3)真实值与理想值之间的关系
v
~
=
v
+
δ
v
R
~
t
=
R
t
e
x
p
(
[
δ
θ
]
×
)
≈
R
t
(
I
+
[
δ
θ
]
×
)
a
~
t
=
a
t
−
n
a
b
~
a
t
=
b
a
t
+
δ
b
a
t
\tilde v = v+\delta v \\ \tilde R_t = R_t exp([\delta \theta]_\times) \approx R_t(I+[\delta \theta]_\times)\\ \tilde a_t = a_t - n_a \\ \tilde b_{a_t} = b_{a_t} + \delta b_{a_t}
v~=v+δvR~t=Rtexp([δθ]×)≈Rt(I+[δθ]×)a~t=at−nab~at=bat+δbat
其中
n
a
n_a
na为加速度计白噪声。
(4)将(3)的关系带入(2)
v
˙
+
δ
v
˙
=
R
t
(
I
+
[
δ
θ
]
×
)
(
a
t
−
n
a
−
b
a
t
−
δ
b
a
t
)
\dot v + \delta \dot v = R_t(I+[\delta \theta]_\times)( a_t - n_a-b_{a_t}-\delta b_{a_t})
v˙+δv˙=Rt(I+[δθ]×)(at−na−bat−δbat)
(5)将(1)的关系带入(4)
R
t
(
a
t
−
b
a
t
)
+
δ
v
˙
=
R
t
(
I
+
[
δ
θ
]
×
)
(
a
t
−
n
a
−
b
a
t
−
δ
b
a
t
)
R_t( a_t-b_{a_t}) + \delta \dot v = R_t(I+[\delta \theta]_\times)( a_t - n_a-b_{a_t}-\delta b_{a_t})
Rt(at−bat)+δv˙=Rt(I+[δθ]×)(at−na−bat−δbat)
(6)化简方程,忽略二阶小量
δ
v
˙
=
−
R
t
[
a
^
t
−
b
a
t
]
×
δ
θ
−
R
t
(
n
a
−
δ
b
a
t
)
\delta \dot v = -R_t[\hat a_t - b_{a_t}]_\times \delta \theta - R_t(n_a - \delta b_{a_t})
δv˙=−Rt[a^t−bat]×δθ−Rt(na−δbat)
- 位置误差方程
(1)不考虑误差时的微分方程
p
˙
=
v
\dot p = v
p˙=v
(2)考虑误差时的微分方程
p
~
˙
=
v
~
\dot{\tilde p } = \tilde v
p~˙=v~
(3)真实值与理想值之间的关系
v
~
=
v
+
δ
v
p
~
=
p
+
δ
p
\tilde v = v + \delta v\\ \tilde p = p + \delta p
v~=v+δvp~=p+δp
(4)将(3)的关系带入(2)
p
˙
+
δ
p
˙
=
v
+
δ
v
\dot p + \delta \dot p = v+\delta v
p˙+δp˙=v+δv
(5)将(1)的关系带入(4)
v
+
δ
p
˙
=
v
+
δ
v
v+\delta \dot p = v + \delta v
v+δp˙=v+δv
(6)化简方程
δ
p
˙
=
δ
v
\delta \dot p = \delta v
δp˙=δv
- bias误差方程
在IMU精度较高时,bias可以认为是常值,即
δ
b
˙
a
t
=
0
δ
b
˙
ω
t
=
0
\delta \dot b_{a_t} = 0 \\ \delta \dot b_{\omega_t} = 0
δb˙at=0δb˙ωt=0
但自动驾驶和机器人领域所用的MEMS多数达不到这种精度,因为角速度随机游走和加速度的随机游走交到,因此误差方程常写为
δ
b
˙
a
t
=
n
b
a
δ
b
˙
ω
t
=
n
b
ω
\delta \dot b_{a_t} = n_{b_a}\\ \delta \dot b_{\omega_t} = n_{b\omega}
δb˙at=nbaδb˙ωt=nbω
其中
n
b
a
n_{b_a}
nba和
n
b
ω
n_{b_\omega}
nbω分别为加速度计和陀螺仪的随机游走对应的白噪声。
- 惯性导航误差分析总结
δ p ˙ = δ v δ v ˙ = − R t [ a ^ t − b a t ] × δ θ − R t ( n a + δ b a t ) δ θ ˙ = − [ ω ^ t − b ω t ] × δ θ − n ω − δ b ω t δ b ˙ a t = n b a δ b ˙ ω t = n b ω [ δ α ˙ t b k δ β ˙ t b k δ θ ˙ t b k δ b ˙ a t δ b ˙ w t ] 15 × 1 = [ 0 I 0 0 0 0 0 − R t b k [ a ^ t − b a t ] × − R t b k 0 0 0 − [ ω ^ t − b w t ] × 0 − I 0 0 0 0 0 0 0 0 0 0 ] 15 × 15 [ δ α t b k δ β t b k δ θ t b k δ b a t δ b w t ] + [ 0 0 0 0 − R t b k 0 0 0 0 − I 0 0 0 0 I 0 0 0 0 I ] 15 × 12 [ n a n w n b a n b w ] 12 × 1 = F t δ z t b k + G t n t \delta \dot p = \delta v \\ \delta \dot v = -R_t[\hat a_t - b_{a_t}]_\times \delta \theta - R_t(n_a + \delta b_{a_t})\\ \delta \dot \theta = -[\hat \omega_t - b_{\omega_t}]_\times \delta \theta - n _\omega -\delta b_{\omega t} \\ \delta \dot b_{a_t} = n_{b_a}\\ \delta \dot b_{\omega_t} = n_{b\omega}\\ \begin{bmatrix} \delta \dot \alpha_t^{b_k} \\ \delta \dot \beta_t^{b_k} \\ \delta \dot \theta_t^{b_k} \\ \delta \dot b_{a_t} \\ \delta \dot b_{w_t} \end{bmatrix}_{15\times 1} = \begin{bmatrix} 0 & I & 0& 0 & 0 \\ 0 & 0 & -R_t^{b_k}[\hat a_t - b_{a_t}]_\times & -R_t^{b_k} & 0 \\ 0 & 0 & -[\hat \omega_t - b_{w_t}]_\times & 0 & -I \\ 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 \end{bmatrix} _{15\times 15} \begin{bmatrix} \delta \alpha_t^{b_k} \\ \delta \beta_t^{b_k} \\ \delta \theta_t^{b_k} \\ \delta b_{a_t} \\ \delta b_{w_t} \end{bmatrix} + \begin{bmatrix} 0 & 0& 0 & 0 \\ -R_t^{b_k}& 0 & 0 & 0 \\ 0 & -I & 0 & 0 \\ 0 & 0 & I & 0 \\0 & 0 & 0 & I\end{bmatrix} _{15\times 12} \begin{bmatrix} n_a \\ n_w \\ n_{b_a} \\ n_{b_w} \end{bmatrix}_{12\times 1} \\ =F_t\delta z_t^{b_k} + G_tn_t δp˙=δvδv˙=−Rt[a^t−bat]×δθ−Rt(na+δbat)δθ˙=−[ω^t−bωt]×δθ−nω−δbωtδb˙at=nbaδb˙ωt=nbω δα˙tbkδβ˙tbkδθ˙tbkδb˙atδb˙wt 15×1= 00000I00000−Rtbk[a^t−bat]×−[ω^t−bwt]×000−Rtbk00000−I00 15×15 δαtbkδβtbkδθtbkδbatδbwt + 0−Rtbk00000−I00000I00000I 15×12 nanwnbanbw 12×1=Ftδztbk+Gtnt
基于中值积分的离散时间预积分误差协方差递推式
-
从 δ x k \delta x_k δxk到 δ x k + 1 \delta x_{k+1} δxk+1 :
δ x k + 1 = δ x k + δ x ˙ k Δ t = δ x k + ( F t δ x k + G t n t ) Δ t = ( I + F t Δ t ) δ x k + G t Δ t ⋅ n t = F δ x k + G n k \delta x_{k+1} = \delta x_k + \delta \dot x_k \Delta t = \delta x_k + (F_t\delta x_k+G_tn_t)\Delta t\\ =(I+F_t\Delta t)\delta x_k + G_t\Delta t\cdot n_t = F\delta x_k + Gn_k δxk+1=δxk+δx˙kΔt=δxk+(Ftδxk+Gtnt)Δt=(I+FtΔt)δxk+GtΔt⋅nt=Fδxk+Gnk
下面将推导离散时间预积分误差传递方程
[ δ α k + 1 δ θ k + 1 δ β k + 1 δ b a k + 1 δ b w k + 1 ] = [ I f 01 Δ t f 03 f 04 0 f 11 0 0 − Δ t 0 f 21 I f 23 f 24 0 0 0 I 0 0 0 0 0 I ] [ δ α k δ θ k δ β k δ b a k δ b w k ] + [ v 00 v 01 v 02 v 03 0 0 0 − Δ t 2 0 − Δ t 2 0 0 − R k Δ t 2 v 21 − R k + 1 Δ t 2 v 23 0 0 0 0 0 0 Δ t 0 0 0 0 0 0 Δ t ] [ n a k n w k n a k + 1 n w k + 1 n b a n b w ] \begin{bmatrix} \delta \alpha_{k+1} \\ \delta \theta_{k+1} \\ \delta \beta_{k+1} \\ \delta b_{a_{k+1}} \\ \delta b_{w_{k+1}} \end{bmatrix} = \\ \begin{bmatrix} I&f_{01}&\Delta t & f_{03} & f_{04} \\ 0& f_{11} & 0 & 0 & -\Delta t\\ 0 & f_{21}&I&f_{23} & f_{24} \\ 0&0&0&I&0 \\0&0&0&0&I \end{bmatrix} \begin{bmatrix} \delta \alpha_{k} \\ \delta \theta_{k} \\ \delta \beta_{k} \\ \delta b_{a_{k}} \\ \delta b_{w_{k}} \end{bmatrix}+ \begin{bmatrix} v_{00} & v_{01} &v_{02}&v_{03}&0&0 \\ 0 & \frac{-\Delta t}{2} & 0 & \frac{-\Delta t}{2} & 0 & 0\\\frac{-R_k\Delta t}{2} & v_{21} & \frac{-R_{k+1}\Delta t}{2} & v_{23} & 0 & 0 \\ 0 & 0& 0&0& \Delta t&0 \\ 0&0&0&0&0&\Delta t \end{bmatrix} \begin{bmatrix} n_{ak} \\ n_{wk}\\n_{a_{k+1}} \\ n_{w_{k+1}} \\ n_{b_a} \\ n_{b_w} \end{bmatrix} δαk+1δθk+1δβk+1δbak+1δbwk+1 = I0000f01f11f2100Δt0I00f030f23I0f04−Δtf240I δαkδθkδβkδbakδbwk + v0002−RkΔt00v012−Δtv2100v0202−Rk+1Δt00v032−Δtv2300000Δt00000Δt naknwknak+1nwk+1nbanbw
其中,
f 01 = Δ t 2 f 21 = − 1 4 R k ( a ^ k − b a k ) ∧ Δ t 2 − 1 4 R k + 1 ( a ^ k + 1 − b a k ) ∧ [ I − ( w ^ k + w ^ k + 1 2 − b a k ) ∧ Δ t ] Δ t 2 f 03 = − 1 4 ( R k + R k + 1 ) Δ t 2 f 04 = Δ t 2 f 24 = 1 4 R k + 1 ( a ^ k + 1 − b a k ) ∧ Δ t 3 f 11 = I − ( w ^ k + w ^ k + 1 2 − b w k ) ∧ Δ t f 21 = − 1 2 R k ( a ^ k − b a k ) ∧ Δ t − 1 2 R k + 1 ( a ^ k + 1 − b a k ) ∧ [ I − ( w ^ k + w ^ k + 1 2 − b w k ) ∧ Δ t ] Δ t f 23 = − 1 2 ( R k + R k + 1 ) Δ t f 24 = 1 2 R k + 1 ( a ^ k + 1 − b a k ) ∧ Δ t 2 v 00 = − 1 4 R k Δ t 2 v 01 = v 03 = Δ t 2 v 21 = Δ t 2 ⋅ 1 4 R k + 1 ( a ^ k + 1 − b a k ) ∧ Δ t 2 v 21 = v 23 = 1 4 R k + 1 ( a ^ k + 1 − b a k ) ∧ Δ t 2 v 02 = − 1 4 R k + 1 Δ t 2 \begin{aligned} & f_{01} =\frac{\Delta t}{2}f_{21} = -\frac{1}{4}R_k(\hat a_k - b_{ak})^\wedge \Delta t^2 - \frac{1}{4}R_{k+1}(\hat a_{k+1} - b_{ak})^\wedge [I-(\frac{\hat w_k + \hat w_{k+1}}{2}-b_ak)^\wedge \Delta t]\Delta t^2 \\ & f_{03} = -\frac{1}{4}(R_k+R_{k+1})\Delta t^2 \\ & f_{04} = \frac{\Delta t }{2} f_{24} = \frac{1}{4}R_{k+1} ( \hat a_{k+1} - b_{ak})^\wedge \Delta t^3 \\ & f_{11} = I - (\frac{\hat w_k + \hat w_{k+1}}{2} - b_{wk})^\wedge \Delta t \\ & f_{21} = -\frac{1}{2}R_k(\hat a_k-b_{ak})^\wedge \Delta t - \frac{1}{2}R_{k+1}(\hat a_{k+1} - b_{ak})^\wedge [I - (\frac{\hat w_k + \hat w_{k+1}}{2} - b_{wk})^\wedge \Delta t]\Delta t \\ & f_{23} = -\frac{1}{2} (R_k+R_{k+1})\Delta t \\ & f_{24} = \frac{1}{2}R_{k+1}(\hat a_{k+1} - b_{ak})^\wedge \Delta t^2\\ & v_{00} = -\frac{1}{4} R_k\Delta t^2 \\ & v_{01} = v_{03} = \frac{\Delta t}{2}v_{21} = \frac{\Delta t}{2} \cdot \frac{1}{4}R_{k+1}(\hat a_{k+1} -b_{ak})^\wedge \Delta t^2 \\ & v_{21} =v_{23}= \frac{1}{4}R_{k+1}(\hat a_{k+1} -b_{ak})^\wedge \Delta t^2 \\ &v_{02} = -\frac{1}{4}R_{k+1}\Delta t^2 \end{aligned} f01=2Δtf21=−41Rk(a^k−bak)∧Δt2−41Rk+1(a^k+1−bak)∧[I−(2w^k+w^k+1−bak)∧Δt]Δt2f03=−41(Rk+Rk+1)Δt2f04=2Δtf24=41Rk+1(a^k+1−bak)∧Δt3f11=I−(2w^k+w^k+1−bwk)∧Δtf21=−21Rk(a^k−bak)∧Δt−21Rk+1(a^k+1−bak)∧[I−(2w^k+w^k+1−bwk)∧Δt]Δtf23=−21(Rk+Rk+1)Δtf24=21Rk+1(a^k+1−bak)∧Δt2v00=−41RkΔt2v01=v03=2Δtv21=2Δt⋅41Rk+1(a^k+1−bak)∧Δt2v21=v23=41Rk+1(a^k+1−bak)∧Δt2v02=−41Rk+1Δt2
(1) δ θ k + 1 \delta \theta_{k+1} δθk+1的求解在连续时间下有
δ θ ˙ = − [ w ^ t − b w t ] × δ θ + n w − δ b w t \delta \dot \theta = -[\hat w_t-b_{wt}]_\times \delta \theta + n_{w} -\delta b_{wt} δθ˙=−[w^t−bwt]×δθ+nw−δbwt
则离散时间下,利用中值积分有
δ θ ˙ k = − [ w ^ k + w ^ k + 1 2 − b w k ] × δ θ k + n w k + n w k + 1 2 − δ b w k \delta \dot \theta_k = -[\frac{\hat w_{k}+\hat w_{k+1}}{2} - b_{w_k}]_\times \delta \theta_k + \frac{n_{w_k}+n_{w_{k+1}}}{2} - \delta b_{w_k} δθ˙k=−[2w^k+w^k+1−bwk]×δθk+2nwk+nwk+1−δbwk
根据 δ θ k + 1 = δ θ k + δ θ ˙ Δ t \delta \theta_{k+1} = \delta \theta_k + \delta \dot \theta \Delta t δθk+1=δθk+δθ˙Δt,有
δ θ k + 1 = [ I − [ w ^ k + w ^ k + 1 2 − b w k ] × Δ t ] δ θ k + Δ t n w k + n w k + 1 2 − Δ t δ b w k \delta \theta_{k+1} = [I - [\frac{\hat w_{k}+\hat w_{k+1}}{2} - b_{w_k}]_\times\Delta t]\delta \theta_k + \Delta t\frac{n_{w_k}+n_{w_{k+1}}}{2} - \Delta t \delta b_{w_k} δθk+1=[I−[2w^k+w^k+1−bwk]×Δt]δθk+Δt2nwk+nwk+1−Δtδbwk(2) δ β k + 1 \delta \beta_{k+1} δβk+1的求解
在连续时间下有
δ β ˙ = − R t [ a ^ t − b a t ] × δ θ + R t ( n a − δ b a t ) \delta \dot \beta = -R_t[\hat a_t -b_{a_t}]_\times \delta \theta + R_t(n_a-\delta b_{a_t}) δβ˙=−Rt[a^t−bat]×δθ+Rt(na−δbat)
则在离散时间下,利用中值积分有
δ β ˙ k = − 1 2 R k [ a k − b a k ] × δ θ k − 1 2 R k + 1 [ a k + 1 − b a k ] × δ θ k + 1 + 1 2 R k n a k + 1 2 R k + 1 n a k + 1 − 1 2 ( R k + R k + 1 ) δ b a k \delta \dot \beta_k = -\frac{1}{2} R_k[a_k - b_{a_k}]_\times \delta \theta_k - \frac{1}{2}R_{k+1}[a_{k+1}-b_{a_k}]_\times \delta \theta_{k+1} + \frac{1}{2}R_kn_{a_k} +\frac{1}{2}R_{k+1}n_{a_{k+1}}-\frac{1}{2}(R_k+R_{k+1})\delta b_{a_k} δβ˙k=−21Rk[ak−bak]×δθk−21Rk+1[ak+1−bak]×δθk+1+21Rknak+21Rk+1nak+1−21(Rk+Rk+1)δbak
将 δ θ k + 1 \delta \theta_{k+1} δθk+1带入上式并合并可得到
δ β ˙ k = − 1 2 [ R k [ a k − b a k ] × + R k + 1 [ a k + 1 − b a k ] × ( I − [ ( w ^ k + w ^ k + 1 2 − b w k ) × ] Δ t ) ] δ θ k − Δ t 4 R k + 1 [ a k + 1 − b a k ] × n w k − Δ t 4 R k + 1 [ a k + 1 − b a k ] × n w k + 1 + Δ t 2 R k + 1 [ a k + 1 − b a k ] × δ b w k + 1 2 R k n a k + 1 2 R k + 1 n a k + 1 − 1 2 ( R k + R k + 1 ) δ b a k \delta \dot \beta_k = -\frac{1}{2}[R_k[a_k-b_{ak}]_\times + R_{k+1}[a_{k+1}-b_{ak}]_\times (I-[(\frac{\hat w_k + \hat w_{k+1}}{2} - b_{wk})_\times]\Delta t)]\delta \theta_k - \frac{\Delta t}{4}R_{k+1}[a_{k+1}-b_{ak}]_\times n_{wk} \\ - \frac{\Delta t}{4}R_{k+1}[a_{k+1}-b_{ak}]_\times n_{wk+1} + \frac{\Delta t}{2}R_{k+1}[a_{k+1}-b_{ak}]_\times \delta b_{wk} +\frac{1}{2}R_kn_{ak} +\frac{1}{2}R_{k+1}n_{ak+1}-\frac{1}{2}(R_k+R_{k+1})\delta b_{ak} δβ˙k=−21[Rk[ak−bak]×+Rk+1[ak+1−bak]×(I−[(2w^k+w^k+1−bwk)×]Δt)]δθk−4ΔtRk+1[ak+1−bak]×nwk−4ΔtRk+1[ak+1−bak]×nwk+1+2ΔtRk+1[ak+1−bak]×δbwk+21Rknak+21Rk+1nak+1−21(Rk+Rk+1)δbak
根据 δ β k + 1 = β k + δ β ˙ Δ t \delta \beta_{k+1} = \beta_k + \delta \dot\beta \Delta t δβk+1=βk+δβ˙Δt,有
δ β k + 1 = δ β − { 1 2 R k ( a ^ k − b a k ) ∧ Δ t − 1 2 R k + 1 ( a ^ k + 1 − b a k ) ∧ [ I − ( w ^ k + w ^ k + 1 2 − b w k ) ∧ Δ t ] Δ t } δ θ k − 1 2 ( R k + R k + 1 ) Δ t δ b a k + 1 2 R k + 1 ( a ^ k + 1 − b a k ) ∧ Δ t 2 δ b w k − Δ t 2 4 R k + 1 [ a k + 1 − b a k ] × n w k − Δ t 2 4 R k + 1 [ a k + 1 − b a k ] × n w k + 1 + Δ t 2 R k n a k + Δ t 2 R k + 1 n a k + 1 \delta \beta_{k+1} = \delta \beta -\{\frac{1}{2}R_k(\hat a_k-b_{ak})^\wedge \Delta t - \frac{1}{2}R_{k+1}(\hat a_{k+1} - b_{ak})^\wedge [I - (\frac{\hat w_k + \hat w_{k+1}}{2} - b_{wk})^\wedge \Delta t]\Delta t\}\delta \theta_k \\ -\frac{1}{2} (R_k+R_{k+1})\Delta t \delta b_{ak} + \frac{1}{2}R_{k+1}(\hat a_{k+1} - b_{ak})^\wedge \Delta t^2 \delta b_{wk} - \frac{\Delta t^2}{4}R_{k+1}[a_{k+1}-b_{ak}]_\times n_{wk} \\ - \frac{\Delta t^2}{4}R_{k+1}[a_{k+1}-b_{ak}]_\times n_{wk+1} +\frac{\Delta t }{2}R_kn_{ak} +\frac{\Delta t}{2}R_{k+1}n_{ak+1} δβk+1=δβ−{21Rk(a^k−bak)∧Δt−21Rk+1(a^k+1−bak)∧[I−(2w^k+w^k+1−bwk)∧Δt]Δt}δθk−21(Rk+Rk+1)Δtδbak+21Rk+1(a^k+1−bak)∧Δt2δbwk−4Δt2Rk+1[ak+1−bak]×nwk−4Δt2Rk+1[ak+1−bak]×nwk+1+2ΔtRknak+2ΔtRk+1nak+1
(3) δ α k + 1 \delta \alpha_{k+1} δαk+1的求解由于连续时间下有 δ α ˙ t = δ β t \delta \dot \alpha_t = \delta\beta_t δα˙t=δβt,则在离散时间下有
δ α ˙ k = 1 2 δ β k + 1 2 δ β k + 1 \delta \dot \alpha_k = \frac{1}{2}\delta \beta_k + \frac{1}{2}\delta \beta_{k+1} δα˙k=21δβk+21δβk+1
将上面推出的 δ β k + 1 \delta \beta_{k+1} δβk+1 带入,并根据 δ α k + 1 = δ α k + δ α ˙ k Δ t \delta \alpha_{k+1} = \delta \alpha_k + \delta \dot \alpha_k \Delta t δαk+1=δαk+δα˙kΔt 即可计算出 δ α k + 1 \delta \alpha_{k+1} δαk+1 -
预积分协方差矩阵的传递
由上面可以得到
δ x k + 1 = F k ⋅ δ x k + G k ⋅ n k \delta x_{k+1} = F_k\cdot \delta x_k + G_k\cdot n_k δxk+1=Fk⋅δxk+Gk⋅nk
设 δ x \delta x δx服从高斯分布, n k ∼ N ( 0 , V k ) n_k\sim N(0,V_k) nk∼N(0,Vk),则 δ x k + 1 \delta x_{k+1} δxk+1的协方差为
P k + 1 = F k P k F k T + G k V k G k T P_{k+1} = F_kP_kF_k^T +G_kV_kG_k^T Pk+1=FkPkFkT+GkVkGkT