SLAM——Geometry

回顾一下SLAM中的几何基础。 ## 李群李代数(SO(3) &𝔰𝔬(3)\text{SO(3) } \& ~\mathfrak{so}(3)):

  • 李群李代数对应的都是三维矩阵,在SLAM中,李群SO(3) \text{SO(3) } 对应旋转矩阵(方向余弦阵,3×3 正交阵),而李代数𝔰𝔬(3)\mathfrak{so}(3)对应的为三维向量的反对称矩阵,只不过任何一个反对称矩阵都和一个三维向量是一一对应的,因此有时候也会直接用三维向量来指代𝔰𝔬(3)\mathfrak {so}(3)的元素。
  • 一般来说反对称矩阵与向量之间的转换用\wedge\vee运算符表示。有三维向量𝒘\mathbf w,则它与其对应的反对称矩阵𝑾\mathbf W转化关系为:

$$ \mathbf w^{\wedge}=\left[\begin{array}{l}w_ {1} \\w_ {2} \\w_ {3}\end{array}\right]^{^{\wedge}}=\left[\begin{array}{ccc}0 & -w_ {3} & w_ {2} \\w_ {3} & 0 & -w_ {1} \\-w_ {2} & w_ {1} & 0\end{array}\right]=\mathbf{W}\\\mathbf{W}^{\vee}=\mathbf w $$

关于反对称矩阵的一个性质:

𝒂𝒃=𝒃𝒂,𝒂,𝒃3 \mathbf{a}^{\wedge} \cdot \mathbf{b}=-\mathbf{b}^{\wedge} \cdot \mathbf{a}, \quad \forall \mathbf{a}, \mathbf{b} \in \mathbb R^{3}

  • 指数映射exp()\exp(\cdot)𝔰𝔬(3)\mathfrak{so}(3)映射到SO(3)\text{SO(3)}

exp(ϕ)=𝑰+sin(ϕ)ϕϕ+1cos(ϕ)ϕ2(ϕ)2 \exp \left(\vec{\phi}^{\wedge}\right)=\mathbf{I}+\frac{\sin (\|\vec{\phi}\|)}{\|\vec{\phi}\|} \vec{\phi}^{\wedge}+\frac{1-\cos (\|\vec{\phi}\|)}{\|\vec{\phi}\|^{2}}\left(\vec{\phi}^{\wedge}\right)^{2}

特别,当ϕ\phi很小的时,有一阶近似:

exp(ϕ)𝑰+ϕ \exp \left(\vec{\phi}^{\wedge}\right) \approx \mathbf{I}+\vec{\phi}^{\wedge}

  • 对数映射log()\log(\cdot)SO(3)\text{SO}(3)映射到𝔰𝔬(3)\mathfrak{so}(3)

log(𝑹)=φ(𝑹𝑹T)2sin(φ) \log (\mathbf{R})=\frac{\varphi \cdot\left(\mathbf{R}-\mathbf{R}^{T}\right)}{2 \sin (\varphi)}

其中:φ=cos1(tr(R)12)\varphi=\cos ^{-1}\left(\frac{\operatorname{tr}(R)-1}{2}\right)。有log(𝑹)=φ𝒂\log (\mathbf{R})^{\vee}=\varphi \cdot \mathbf{a},其中φ\varphi是旋转角,而𝒂\mathbf a为旋转轴的单位向量,且𝒂=(𝑹𝑹T2sin(φ))\mathbf{a}=\left(\frac{\mathbf{R}-\mathbf{R}^{T}}{2 \sin (\varphi)}\right)^{\vee}。因此,每一个旋转矩阵对应一个旋转向量。很奇妙的事情是一个旋转向量对应的旋转矩阵,也就是罗德里格斯公式求得的旋转矩阵(从几何关系上推导出来并不难),正是该旋转向量的反对称矩阵(𝔰𝔬(3))\left(\mathfrak{so}(3)\right)SO(3)\text{SO(3)}上的映射。

有意思的事情,任何一个三维向量实际上都可以看作是一个旋转向量(方向为旋转轴,而大小为旋转角度),因此任何一个三维向量都可以对应到一个旋转矩阵。但是不是所有的三维矩阵都是旋转矩阵,因此尽管三维向量与三维矩阵都是无穷多个,但是三维矩阵的个数就是比三维向量“多”,这个也是非常直观的,因为三维矩阵有9个变量,同时,旋转矩阵所在的这个空间实际上就“摊”满了三维向量的空间。

  • ϕ<π\left\Vert \vec{\phi}\right\Vert<\pi时(或者ϕ\left\Vert\vec{\phi} \right\Vert被限制在一个连续的2π2\pi范围内),指数映射与对数映射是双射,而ϕ\left\Vert\vec{\phi} \right\Vert也就是旋转角度φ\varphi
  • 从上面的内容可以得知,实际上任何一个旋转矩阵都和一个三维向量是对应的,因此为了方便,我们规定Exp()\text{Exp}(\cdot)3\mathbb R^3映射到SO(3)\text{SO(3)},而Log()\text{Log}(\cdot)SO(3)\text{SO(3)}映射到3\mathbb R^3,也就是:

Exp(ϕ)=exp(ϕ),Log(𝑹)=log(𝑹) \text{Exp}(\vec\phi) = \exp(\vec\phi^{\wedge}) , ~\text{Log}(\mathbf R) = \log^\vee(\mathbf R)

  • 对于ϕ\vec\phi以及一个微小量δϕ\delta\vec\phi,有:

Exp(ϕ+δϕ)Exp(ϕ)Exp(𝑱r(ϕ)δϕ)Log(Exp(ϕ)Exp(δϕ))=ϕ+𝑱r1(ϕ)δϕ \begin{array}{l}\operatorname{Exp}(\vec{\phi}+\delta \vec{\phi}) \approx \operatorname{Exp}(\vec{\phi}) \cdot \operatorname{Exp}\left(\mathbf{J}_ {r}(\vec{\phi}) \cdot \delta \vec{\phi}\right) \\\text{Log} (\operatorname{Exp}(\vec{\phi}) \cdot \operatorname{Exp}(\delta \vec{\phi}))=\vec{\phi}+\mathbf{J}_ {r}^{-1}(\vec{\phi}) \cdot \delta \vec{\phi}\end{array}

也就是三维向量上加一个微小量,对应了SO(3)\text{SO(3)}上乘一个Exp(𝑱r(ϕ)δϕ)\operatorname{Exp}\left(\mathbf{J}_ {r}(\vec{\phi}) \cdot \delta \vec{\phi}\right),而在SO(3)\text{SO(3)}上乘一个Exp(δϕ)\operatorname{Exp}(\delta \vec{\phi})也就对应了在3\mathbb R^3上加一个𝑱r1(ϕ)δϕ\mathbf{J}_ {r}^{-1}(\vec{\phi}) \cdot \delta \vec{\phi}。其中,𝑱r(ϕ)\mathbf{J}_ {r}(\vec{\phi}) 是属于SO(3)\text{SO(3)}空间的右Jacobian,有:

𝑱r(ϕ)=𝑰1cos(ϕ)ϕ2ϕ+ϕsin(ϕ)ϕ3(ϕ)2𝑱r1(ϕ)=𝑰+12ϕ+(1ϕ21+cos(ϕ)2ϕsin(ϕ))(ϕ)2 \begin{array}{l}\mathbf{J}_ {r}(\vec{\phi})=\mathbf{I}-\frac{1-\cos (\|\vec{\phi}\|)}{\|\vec{\phi}\|^{2}} \vec{\phi}^{\wedge}+\frac{\|\vec{\phi}\|-\sin (\|\vec{\phi}\|)}{\|\vec{\phi}\|^{3}}\left(\vec{\phi}^{\wedge}\right)^{2} \\\mathbf{J}_ {r}^{-1}(\vec{\phi})=\mathbf{I}+\frac{1}{2} \vec{\phi}^{\wedge}+\left(\frac{1}{\|\vec{\phi}\|^{2}}-\frac{1+\cos (\|\vec{\phi}\|)}{2 \cdot\|\vec{\phi}\| \cdot \sin (\|\vec{\phi}\|)}\right)\left(\vec{\phi}^{\wedge}\right)^{2}\end{array}

δϕ\delta\vec\phi很小时,有

$$ \mathbf{J}_ {r}(\delta\vec{\phi}) \approx\mathbf{J}^{-1}_ {r}(\delta\vec{\phi})\approx \mathbf I\\\operatorname{Exp}\left(\delta \vec{\phi}_ {i}\right) \approx \mathbf{I}+(\delta\vec\phi_i)^{\wedge} $$

  • 指数映射的伴随(Adjoint)性质:

𝑹Exp(ϕ)𝑹T=exp(𝑹ϕ𝑹T)=Exp(𝑹ϕ)Exp(ϕ)𝑹=𝑹Exp(𝑹Tϕ) \begin{array}{l}\mathbf{R} \cdot \operatorname{Exp}(\vec{\phi}) \cdot \mathbf{R}^{T}=\exp \left(\mathbf{R} \vec{\phi}^{\wedge} \mathbf{R}^{T}\right)=\operatorname{Exp}(\mathbf{R} \vec{\phi}) \\\Leftrightarrow \operatorname{Exp}(\vec{\phi}) \cdot \mathbf{R}=\mathbf{R} \cdot \operatorname{Exp}\left(\mathbf{R}^{T} \vec{\phi}\right)\end{array}

为了证明伴随性质,我们首先要知道一个前提:(𝑹ϕ)=𝑹ϕ𝑹T(\mathbf{R} \vec{\phi})^{\wedge}=\mathbf{R} \vec{\phi}^{\wedge} \mathbf{R}^{T}。令ϕ=θ𝒂\vec \phi = \theta \mathbf a,根据罗德里格斯公式,可得:

Exp(ϕ)=exp(ϕ)=exp(θ𝒂)=cosθ𝑰+(1cosθ)𝒂𝒂T+sinθ𝒂 \begin{array}{l}\operatorname{Exp}(\vec{\phi})=\exp \left(\vec{\phi}^{\wedge}\right)=\exp \left(\theta \mathbf{a}^{\wedge}\right) \\=\cos \theta \cdot \mathbf{I}+(1-\cos \theta) \mathbf{a} \mathbf{a}^{T}+\sin \theta \cdot \mathbf{a}^{\wedge}\end{array}

那么有(伴随性质第一行的证明):

𝑹Exp(ϕ)𝑹T=𝑹[cosθ𝑰+(1cosθ)𝒂𝒂T+sinθ𝒂]𝑹T=cosθ𝑹𝑹T+(1cosθ)𝑹𝒂𝒂T𝑹T+sinθ𝑹𝒂𝑹T=cosθ𝑰+(1cosθ)(𝑹𝒂)(𝑹𝒂)T+sinθ(𝑹𝒂)=exp(θ(𝑹𝒂))=exp((𝑹ϕ))=exp(𝑹ϕ𝑹T)=Exp(𝑹𝝓) \begin{array}{l}\mathbf{R} \cdot \operatorname{Exp}(\vec{\phi}) \cdot \mathbf{R}^{T} \\=\mathbf{R} \cdot\left[\cos \theta \cdot \mathbf{I}+(1-\cos \theta) \mathbf{a} \mathbf{a}^{T}+\sin \theta \cdot \mathbf{a}^{\wedge}\right] \cdot \mathbf{R}^{T} \\=\cos \theta \cdot \mathbf{R} \mathbf{R}^{T}+(1-\cos \theta) \cdot \mathbf{R a a}^{T} \mathbf{R}^{T}+\sin \theta \cdot \mathbf{R} \mathbf{a}^{\wedge} \mathbf{R}^{T} \\=\cos \theta \cdot \mathbf{I}+(1-\cos \theta) \cdot(\mathbf{R a}) \cdot(\mathbf{R} \mathbf{a})^{T}+\sin \theta \cdot(\mathbf{R} \mathbf{a})^{\wedge} \\=\exp \left(\theta(\mathbf{R} \mathbf{a})^{\wedge}\right)=\exp \left((\mathbf{R} \vec{\phi})^{\wedge}\right)\\=\exp \left(\mathbf{R} \vec{\phi}^{\wedge} \mathbf{R}^{T}\right)\\ = \text{Exp}(\mathbf{R\vec\phi})\end{array}

对于第二行:

𝑹Exp(ϕ)𝑹T=Exp(𝑹ϕ)𝑹TExp(ϕ)𝑹=Exp(𝑹Tϕ)Exp(ϕ)𝑹=𝑹Exp(𝑹Tϕ) \begin{aligned}&\mathbf{R} \cdot \operatorname{Exp}(\vec{\phi}) \cdot \mathbf{R}^{T}=\operatorname{Exp}(\mathbf{R} \vec{\phi})\\\Leftrightarrow&\mathbf{R}^T \cdot \operatorname{Exp}(\vec{\phi}) \cdot \mathbf{R}=\operatorname{Exp}(\mathbf{R}^T \vec{\phi})\\\Leftrightarrow&\operatorname{Exp}(\vec{\phi}) \cdot \mathbf{R}=\mathbf R\operatorname{Exp}(\mathbf{R}^T \vec{\phi})\end{aligned}