▌技术博客
← Back to Index

机器人学中的四元数

为什么要有四元数?

  • 欧拉角的死锁问题
  • 更加轻量、简洁的旋转表示方法

四元数的定义

引出:复数与旋转

  • 复数的构成:实部、虚部 $$ z = x + y i = \rho \cos \theta + i \cdot \rho \sin \theta := \rho e^{i\theta}. $$
  • 复数的几何含义:平面点 (x,y)(x,y) 或 (ρ,θ)(\rho,\theta)
  • 利用复数实现平面旋转: 将点 (ρ1,θ1)(\rho_1,\theta_1) (绕原点逆时针)旋转 α\alpha 角度,得到 (ρ2,θ2)(\rho_2,\theta_2),根据旋转矩阵,有[ρ2cos⁡θ2ρ2sin⁡θ2]=[cos⁡α−sin⁡αsin⁡αcos⁡α][ρ1cos⁡θ1ρ1sin⁡θ1]=[ρ1(cos⁡θ1cos⁡α−sin⁡θ1sin⁡α)ρ1(sin⁡θ1cos⁡α+cos⁡θ1sin⁡α)]=[ρ1cos⁡(θ1+α)ρ1sin⁡(θ1+α)]\begin{aligned} \begin{bmatrix} \rho_2 \cos \theta_2 \\ \rho_2 \sin \theta_2 \end{bmatrix} & = \begin{bmatrix} \cos \alpha & -\sin \alpha \\ \sin \alpha & \cos \alpha \end{bmatrix} \begin{bmatrix} \rho_1 \cos \theta_1 \\ \rho_1 \sin \theta_1 \end{bmatrix} \\ & = \begin{bmatrix} \rho_1 (\cos \theta_1 \cos \alpha - \sin \theta_1 \sin \alpha) \\ \rho_1 (\sin \theta_1 \cos \alpha + \cos \theta_1 \sin \alpha) \end{bmatrix} \\ & = \begin{bmatrix} \rho_1 \cos (\theta_1 + \alpha) \\ \rho_1 \sin (\theta_1 + \alpha) \end{bmatrix} \\ \end{aligned} 对应到指数运算,即为 ρ2eiθ2=ρ1eiθ2⋅eiα⏟rotation.\rho_2 e^{i \theta_2 } = \rho_1 e^{i \theta_2 } \cdot \underbrace{e^{i \alpha}}_{\text{rotation}}. 换言之:

对于以复数表示的坐标,乘上单位复数,能够表示旋转操作,转角为复数幅角。

引申:四元数及其基本性质

复数中,虚轴(i)(i)与实轴(w)(w)正交,且满足 i2=−1.i^2 = -1.

将二维平面扩展至四维空间,得到四条正交的轴:i,j,k,wi,j,k,w,其中ww是实轴,另三条均满足 $$ i^2 = j^2 = k^2 = -1. $$

由上述单位元组成的 h=w+xi+yj+zkh = w + xi +yj +zk 就被称为四元数。

  • 一些基本性质:
    • ij=k,  jk=i,ki=jij = k, \; jk = i, ki = j
    • 交换顺序则应变号
    • 单位元 i,j,ki,j,k 的乘法运算关系恰好与三维空间的内积相对应
  • 共轭四元数: h=w+xi+yj+zkh = w+xi+yj+zk 的共轭为 h∗=w−xi−yj−zkh^* = w-xi-yj-zk,且 (fh)∗=h∗f∗(fh)^* = h^* f^*
  • 模长: ∣h∣=h∗h=w2+x2+y2+z2|h| = \sqrt{h^* h} = \sqrt{w^2 + x^2+ y^2 +z^2},且 ∣fh∣=∣f∣∣h∣|fh| = |f||h|
  • 四元数的逆: $ h^{-1} = \dfrac{h^*}{|h|^2} $

© 2026 C.Yang · 京ICP备2026036959号-1 · v1.0.0