在刚体动力学里角速度和欧拉角的角速度之间相差一个矩阵的关系,这个关系是怎么转换过来的呢?不同的书似乎还有不同的解释。我们这里以 ZYX欧拉角来说明,其他类型的欧拉角以此类推。
0. 前置知识:ZYX欧拉角的表示
顾名思义,旋转的顺序是 Z → Y → X Z→Y→X Z→Y→X:
- 初始坐标系为 e ‾ ( 0 ) \underline{\boldsymbol{e}}^{(0)} e(0)坐标系
- 第一次变换: e ‾ ( 0 ) \underline{\boldsymbol{e}}^{(0)} e(0)坐标系绕 e ‾ ( 0 ) \underline{\boldsymbol{e}}^{(0)} e(0)坐标系的 Z Z Z轴 e Z ( 0 ) \boldsymbol{e}_{Z}^{(0)} eZ(0)旋转角度 α \alpha α到 e ‾ ( 1 ) \underline{\boldsymbol{e}}^{(1)} e(1)坐标系。
- 第二次变换: e ‾ ( 1 ) \underline{\boldsymbol{e}}^{(1)} e(1)坐标系绕 e ‾ ( 1 ) \underline{\boldsymbol{e}}^{(1)} e(1)坐标系的 Y Y Y轴 e Y ( 1 ) \boldsymbol{e}_{Y}^{(1)} eY(1)旋转角度 β \beta β到 e ‾ ( 2 ) \underline{\boldsymbol{e}}^{(2)} e(2)坐标系。
- 第三次变换: e ‾ ( 2 ) \underline{\boldsymbol{e}}^{(2)} e(2)坐标系绕 e ‾ ( 2 ) \underline{\boldsymbol{e}}^{(2)} e(2)坐标系的 X X X轴 e X ( 2 ) \boldsymbol{e}_{X}^{(2)} eX(2)旋转角度 γ \gamma γ到 e ‾ ( 3 ) \underline{\boldsymbol{e}}^{(3)} e(3)坐标系。
具体可以按照下面的图示来表示:
( O , e ‾ ( 0 ) ) ⟶ α e Z ( 0 ) , e Z ( 1 ) ( O , e ‾ ( 1 ) ) ⟶ β e Y ( 1 ) , e Y ( 2 ) ( O , e ‾ ( 2 ) ) ⟶ γ e X ( 2 ) , e X ( 3 ) ( O , e ‾ ( 3 ) ) \left(O, \underline{\boldsymbol{e}}^{(0)}\right) \underset{\boldsymbol{e}_{Z}^{(0)}, \boldsymbol{e}_{Z}^{(1)}}{\stackrel{\alpha}{\longrightarrow}}\left(O, \underline{\boldsymbol{e}}^{(1)}\right) \underset{\boldsymbol{e}_{Y}^{(1)}, \boldsymbol{e}_{Y}^{(2)}}{\stackrel{\beta}{\longrightarrow}}\left(O, \underline{\boldsymbol{e}}^{(2)}\right) \underset{\boldsymbol{e}_{X}^{(2)}, \boldsymbol{e}_{X}^{(3)}}{\stackrel{\gamma}{\longrightarrow}}\left(O, \underline{\boldsymbol{e}}^{(3)}\right) (O,e(0))eZ(0),eZ(1)⟶α(O,e(1))eY(1),eY(2)⟶β(O,e(2))eX(2),eX(3)⟶γ(O,e(3))
我们可以写出各个变换的旋转矩阵(后面对矩阵进行了简写,不写出具体绕什么轴旋转):
-
第一次变换:
R Z ( α ) = R e Z ( 0 ) ( α ) = [ cos ( α ) − sin ( α ) 0 sin ( α ) cos ( α ) 0 0 0 1 ] \mathbf{R}_Z(\alpha)=\mathbf{R}_{\boldsymbol{e}_{Z}^{(0)}}(\alpha)=\begin{bmatrix} \cos(\alpha) &-\sin(\alpha ) & 0\\ \sin(\alpha) &\cos(\alpha) & 0\\ 0 & 0 &1 \end{bmatrix} RZ(α)=ReZ(0)(α)= cos(α)sin(α)0−sin(α)cos(α)0001 -
第二次变换:
R Y ( β ) = R e Y ( 1 ) ( β ) = [ cos ( β ) 0 sin ( β ) 0 1 0 − sin ( β ) 0 cos ( β ) ] \mathbf{R}_Y(\beta)=\mathbf{R}_{\boldsymbol{e}_{Y}^{(1)}}(\beta)=\begin{bmatrix} \cos(\beta) &0 & \sin(\beta) \\ 0 & 1 & 0\\ -\sin(\beta) & 0 &\cos(\beta) \end{bmatrix} RY(β)=ReY(1)(β)= cos(β)0−sin(β)010sin(β)0cos(β) -
第三次变换:
R X ( γ ) = R e X ( 2 ) ( γ ) = [ 1 0 0 0 cos ( γ ) − sin ( γ ) 0 sin ( γ ) cos ( γ ) ] \mathbf{R}_X(\gamma)=\mathbf{R}_{\boldsymbol{e}_{X}^{(2)}}(\gamma)=\begin{bmatrix} 1 &0 & 0 \\ 0 & \cos(\gamma) & -\sin(\gamma)\\ 0 & \sin(\gamma) &\cos(\gamma) \end{bmatrix} RX(γ)=ReX(2)(γ)= 1000cos(γ)sin(γ)0−sin(γ)cos(γ)
由于每一次的旋转都是绕运动坐标系(物体坐标系),所以矩阵连乘符合右乘:
R Z Y X = R Z ( α ) R Y ( β ) R X ( γ ) = [ cos ( α ) cos ( β ) cos ( α ) sin ( β ) sin ( γ ) − cos ( γ ) sin ( α ) sin ( α ) sin ( γ ) + cos ( α ) cos ( γ ) sin ( β ) cos ( β ) sin ( α ) cos ( α ) cos ( γ ) + sin ( α ) sin ( β ) sin ( γ ) cos ( γ ) sin ( α ) sin ( β ) − cos ( α ) sin ( γ ) − sin ( β ) cos ( β ) sin ( γ ) cos ( β ) cos ( γ ) ] \mathbf{R}_{ZYX}=\mathbf{R}_Z(\alpha)\mathbf{R}_Y(\beta)\mathbf{R}_X(\gamma)=\left[\begin{array}{ccc} \cos \left(\alpha \right)\,\cos \left(\beta \right) & \cos \left(\alpha \right)\,\sin \left(\beta \right)\,\sin \left(\gamma \right)-\cos \left(\gamma \right)\,\sin \left(\alpha \right) & \sin \left(\alpha \right)\,\sin \left(\gamma \right)+\cos \left(\alpha \right)\,\cos \left(\gamma \right)\,\sin \left(\beta \right)\\ \cos \left(\beta \right)\,\sin \left(\alpha \right) & \cos \left(\alpha \right)\,\cos \left(\gamma \right)+\sin \left(\alpha \right)\,\sin \left(\beta \right)\,\sin \left(\gamma \right) & \cos \left(\gamma \right)\,\sin \left(\alpha \right)\,\sin \left(\beta \right)-\cos \left(\alpha \right)\,\sin \left(\gamma \right)\\ -\sin \left(\beta \right) & \cos \left(\beta \right)\,\sin \left(\gamma \right) & \cos \left(\beta \right)\,\cos \left(\gamma \right) \end{array}\right] RZYX=RZ(α)RY(β)RX(γ)= cos(α)cos(β)cos(β)sin(α)−sin(β)cos(α)sin(β)sin(γ)−cos(γ)sin(α)cos(α)cos(γ)+sin(α)sin(β)sin(γ)cos(β)sin(γ)sin(α)sin(γ)+cos(α)cos(γ)sin(β)cos(γ)sin(α)sin(β)−cos(α)sin(γ)cos(β)cos(γ)
对于角速度和欧拉角之间的关系,总共有两种不同的表示方式:
1. 角速度在最后一个坐标系下进行表示
在某些刚体动力学的表示中我们需要把角速度表示在当前的最后一个坐标系 e ‾ ( 3 ) \underline{\boldsymbol{e}}^{(3)} e(3),我们可以写出角速度的表示:
ω = ω x e X ( 3 ) + ω y e Y ( 3 ) + ω z e Z ( 3 ) \boldsymbol{\omega}=\omega_x\boldsymbol{e}_{X}^{(3)}+\omega_y\boldsymbol{e}_{Y}^{(3)}+\omega_z\boldsymbol{e}_{Z}^{(3)} ω=ωxeX(3)+ωyeY(3)+ωzeZ(3)
其中 e X ( 3 ) = [ 1 , 0 , 0 ] T , e Y ( 3 ) = [ 0 , 1 , 0 ] T , e Z ( 3 ) = [ 0 , 0 , 1 ] T \boldsymbol{e}_{X}^{(3)}=[1,0,0]^T, \boldsymbol{e}_{Y}^{(3)}=[0,1,0]^T, \boldsymbol{e}_{Z}^{(3)}=[0,0,1]^T eX(3)=[1,0,0]T,eY(3)=[0,1,0]T,eZ(3)=[0,0,1]T
在欧拉角导数的表示中又可以写作:
ω = α ˙ e Z ( 0 ) + β ˙ e Y ( 1 ) + γ ˙ e X ( 2 ) \boldsymbol{\omega}=\dot{\alpha}\boldsymbol{e}_{Z}^{(0)}+\dot{\beta}\boldsymbol{e}_{Y}^{(1)}+\dot{\gamma}\boldsymbol{e}_{X}^{(2)} ω=α˙eZ(0)+β˙eY(1)+γ˙eX(2)
好了现在我们可以把欧拉角导数的表示转换为角速度的表示了:
- e Z ( 3 ) → e Z ( 0 ) \boldsymbol{e}_{Z}^{(3)}\rightarrow\boldsymbol{e}_{Z}^{(0)} eZ(3)→eZ(0)
由于 e Z ( 0 ) \boldsymbol{e}_{Z}^{(0)} eZ(0)和 e Z ( 1 ) \boldsymbol{e}_{Z}^{(1)} eZ(1)一致,等效为从 e Z ( 3 ) \boldsymbol{e}_{Z}^{(3)} eZ(3)经过两次旋转得到 e Z ( 1 ) \boldsymbol{e}_{Z}^{(1)} eZ(1)(反着回去,先绕 X X X轴 e X ( 3 ) \boldsymbol{e}_{X}^{(3)} eX(3)旋转 − γ -\gamma −γ,再绕 Y Y Y轴 e Y ( 2 ) \boldsymbol{e}_{Y}^{(2)} eY(2)旋转 − β -\beta −β,依旧是使用右乘)
e Z ( 0 ) = e Z ( 1 ) = R X ( − γ ) R Y ( − β ) e Z ( 3 ) = ( − sin ( β ) cos ( β ) sin ( γ ) cos ( β ) cos ( γ ) ) \boldsymbol{e}_{Z}^{(0)}=\boldsymbol{e}_{Z}^{(1)}=\mathbf{R}_{X}(-\gamma)\mathbf{R}_{Y}(-\beta)\boldsymbol{e}_{Z}^{(3)}=\left(\begin{array}{c} -\sin \left(\beta \right)\\ \cos \left(\beta \right)\,\sin \left(\gamma \right)\\ \cos \left(\beta \right)\,\cos \left(\gamma \right) \end{array}\right) eZ(0)=eZ(1)=RX(−γ)RY(−β)eZ(3)= −sin(β)cos(β)sin(γ)cos(β)cos(γ)
- e Y ( 3 ) → e Y ( 1 ) \boldsymbol{e}_{Y}^{(3)}\rightarrow\boldsymbol{e}_{Y}^{(1)} eY(3)→eY(1)
由于 e Y ( 1 ) \boldsymbol{e}_{Y}^{(1)} eY(1)和 e Y ( 2 ) \boldsymbol{e}_{Y}^{(2)} eY(2)一致,等效为从 e Y ( 3 ) \boldsymbol{e}_{Y}^{(3)} eY(3)经过一次旋转得到 e Y ( 2 ) \boldsymbol{e}_{Y}^{(2)} eY(2)(反着回去,绕 X X X轴 e X ( 3 ) \boldsymbol{e}_{X}^{(3)} eX(3)旋转 − γ -\gamma −γ即可)
e Y ( 1 ) = e Y ( 2 ) = R X ( − γ ) e Y ( 3 ) = ( 0 cos ( γ ) − sin ( γ ) ) \boldsymbol{e}_{Y}^{(1)}=\boldsymbol{e}_{Y}^{(2)}=\mathbf{R}_{X}(-\gamma)\boldsymbol{e}_{Y}^{(3)}=\left(\begin{array}{c} 0\\ \cos \left(\gamma \right)\\ -\sin \left(\gamma \right) \end{array}\right) eY(1)=eY(2)=RX(−γ)eY(3)= 0cos(γ)−sin(γ)
- e X ( 3 ) → e X ( 2 ) \boldsymbol{e}_{X}^{(3)}\rightarrow\boldsymbol{e}_{X}^{(2)} eX(3)→eX(2)
由于 e X ( 2 ) \boldsymbol{e}_{X}^{(2)} eX(2)和 e X ( 3 ) \boldsymbol{e}_{X}^{(3)} eX(3)一致,不用进行旋转。
e
X
(
2
)
=
e
X
(
3
)
=
(
1
0
0
)
\boldsymbol{e}_{X}^{(2)}=\boldsymbol{e}_{X}^{(3)}=\left(\begin{array}{c} 1\\ 0\\ 0 \end{array}\right)
eX(2)=eX(3)=
100
于是我们有
ω = ω x e X ( 3 ) + ω y e Y ( 3 ) + ω z e Z ( 3 ) = ( ω x ω y ω z ) = α ˙ ( − sin ( β ) cos ( β ) sin ( γ ) cos ( β ) cos ( γ ) ) + β ˙ ( 0 cos ( γ ) − sin ( γ ) ) + γ ˙ ( 1 0 0 ) \begin{aligned}\boldsymbol{\omega}&=\omega_x\boldsymbol{e}_{X}^{(3)}+\omega_y\boldsymbol{e}_{Y}^{(3)}+\omega_z\boldsymbol{e}_{Z}^{(3)}=\left(\begin{array}{c} \omega_x\\ \omega_y\\ \omega_z \end{array}\right)\\ &=\dot{\alpha}\left(\begin{array}{c} -\sin \left(\beta \right)\\ \cos \left(\beta \right)\,\sin \left(\gamma \right)\\ \cos \left(\beta \right)\,\cos \left(\gamma \right) \end{array}\right)+\dot{\beta}\left(\begin{array}{c} 0\\ \cos \left(\gamma \right)\\ -\sin \left(\gamma \right) \end{array}\right)+\dot{\gamma}\left(\begin{array}{c} 1\\ 0\\ 0 \end{array}\right)\end{aligned} ω=ωxeX(3)+ωyeY(3)+ωzeZ(3)= ωxωyωz =α˙ −sin(β)cos(β)sin(γ)cos(β)cos(γ) +β˙ 0cos(γ)−sin(γ) +γ˙ 100
我们可以整理成矩阵的形式,就可以对角速度和欧拉角的导数之间进行转换:
( ω x ω y ω z ) = [ − sin ( β ) 0 1 cos ( β ) sin ( γ ) cos ( γ ) 0 cos ( β ) cos ( γ ) − sin ( γ ) 0 ] ( α ˙ β ˙ γ ˙ ) \left(\begin{array}{c} \omega_x\\ \omega_y\\ \omega_z \end{array}\right)=\begin{bmatrix}-\sin(\beta)&0 & 1\\ \cos(\beta)\sin(\gamma)&\cos(\gamma)&0\\ \cos(\beta)\cos(\gamma)&-\sin(\gamma)&0\end{bmatrix}\left(\begin{array}{c} \dot{\alpha}\\ \dot{\beta}\\ \dot{\gamma} \end{array}\right) ωxωyωz = −sin(β)cos(β)sin(γ)cos(β)cos(γ)0cos(γ)−sin(γ)100 α˙β˙γ˙
2. 角速度在第一个坐标系下进行表示
第一个坐标系我们一般认为是世界坐标系,也就是 e ‾ ( 0 ) \underline{\boldsymbol{e}}^{(0)} e(0),在这个坐标系下表示角速度也是最常见的。
ω = ω x e X ( 0 ) + ω y e Y ( 0 ) + ω z e Z ( 0 ) \boldsymbol{\omega}=\omega_x\boldsymbol{e}_{X}^{(0)}+\omega_y\boldsymbol{e}_{Y}^{(0)}+\omega_z\boldsymbol{e}_{Z}^{(0)} ω=ωxeX(0)+ωyeY(0)+ωzeZ(0)
其中 e X ( 0 ) = [ 1 , 0 , 0 ] T , e Y ( 0 ) = [ 0 , 1 , 0 ] T , e Z ( 0 ) = [ 0 , 0 , 1 ] T \boldsymbol{e}_{X}^{(0)}=[1,0,0]^T, \boldsymbol{e}_{Y}^{(0)}=[0,1,0]^T, \boldsymbol{e}_{Z}^{(0)}=[0,0,1]^T eX(0)=[1,0,0]T,eY(0)=[0,1,0]T,eZ(0)=[0,0,1]T
在欧拉角导数的表示中同样可以写作:
ω = α ˙ e Z ( 0 ) + β ˙ e Y ( 1 ) + γ ˙ e X ( 2 ) \boldsymbol{\omega}=\dot{\alpha}\boldsymbol{e}_{Z}^{(0)}+\dot{\beta}\boldsymbol{e}_{Y}^{(1)}+\dot{\gamma}\boldsymbol{e}_{X}^{(2)} ω=α˙eZ(0)+β˙eY(1)+γ˙eX(2)
好了现在我们可以把欧拉角导数的表示转换为角速度的表示了:
- e Z ( 0 ) → e Z ( 0 ) \boldsymbol{e}_{Z}^{(0)}\rightarrow\boldsymbol{e}_{Z}^{(0)} eZ(0)→eZ(0)
没有变化,于是
e Z ( 0 ) = ( 0 0 1 ) \boldsymbol{e}_{Z}^{(0)}=\left(\begin{array}{c} 0\\ 0\\ 1 \end{array}\right) eZ(0)= 001
- e Y ( 0 ) → e Y ( 1 ) \boldsymbol{e}_{Y}^{(0)}\rightarrow\boldsymbol{e}_{Y}^{(1)} eY(0)→eY(1)
经过一次旋转即可从 e Y ( 0 ) \boldsymbol{e}_{Y}^{(0)} eY(0)得到 e Y ( 1 ) \boldsymbol{e}_{Y}^{(1)} eY(1)(正向过去,绕 Z Z Z轴 e Z ( 0 ) \boldsymbol{e}_{Z}^{(0)} eZ(0)旋转 α \alpha α)
e Y ( 1 ) = R Z ( α ) e Y ( 0 ) = ( − sin ( α ) cos ( α ) 0 ) \boldsymbol{e}_{Y}^{(1)}=\mathbf{R}_{Z}(\alpha)\boldsymbol{e}_{Y}^{(0)}=\left(\begin{array}{c} -\sin \left(\alpha \right)\\ \cos \left(\alpha \right)\\ 0 \end{array}\right) eY(1)=RZ(α)eY(0)= −sin(α)cos(α)0
-
e
X
(
0
)
→
e
X
(
2
)
\boldsymbol{e}_{X}^{(0)}\rightarrow\boldsymbol{e}_{X}^{(2)}
eX(0)→eX(2)
经过两次旋转即可从 e X ( 0 ) \boldsymbol{e}_{X}^{(0)} eX(0)得到 e X ( 2 ) \boldsymbol{e}_{X}^{(2)} eX(2)(正向过去,先绕 Z Z Z轴 e Z ( 0 ) \boldsymbol{e}_{Z}^{(0)} eZ(0)旋转 α \alpha α,再绕 Y Y Y轴 e Y ( 1 ) \boldsymbol{e}_{Y}^{(1)} eY(1)旋转 β \beta β)
e X ( 2 ) = R Z ( α ) R Y ( β ) e X ( 0 ) = ( cos ( α ) cos ( β ) cos ( β ) sin ( α ) − sin ( β ) ) \boldsymbol{e}_{X}^{(2)}=\mathbf{R}_{Z}(\alpha)\mathbf{R}_{Y}(\beta)\boldsymbol{e}_{X}^{(0)}=\left(\begin{array}{c} \cos \left(\alpha \right)\,\cos \left(\beta \right)\\ \cos \left(\beta \right)\,\sin \left(\alpha \right)\\ -\sin \left(\beta \right) \end{array}\right) eX(2)=RZ(α)RY(β)eX(0)= cos(α)cos(β)cos(β)sin(α)−sin(β)
于是我们有
ω = ω x e X ( 0 ) + ω y e Y ( 0 ) + ω z e Z ( 0 ) = ( ω x ω y ω z ) = α ˙ ( 0 0 1 ) + β ˙ ( − sin ( α ) cos ( α ) 0 ) + γ ˙ ( cos ( α ) cos ( β ) cos ( β ) sin ( α ) − sin ( β ) ) \begin{aligned}\boldsymbol{\omega}&=\omega_x\boldsymbol{e}_{X}^{(0)}+\omega_y\boldsymbol{e}_{Y}^{(0)}+\omega_z\boldsymbol{e}_{Z}^{(0)}=\left(\begin{array}{c} \omega_x\\ \omega_y\\ \omega_z \end{array}\right)\\ &=\dot{\alpha}\left(\begin{array}{c} 0\\ 0\\ 1 \end{array}\right)+\dot{\beta}\left(\begin{array}{c} -\sin \left(\alpha \right)\\ \cos \left(\alpha \right)\\ 0 \end{array}\right)+\dot{\gamma}\left(\begin{array}{c} \cos \left(\alpha \right)\,\cos \left(\beta \right)\\ \cos \left(\beta \right)\,\sin \left(\alpha \right)\\ -\sin \left(\beta \right) \end{array}\right)\end{aligned} ω=ωxeX(0)+ωyeY(0)+ωzeZ(0)= ωxωyωz =α˙ 001 +β˙ −sin(α)cos(α)0 +γ˙ cos(α)cos(β)cos(β)sin(α)−sin(β)
我们可以整理成矩阵的形式,就可以对角速度和欧拉角的导数之间进行转换:
( ω x ω y ω z ) = [ 0 − sin ( α ) cos ( α ) cos ( β ) 0 cos ( α ) cos ( β ) sin ( α ) 1 0 − sin ( β ) ] ( α ˙ β ˙ γ ˙ ) \left(\begin{array}{c} \omega_x\\ \omega_y\\ \omega_z \end{array}\right)=\begin{bmatrix}0&-\sin(\alpha) & \cos(\alpha)\cos(\beta)\\ 0&\cos(\alpha)&\cos(\beta)\sin(\alpha)\\ 1&0&-\sin(\beta)\end{bmatrix}\left(\begin{array}{c} \dot{\alpha}\\ \dot{\beta}\\ \dot{\gamma} \end{array}\right) ωxωyωz = 001−sin(α)cos(α)0cos(α)cos(β)cos(β)sin(α)−sin(β) α˙β˙γ˙