三元欧拉角存在万向锁问题,不适用于所有情况下确定pose。因此利用四元数四个变量来代替 δ θ \delta\theta δθ的三个分量,可以在所有环境下确定姿态。
下面推导绕三个正交轴的角速度函数的四元数变化率微分方程。基于此能以t时刻的四元数计算t+ δ \delta δt时刻的四元数值。假定 cos α r , cos α p , cos α y \cos\alpha_{r}, \cos\alpha_{p},\cos\alpha_{y} cosαr,cosαp,cosαy为相对于roll轴,pitch轴,yaw轴的实际方向余弦,经过小角度旋转 δ θ b \delta\theta_{b} δθb,对应四元数 q ′ q' q′如下:
q 1 ′ = cos α r sin ( δ θ b / 2 ) q 2 ′ = cos α p sin ( δ θ b / 2 ) q 3 ′ = cos α y sin ( δ θ b / 2 ) q 4 ′ = cos ( δ θ b / 2 ) \begin{aligned} q'_1 &= \cos\alpha_r\sin(\delta\theta_b/2)\\ q'_2 &= \cos\alpha_p\sin(\delta\theta_b/2)\\ q'_3 &= \cos\alpha_y\sin(\delta\theta_b/2)\\ q'_4 &= \cos(\delta\theta_b/2) \end{aligned} q1′q2′q3′q4′=cosαrsin(δθb/2)=cosαpsin(δθb/2)=cosαysin(δθb/2)=cos(δθb/2)
其中旋转轴 n ⇀ = ( cos α r , cos α p , cos α y ) \overrightharpoon{n}=(\cos\alpha_{r}, \cos\alpha_{p}, \cos\alpha_{y}) n=(cosαr,cosαp,cosαy),旋转角为 δ θ b \delta\theta_{b} δθb
且该四元数为单位四元数。
q ( t + δ t ) = q ′ q ( t ) q(t+\delta t)=q'q(t) q(t+δt)=q′q(t)
将四元数 q ′ q' q′记为 q 1 ′ i ^ + q 2 ′ j ^ + q 3 ′ k ^ + q 4 ′ q'_{1}\hat{i}+q'_{2}\hat{j}+q'_{3}\hat{k}+q'_{4} q1′i^+q2′j^+q3′k^+q4′,四元数q(t)记为 q 1 i ^ + q 2 j ^ + q 3 k ^ + q 4 q_{1}\hat{i}+q_{2}\hat{j}+q_{3}\hat{k}+q_{4} q1i^+q2j^+q3k^+q4,二者相乘结果如下:
q ( t + δ t ) = ( q 1 ′ i ^ + q 2 ′ j ^ + q 3 ′ k ^ + q 4 ′ ) ( q 1 i ^ + q 2 j ^ + q 3 k ^ + q 4 ) = ( q 4 ′ q 1 + q 3 ′ q 2 − q 2 ′ q 3 + q 1 ′ q 4 ) i ^ + ( − q 3 ′ q 1 + q 4 ′ q 2 + q 1 ′ q 3 + q 2 ′ q 4 ) j ^ + ( q 2 ′ q 1 − q 1 ′ q 2 + q 4 ′ q 3 + q 3 ′ q 4 ) k ^ + ( − q 1 ′ q 1 − q 2 ′ q 2 − q 3 ′ q 3 + q 4 ′ q 4 ) \begin{aligned} q(t+\delta t) = &(q'_{1}\hat{i}+q'_{2}\hat{j}+q'_{3}\hat{k}+q'_{4})(q_{1}\hat{i}+q_{2}\hat{j}+q_{3}\hat{k}+q_{4})\\ =&(q'_{4}q_{1}+q'_{3}q_{2}-q'_{2}q_{3}+q'_{1}q_{4})\hat{i}+\\ &(-q'_{3}q_{1}+q'_{4}q_{2}+q'_{1}q_{3}+q'_{2}q_{4})\hat{j}+\\ &(q'_{2}q_{1}-q'_{1}q_{2}+q'_{4}q_{3}+q'_{3}q_{4})\hat{k}+\\ &(-q'_{1}q_{1}-q'_{2}q_{2}-q'_{3}q_{3}+q'_{4}q_{4}) \end{aligned} q(t+δt)==(q1′i^+q2′j^+q3′k^+q4′)(q1i^+q2j^+q3k^+q4)(q4′q1+q3′q2−q2′q3+q1′q4)i^+(−q3′q1+q4′q2+q1′q3+q2′q4)j^+(q2′q1−q1′q2+q4′q3+q3′q4)k^+(−q1′q1−q2′q2−q3′q3+q4′q4)
将上式由矩阵表示可以得到:
q ( t + δ t ) = [ q 4 ′ q 3 ′ − q 2 ′ q 1 ′ − q 3 ′ q 4 ′ q 1 ′ q 2 ′ q 2 ′ − q 1 ′ q 4 ′ q 3 ′ − q 1 ′ − q 2 ′ − q 3 ′ q 4 ′ ] [ q 1 q 2 q 3 q 4 ] \begin{aligned} q(t+\delta t)=\begin{bmatrix} q'_{4}& q'_{3}& -q'_{2}& q'_{1}\\ -q'_{3}& q'_{4}& q'_{1}& q'_{2} \\ q'_{2}& -q'_{1}& q'_{4}& q'_{3}\\ -q'_{1}& -q'_{2}& -q'_{3}& q'_{4} \end{bmatrix}\begin{bmatrix} q_{1} \\q_{2} \\q_{3} \\q_{4} \end{bmatrix} \end{aligned} q(t+δt)=⎣⎢⎢⎡q4′−q3′q2′−q1′q3′q4′−q1′−q2′−q2′q1′q4′−q3′q1′q2′q3′q4′⎦⎥⎥⎤⎣⎢⎢⎡q1q2q3q4⎦⎥⎥⎤
如果 ω ˉ b \bar{\omega}_{b} ωˉb是很小的时间增量 δ t \delta t δt内平均实际角速度,则分量 δ θ b t = ω ˉ b δ t \delta \theta_{bt}=\bar{\omega}_{b}\delta t δθbt=ωˉbδt且有:
sin ( δ θ b / 2 ) ≈ 1 2 ω ˉ b δ t cos ( δ θ b / 2 ) ≈ 1 \begin{aligned} \sin(\delta \theta_b/2)&\approx \frac{1}{2}\bar{\omega}_{b}\delta t \\ \cos(\delta \theta_b/2)&\approx 1 \end{aligned} sin(δθb/2)cos(δθb/2)≈21ωˉbδt≈1
由此,
q 1 ′ ≈ cos α r 1 2 ω ˉ b δ t q 2 ′ ≈ cos α p 1 2 ω ˉ b δ t q 3 ′ ≈ cos α y 1 2 ω ˉ b δ t q 4 ′ ≈ 1 \begin{aligned} q'_1 &\approx \cos\alpha_r\frac{1}{2}\bar{\omega}_{b}\delta t \\ q'_2 &\approx \cos\alpha_p\frac{1}{2}\bar{\omega}_{b}\delta t \\ q'_3 &\approx \cos\alpha_y\frac{1}{2}\bar{\omega}_{b}\delta t \\ q'_4 &\approx 1 \end{aligned} q1′q2′q3′q4′≈cosαr21ωˉbδt≈cosαp21ωˉbδt≈cosαy21ωˉbδt≈1
进而,
q ( t + δ t ) ≈ ( I + 1 2 Ω ˉ q δ t ) q ( t ) q(t+\delta t)\approx (\bold{I}+\frac{1}{2}\bar{\Omega}_q\delta t)q(t) q(t+δt)≈(I+21Ωˉqδt)q(t)
Ω ˉ q = [ 0 ω ˉ y b − ω ˉ p b ω ˉ r b − ω ˉ y b 0 ω ˉ r b ω ˉ p b ω ˉ p b − ω ˉ r b 0 ω ˉ y b − ω ˉ r b − ω ˉ p b − ω ˉ y b 0 ] \begin{aligned} \bar{\Omega}_q=\begin{bmatrix} 0& \bar{\omega}_{yb}& -\bar{\omega}_{pb}& \bar{\omega}_{rb}\\ -\bar{\omega}_{yb}& 0& \bar{\omega}_{rb}& \bar{\omega}_{pb}\\ \bar{\omega}_{pb}& -\bar{\omega}_{rb}& 0& \bar{\omega}_{yb}\\ -\bar{\omega}_{rb}& -\bar{\omega}_{pb}& -\bar{\omega}_{yb}& 0 \end{bmatrix} \end{aligned} Ωˉq=⎣⎢⎢⎡0−ωˉybωˉpb−ωˉrbωˉyb0−ωˉrb−ωˉpb−ωˉpbωˉrb0−ωˉybωˉrbωˉpbωˉyb0⎦⎥⎥⎤
其中 ω ˉ b = [ ω ˉ r b , ω ˉ p b , ω ˉ y b ] T \bar{\omega}_b = [\bar{\omega}_{rb}, \bar{\omega}_{pb}, \bar{\omega}_{yb}]^T ωˉb=[ωˉrb,ωˉpb,ωˉyb]T
ω ˉ r b = cos α r ω ˉ b ω ˉ p b = cos α p ω ˉ b ω ˉ y b = cos α y ω ˉ b \begin{aligned} \bar{\omega}_{rb} &= \cos\alpha_r\bar{\omega}_{b}\\ \bar{\omega}_{pb} &= \cos\alpha_p\bar{\omega}_{b}\\ \bar{\omega}_{yb} &= \cos\alpha_y\bar{\omega}_{b}\\ \end{aligned} ωˉrbωˉpbωˉyb=cosαrωˉb=cosαpωˉb=cosαyωˉb
进而,利用如下求导公式:
d q d t = lim δ t → 0 [ q ( t + δ t ) − q ( t ) δ t ] \frac{dq}{dt}=\lim_{\delta t \rightarrow 0}\lbrack{\frac{q(t+\delta t)-q(t)}{\delta t}}\rbrack dtdq=δt→0lim[δtq(t+δt)−q(t)]
由此,
d q d t = 1 2 Ω ˉ q q ( t ) \frac{dq}{dt}= \frac{1}{2}\bar{\Omega}_q q(t) dtdq=21Ωˉqq(t)
将 Ω ˉ q \bar{\Omega}_q Ωˉq利用 ω ˉ r b , ω ˉ p b , ω ˉ y b \bar{\omega}_{rb},\bar{\omega}_{pb}, \bar{\omega}_{yb} ωˉrb,ωˉpb,ωˉyb表示:
Ω ˉ q = [ − ⌊ ω ˉ b ⌋ × ω ˉ b − ω ˉ b T 0 ] \bar{\Omega }_{q}= \begin{bmatrix} -\left \lfloor \bar{\omega}_b \right \rfloor_{\times } & \bar{\omega}_b\\ -\bar{\omega}_b^{T}& 0 \end{bmatrix} Ωˉq=[−⌊ωˉb⌋×−ωˉbTωˉb0]
⌊ ω ˉ b ⌋ × = [ 0 − ω ˉ y b ω ˉ p b ω ˉ y b 0 − ω ˉ r b − ω ˉ p b ω ˉ r b 0 ] \left \lfloor \bar{\omega}_b \right \rfloor_{\times } = \begin{bmatrix} 0 & -\bar{\omega}_{yb} & \bar{\omega}_{pb}\\ \bar{\omega}_{yb} & 0 & -\bar{\omega}_{rb}\\ -\bar{\omega}_{pb} & \bar{\omega}_{rb} & 0\\ \end{bmatrix} ⌊ωˉb⌋×=⎣⎡0ωˉyb−ωˉpb−ωˉyb0ωˉrbωˉpb−ωˉrb0⎦⎤
ω ˉ b = [ ω ˉ r b ω ˉ p b ω ˉ y b ] \bar{\omega}_b = \begin{bmatrix} \bar{\omega}_{rb} \\ \bar{\omega}_{pb} \\ \bar{\omega}_{yb} \end{bmatrix} ωˉb=⎣⎡ωˉrbωˉpbωˉyb⎦⎤
将 Ω ˉ q \bar{\Omega}_q Ωˉq记为 Ω ( ω ) \Omega(\omega) Ω(ω), 将 ω ˉ r b , ω ˉ p b , ω ˉ y b \bar{\omega}_{rb},\bar{\omega}_{pb}, \bar{\omega}_{yb} ωˉrb,ωˉpb,ωˉyb分别记为 ω x , ω y , ω z {\omega}_{x},{\omega}_{y}, {\omega}_{z} ωx,ωy,ωz,则有:
Ω ( ω ) = [ − ⌊ ω ⌋ × ω − ω T 0 ] \Omega(\omega)= \begin{bmatrix} -\left \lfloor {\omega} \right \rfloor_{\times } & \omega\\ -\omega^{T}& 0 \end{bmatrix} Ω(ω)=[−⌊ω⌋×−ωTω0]
⌊ ω ⌋ × = [ 0 − ω z ω y ω z 0 − ω x − ω y ω x 0 ] \left \lfloor \omega \right \rfloor_{\times } = \begin{bmatrix} 0 & -\omega_{z} & \omega_{y}\\ \omega_{z} & 0 & -\omega_{x}\\ -\omega_{y} & \omega_{x} & 0\\ \end{bmatrix} ⌊ω⌋×=⎣⎡0ωz−ωy−ωz0ωxωy−ωx0⎦⎤
ω = [ ω x ω y ω z ] \omega = \begin{bmatrix} \omega_x \\ \omega_y \\ \omega_z \end{bmatrix} ω=⎣⎡ωxωyωz⎦⎤
带入此前四元数求导公式则有:
q ˙ ( t ) = 1 2 Ω ( ω ( t ) ) q ( t ) \dot{q}(t) = \frac{1}{2}\Omega (\omega (t))q(t) q˙(t)=21Ω(ω(t))q(t)
上述结论与VINS-Mono : A Robust and Versatile Monocular Visual-Inertial State Estimator文章中的公式(3)和(4)一致。
也与MSCKF1.0中用到的公式(6)四元数的导数一致。
证毕。