最近在看Joan Solà大神的《Quaternion Kinematics for the error-state Kalman filter》,在此对其中的一些知识点进行总结,纯属搬书。
1. 四元数的定义与基本性质
定义
Q=qw+qxi+qyj+qzk ∈H
Q=qw+qv=<qw,qv>=[qw,qx,qy,qz]T
- 实部为0的四元数为纯虚四元数,虚部全为0的四元数即为实数。
性质
Sum
p+q=[pw+qwpv+qv]
Product
p⊗q=[pwqw−pvTqvpwqv+qwpv+pv×qv]
product not commutative: p⊗q=q⊗p
但是associativie: (p⊗q)⊗r=p⊗(q⊗r)
distributive over the sum:
p⊗(q+r)=p⊗q+p⊗r(p+q)⊗r=p⊗r+q⊗r
product 可以转换为矩阵乘法:
q1⊗q2=[q1]Lq2=[q2]Rq1
[q]L=qwI+[0qv−qvT[qv]×][q]R=qwI+[0qv−qvT−[qv]×][p]R[q]L=[q]L[p]R
corss-product matrix, 叉乘也可以转换为矩阵相乘:
[a]×=0az−ay−az0axay−ax0a×b=[a]×b,∀a,b∈R3
Identity
q1=1=[10v]
Conjugate
q∗=qw−qv=[qw−qv]q∗⊗q=q⊗q∗=qw2+qx2+qy2+qz2(p⊗q)∗=q∗⊗p∗
Norm
∥q∥=q⊗q∗=q∗⊗q=qw2+qx2+qy2+qz2∈R∥p⊗q∥=∥q⊗p∥=∥p∥∥q∥
Inverse
q⊗q−1=q−1⊗q1=q1q−1=q∗/∥q∥
Unit quaternion
单位四元数的Inverse与Conjugate相同:
q−1=q∗q=[cosθusinθ].
我们用单位四元数来表示刚体旋转。
几条特殊性质
Quaternion commutator:
p⊗q−q⊗p=2pv×qvpv⊗qv−qv⊗pv=2pv⊗qv
Product of pure quaternions
pv⊗qv=−pvTqv+pv×qv=[−pvTqvpv×qv]对于纯四元数:qv⊗qv=−∥qv∥2
natural powers of pur quaternions, 用于推到指数函数的泰勒展开
v=uθv2=−θ2;v3=−uθ3;v4=θ4;v5=uθ5;v6=−θ6.
Exponential of pure quaternions,指数函数的泰勒展开:
ev=euθ=k=0∑∞k!1vk=(1−2!θ2+4!θ4+⋯)+(uθ−3!uθ3+5!uθ5+⋯)=cosθ+usinθ
纯虚四元数的指数函数为单位四元数。
Exponential of general quaternions:
eq=eqw+qv=eqweqv=eqw[cos∥qv∥∥qv∥qvsin∥qv∥]
Logarithm of unit quaternions
logq=log(cosθ+usinθ)+log(euθ)=uθ=[0uθ]u=qv/∥qv∥;θ=arctan2(∥qv∥,qw).
Logarithm of general quaternions:
log(q)=log(∥q∥∥q∥q)=log(∥q∥)+log(∥q∥q)=log(∥q∥)+uθ
Exponential forms of the type of qt : qt=exp(log(qt))=exp(t⋅log(q)) ,对于单位四元数:
qt=exp(t⋅uθ)=[costθusintθ]
2. 旋转的表达Rotations and Cross-relations
The rotation group SO(3),表达刚体旋转,需要满足三个性质:
- Rotation preserves the vertor norm
∥r(v)∥=∥v∥
- Rotation preserves the angles between vectors
<r(v),r(w)>=<v,w>=∥v∥∥w∥cosα
- Rotation preserves the relative orientations of vectors
u×v=w⇔r(u)×r(v)=r(w)
SO3定义:
SO(3):{r:R3→R3/∀v,w∈R3,∥r(v)∥=∥v∥,r(v)×r(w)=r(v×w)}
SO3的旋转矩阵表达
r(v)=Rv(Rv)T(Rv)=vTvRTR=I=RRT orthogonalR−1=RTdet(R)=1 special
R=e[v]×exp:so(3)→SO(3);[v]×→exp([v]×)
- The capitalized exponential map
Exp:R3→SO(3);v→Exp(v)=e[v]×
- Rotation matrix and rotation vector: the Rodrigues rotation formula
R=I+sinϕ[u]×+(1−cosϕ)[u]×2=Icosϕ+[u]×sinϕ+uuT(1−cosϕ).
log:SO(3)→so(3);R→log(R)=[uϕ]×;ϕ=arccos(2trace(R)−1),u=2sinϕ(R−RT)∨
- The capitalized logarithmic map
Log:SO(3)→R3;R→Log(R)=uϕLog(R)=log(R)∨
SO3(3)的Quaternion表达
q=eVexp:Hp→S3;V→exp(V)

- The capitalized exponential map
Exp:R3→S3;v=Exp(v)=ev/2q˙=21q⊗ωq=eωt/2
- Quaternion and rotation vector
q=Exp(ϕu)=exp(ϕu/2)=eϕu/2=cos(ϕ/2)+usin(ϕ/2)=[cos(ϕ/2)usin(ϕ/2)]
log:S3→Hp;q→log(q)=uθLog:S3→R3;q→Log(q)=uϕLog(q)=2log(q)ϕ=2arctan(∥qv∥,qw)u=qv/∥qv∥
- Rotation matrix and quaternion,偷懒上个图吧。

- Spherical linear interpolation (SLERP)
q(t)=q0⊗(q∗⊗q1)t=q0⊗[cos(tΔϕ/2)usin(tΔϕ/2)]R(t)=R0Exp(tLog(R0TR1))=R0(R0TR1)t
3. Quaternion conventions
Hamilton右手系,JPL左手系。

4. Perturbations, derivatives, and integrals.
The plus operator
S=R⊕θ=R∘Exp(θ) R,S∈SO(3),θ∈R3qs=qr⊕θ=qr⊗Exp(θ)Rs=RR⊕θ=RR⋅Exp(θ)
The minus operator
θ=S⊖R=Log(R−1S) R,S,θ∈R3θ=qs⊖qR=Log(qR∗⊗qs)θ=Rs⊖RR=Log(RRTRs)
- The four possible derivative definitions
Functions from vector space to vector space
∂x∂f(x)=δx→0limδxf(x+δx)−f(x)f(x+Δx)≈f(x)+∂xf(x)Δx
Functions from SO(3) to SO(3)
∂θ∂f(R)=δθ→0limδθf(R⊕δθ)⊖f(R)=δθ→0limδθLog(f−1(R)f(RExp(δθ))f(R⊕Δθ)≈f(R)Exp(∂θ∂f(R)Δθ)
Functions from vector space to SO(3)
∂x∂f(x)=δx→0limδxf(x+δx)⊖f(x)δx→0limδxLog(f−1(x)f(x+δx))f(x+Δx)≈f(x)Exp(∂x∂f(x)Δx)
Function from SO(3) to vector space
∂θ∂f(R)=δθ→0limδθf(R⊕δθ)−f(R)=δθ→0limδθf(RExp(δθ))−f(R)f(R⊕Δθ)≈f(R)+∂θ∂f(R)Δθ
- Useful and very useful Jacobians of the rotations.
Jacobian with respect to the vector
∂a∂(q⊗a⊗q∗)=∂aRa=R.
Jacobian with respect to the quaternion.
∂q∂(q⊗a⊗q∗)=2[ωa+v×a∣vTaI+vaT−avT−ω[a]×]∈R3.
Right jacobian of SO(3)
Jr=δθ→0limδθExp(θ+δθ)⊖Exp(θ)=δθ→0limδθLog(Exp(θ)TExp(θ+δθ)) if using R;=δθ→0limδθLog(Exp(θ)∗⊗Exp(θ+δθ)) if using q.
可用来做一阶泰勒展开
Exp(θ+δθ)≈Exp(θ)Exp(Jr(θ)δθ)Exp(θ)Exp(δθ)≈Exp(θ+Jr−1(θ)δθ)Log(Exp(θ)Exp(δθ))≈θ+Jr−1(θ)δθ
Jacobian with respect to the rotation vector
∂a∂(q⊗a⊗q∗)=∂a∂Ra=−R{θ}[a]×Jr(θ).
q˙=21Ω(ωL)q=21q⊗ωL; R˙=R[ωL]×.
- Time-intergration of rotation rate
Zeroth order intergration
Forward qn+1≈qn⊗q{ωnΔt}.
Backward qn+1≈qn⊗q{ωn+1Δt}.
Midward ωˉ=2ωn+1+ωn, qn+1≈qn⊗q{ωˉΔt}.
First order integration
qn+1≈qn⊗(q{ωˉΔt}+24Δt2[0ωn×ωn+1])