從一個坐標系到另一個坐標系的轉換有多種方法:歐拉角法、方向余弦矩陣法、四元數法等。
其中歐拉角法的核心思想是:一個坐標系可以用另一個參考坐標系的三次空間旋轉來表達。旋轉坐標系的方法又有兩種:
- Proper Euler angles, 第一次與第三次旋轉相同的坐標軸(z-x-z,x-y-x, y-z-y,z-y-z, x-z-x, y-x-y)。
- Tait–Bryan angles, 依次旋轉三個不同的坐標軸(x-y-z,y-z-x, z-x-y,x-z-y, z-y-x, y-x-z);
Tait–Bryan angles are 也叫作 Cardan angles; nautical angles; heading, elevation, and bank; or yaw, pitch, and roll. 有時候這兩種變換序列都叫做 "Euler angles". 這種情況下,前者叫做 proper or classic Euler angles.
對於每個旋轉序列,又有內在旋轉(intrinsic rotations)和外在旋轉(extrinsic rotations)兩種方式。設有兩個坐標系 \(OX_iY_iZ_i\) 和 \(OX_jY_jZ_j\) ,\(OX_iY_iZ_i\) 是固定不動的參考系,\(OX_jY_jZ_j\) 是需要被旋轉的坐標系,初始時兩個坐標系重合。內在旋轉指每次旋轉的旋轉軸都是上次變換后新系 \(OX_jY_jZ_j\) 的坐標軸,外在旋轉指每次旋轉的旋轉軸都是固定參考系 \(OX_iY_iZ_i\) 的坐標軸。
1. 轉動矩陣
1.1 方向余弦矩陣
設有兩個共原點的右手坐標系 \(OX_iY_iZ_i\) 和 \(OX_jY_jZ_j\) ,空間有一點 P,該點在 \(i, j\) 坐標系內的坐標分別為
P點從 \(j\) 系變換到 \(i\) 系的坐標變換關系為( \(j\) 坐標系下各坐標軸分量投影到 \(i\) 坐標軸的矢量和):
即為一般形式的轉動矩陣,也稱為從 \(j\) 系向 \(i\) 系變換的轉動矩陣。對 \(i\) 系來說,\([^iR_j]\) 描述了 \(j\) 系的姿態,故也稱其為姿態矩陣,又因 \([^iR_j]\) 內各元素皆為坐標軸之間的方向余弦,所以也可稱其為方向余弦矩陣,也可用 \([^iC_j]\) 表示。
當兩個坐標系無相對轉動時,\([^iR_j] = [I]\)
若取 \(j\) 系為參考系,則 P 點從 \(i\) 系到 \(j\) 系的坐標變換關系為:
轉動矩陣為正交陣
1.2 繞一個坐標軸旋轉的轉動矩陣
繞 \(X, Y, Z\) 坐標軸的旋轉變換矩陣是最基本的轉動矩陣,他們是一般轉動矩陣的特例,故可直接由一般轉動矩陣得到。
由式 \((1-3)\) 可得到繞 \(X\) 軸旋轉 \(\theta\) 角的轉動矩陣為:
上述三個特例,可用圖形直觀地推導出來,見
https://www.cnblogs.com/meteoric_cry/p/7987548.html
以 A 系為參考系,繞 z 軸旋轉 \(\theta\) 到 B 系
則 B 系坐標 PB 變換到 A 系為(轉動矩陣為正交陣,逆矩陣等於轉置矩陣):
以上轉動矩陣等於 \((1-8)\) ,推導結束。繞 x, y 軸同理。
1.3 繞兩個坐標軸旋轉的轉動矩陣
1.3.1 內在旋轉
設坐標系 \(OX_iY_iZ_i\) 先繞 \(Z_i\) 旋轉 \(\theta\) 角形成坐標系 \(OX_mY_mZ_m\),再繞 \(X_m\) 軸旋轉 \(\alpha\) 角,形成坐標系 \(OX_jY_jZ_j\) ,如上圖
依照定義,上述旋轉的旋轉軸是前次變換后新系的軸,因此是內在旋轉。可見,內在旋轉要將繞各軸的旋轉矩陣從左至右連乘。
此時的旋轉矩陣為:
1.3.2 外在旋轉
設坐標系 \(OX_iY_iZ_i\) 先繞 \(X_i\) 軸旋轉 \(\alpha\) 角形成坐標系 \(OX_mY_mZ_m\),再繞 \(Z_i\) 旋轉 \(\theta\) 角,形成坐標系 \(OX_jY_jZ_j\) ,對於外在旋轉,利用點變換推導更直觀。 \(i\) 系變換到 \(j\) 系,等效於 \(i\) 系下點 \([r]_i\) 按坐標系變換的逆變換,即先繞 \(Z_i\) 旋轉 \(-\theta\) (旋轉 \(\theta\) 的逆變換),再繞 \(X_i\) 旋轉 \(-\alpha\) ,因為參考系始終是 \(i\) 系,因此矩陣從右至左連乘
可知,外在旋轉要將繞各軸的旋轉矩陣從右至左連乘,對比 \((1-11)\) 有,外在旋轉等效於內在旋轉的旋轉序列倒序。
1.4 繞三個坐標軸旋轉的轉動矩陣
機器人學中多采用歐拉角(Euler)旋轉,依照上節結論,內在旋轉,轉動矩陣右乘;外在旋轉,轉動矩陣左乘;內在旋轉與外在旋轉的繞軸旋轉序列倒序時,兩者等效。
外在旋轉, \(i\) 系, \(j\) 系初始時重合, \(j\) 系繞固定參考系 \(i\) 系坐標軸旋轉,先繞 \(X\) 軸旋轉 \(\phi\) ,然后繞 \(Y\) 軸旋轉 \(\theta\) ,最后繞 \(Z\) 軸旋轉 \(\psi\) 。
內在旋轉, \(i\) 系, \(j\) 系初始時重合, \(j\) 系繞自身坐標軸旋轉,先繞 \(Z\) 軸旋轉 \(\psi\) ,然后繞 \(Y\) 軸旋轉 \(\theta\) ,最后繞 \(X\) 軸旋轉 \(\phi\) 。
以上兩種旋轉方式簡記做:x-y-z (extrinsic rotations),z-y′-x″ (intrinsic rotations),他們的旋轉矩陣為( \(c\theta\) is shorthand for \(cos\theta\) , \(s\theta\) is shorthand for \(sin\theta\) , and so on.)
內旋序列 z-y′-x″ ,\(\psi\) 稱偏航角 yaw,\(\theta\) 稱俯仰角 pitch,\(\phi\) 稱橫滾角 roll,\(\psi, \phi\) 的取值范圍 \(2\pi\) ,\(\theta\) 的取值范圍 \(\pi\)。
下面左圖不是右手系, z 軸應朝下。
yaw, pitch, roll 的定義只在該內旋序列下才有效,且飛行器初始位置必須為參考系,附 wiki 原文如下:
These angles are normally taken as one in the external reference frame (heading, bearing), one in the intrinsic moving frame (bank) and one in a middle frame, representing an elevation or inclination respect the horizontal plane, which is equivalent to the line of nodes for this purpose.
For an aircraft, they can be obtained with three rotations around its principal axes if done in the proper order. A yaw will obtain the bearing, a pitch will yield the elevation and a roll gives the bank angle. Therefore, in aerospace they are sometimes called yaw, pitch and roll. Notice that this will not work if the rotations are applied in any other order or if the airplane axes start in any position non-equivalent to the reference frame.
Tait–Bryan angles, following z-y′-x″ (intrinsic rotations) convention, are also known as nautical angles, because they can be used to describe the orientation of a ship or aircraft, or Cardan angles, after the Italian mathematician and physicist Gerolamo Cardano, who first described in detail the Cardan suspension and the Cardan joint.
(https://en.wikipedia.org/wiki/Euler_angles#Conventions_2)
旋轉序列不同,轉動矩陣有不同的表達式,見
https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix
1.5 Euler angles and Tait-Bryan angles
Proper Euler angles 圖示。xyz 固定參考系用藍色顯示,XYZ 旋轉系用紅色顯示,The line of nodes (N) 用綠色顯示。旋轉序列為 z-x'-z'',內旋。
Tait-Bryan angles 圖示。 z-y'-x'' 序列,內旋,N 對齊 y‘ 。旋轉角序列為 \(\psi, \theta, \phi\),注意該情況 \(\psi > 90 ^{\circ}\) ,\(\theta < 0\) 。
兩者的不同在於 line of nodes 幾何作圖的不同,line of nodes 指初始旋轉平面與最終旋轉平面的交叉線。Proper Euler angles Euler angles 首尾兩次旋轉同一個軸,所以相交叉的平面在初始時一致(xy and XY),Tait-Bryan angles 首尾兩次旋轉不同的軸,所以相交叉的平面在初始時垂直(xy and YZ)。
(https://en.wikipedia.org/wiki/Euler_angles)
未完待續...