智能机器人导论第二讲 空间表示与变换
文章目录
2.1 坐标系
- 大地坐标系
大地坐标系是以大地地面为基准的坐标系,将机器人正常安装的情况下,机器人的大地坐标系与基坐标系一致,都依据机器人安装底座为原点。调试的过程中,有三种情况机器人的大地坐标系与基坐标系不一致:- 机器人侧面安装,基坐标系垂直于大地坐标系
- 机器人倒装,基坐标系与大地坐标系z轴相反
- 带有外部行走轴,基坐标随机器人运动
- 基坐标系
依据机器人安装底座标定的坐标系,基坐标系的确立便于记录机器人各轴运动位置的改变。在有些国产机器人系统中的有“一键回零”操作就是依据基座设定。 - 关节坐标系
是设定在机器人关节中的坐标系,它是每个轴相对其原点位置的绝对角度 - 工具坐标系
用来确定工具位姿,由工具中心点(TCP, tool center point)与坐标方位组成。
工具坐标系必须事先进行设定,在没有定义时,由默认工具坐标系来替代。根据机器人所携带的执行工具不同而改变,常将工业机器人默认的法兰中心点设置为所持工件的执行点。 - 工件坐标系
用来确定工件位姿,由工件原点与坐标方位组成。工件坐标系可采用三点法确定:点x1与点x2连线组成x轴,通过点y1向x轴作的垂直线为y轴,z轴方向以右手定则确定。在调试工业机器人的过程中,可根据需求依据工件的特征建立工件坐标系,保存用户数据后,即使加工的平台发生改变了,调整坐标系参数,原编程程序仍然可以使用。 - 用户坐标系
是用户对每个作业空间进行自定义的直角坐标系,它用于位置寄存器的示教和执行、位置补偿指令的执行等。在没有定义时,将由大地坐标系来替代该坐标系。
2.2 矩阵表示
位置向量
假设坐标系A(记作{A}
)中有一点p,在缩放因子的值为w
(w通常为1)下,三个轴的值分别为$p_x$
、$p_y$
、$p_z$
。可以表示成:
A
P
=
[
p
x
p
y
p
z
w
]
^AP = \begin{bmatrix}p_x\\p_y\\p_z\\w\end{bmatrix}
AP=⎣⎢⎢⎡pxpypzw⎦⎥⎥⎤
旋转矩阵
假设{A}
在经过旋转后可以得到{B}
(可能经过平移但不考虑),现计算{B}
相对于{A}
的旋转矩阵
A
R
B
^AR_B
ARB
R A ∗ A R B = R B R_A * ^AR_B = R_B RA∗ARB=RB
A R B = [ A X B A Y B A Z B ] ^AR_B = \begin{bmatrix}^AX_B & ^AY_B & ^AZ_B \end{bmatrix} ARB=[AXBAYBAZB]
A
R
B
=
R
A
−
1
∗
R
B
=
[
X
A
t
Y
A
t
Z
A
t
]
∗
[
X
B
Y
B
Z
B
]
=
[
X
B
X
A
Y
B
X
A
Z
B
X
A
X
B
Y
A
Y
B
Y
A
Z
B
Y
A
X
B
Z
A
Y
B
Z
A
Z
B
Z
A
]
^AR_B = R^{-1}_A*R_B = \begin{bmatrix}X_A^t\\Y_A^t\\Z_A^t\end{bmatrix}*\begin{bmatrix}X_B&Y_B&Z_B \end{bmatrix} = \begin{bmatrix} X_B X_A & Y_B X_A & Z_B X_A \\ X_B Y_A & Y_B Y_A & Z_B Y_A \\ X_B Z_A & Y_B Z_A & Z_B Z_A \\ \end{bmatrix}
ARB=RA−1∗RB=⎣⎡XAtYAtZAt⎦⎤∗[XBYBZB]=⎣⎡XBXAXBYAXBZAYBXAYBYAYBZAZBXAZBYAZBZA⎦⎤
注意:
- 旋转矩阵中的9个值是方向余弦
- 旋转矩阵的逆等于旋转矩阵的转置(酉矩阵)
- 参考于
{A}
,{B}
可以表示成 { B } = { A R B , A P B _ o r i g i n } \{B\} = \{ ^AR_B, ^AP_{B_{\_origin}}\} {B}={ARB,APB_origin}(旋转+平移) - 自由度问题:旋转矩阵有9个变量,但理论上应该只有3个自由度才对。6个限制:每一个方向向量模都为1,两两方向向量都垂直。
坐标系之间的关系
假设{B}
经过变换得到{A}
,考虑其中的一个点p
,由
B
P
^BP
BP 和变换求
A
P
^AP
AP。
- 假设只有平移: A P = B P + A P B _ o r i g i n ^AP = ^BP+^AP_{B_{\_origin}} AP=BP+APB_origin
- 假设只有旋转: A P = A R B ∗ B P ^AP = ^AR_B*^BP AP=ARB∗BP
- 假设都有::
A
P
=
A
R
B
∗
B
P
+
A
P
B
_
o
r
i
g
i
n
^AP = ^AR_B*^BP + ^AP_{B_{\_origin}}
AP=ARB∗BP+APB_origin
[ A P 1 ] = [ A R B A P B _ o r i g i n 0 1 ] ∗ [ B P 1 ] \begin{bmatrix}^AP\\1\end{bmatrix} = \begin{bmatrix}^AR_B & ^AP_{B_{\_origin}} \\0 & 1 \\\end{bmatrix}* \begin{bmatrix}^BP\\1\end{bmatrix} [AP1]=[ARB0APB_origin1]∗[BP1]
2.3 变换
平移变换
P
2
=
P
1
+
Q
P
2
=
T
r
a
n
s
(
Q
)
P
1
T
r
a
n
s
(
Q
)
=
[
1
0
0
q
x
0
1
0
q
y
0
0
1
q
z
0
0
0
1
]
P_2 = P_1 + Q\\ P_2 = Trans(Q)P_1 Trans(Q) = \begin{bmatrix} 1 & 0 & 0 & q_x \\ 0 & 1 & 0 & q_y \\ 0 & 0 & 1 & q_z \\ 0 & 0 & 0 & 1 \end{bmatrix}
P2=P1+QP2=Trans(Q)P1Trans(Q)=⎣⎢⎢⎡100001000010qxqyqz1⎦⎥⎥⎤
平移变换具有可交换性,平移变换的顺序与最终结果无关,可任意交换。
旋转变换
两个参数:绕哪个轴(这里只讨论x,y,z)和旋转多少角度。
P
2
=
R
K
(
θ
)
P
1
R
x
(
θ
)
=
[
1
0
0
0
0
c
o
s
θ
−
s
i
n
θ
0
0
s
i
n
θ
c
o
s
θ
0
0
0
0
1
]
R
y
(
θ
)
=
[
c
o
s
θ
0
s
i
n
θ
0
0
1
0
0
−
s
i
n
θ
0
c
o
s
θ
0
0
0
0
1
]
R
z
(
θ
)
=
[
c
o
s
θ
−
s
i
n
θ
0
0
s
i
n
θ
c
o
s
θ
0
0
0
0
1
0
0
0
0
1
]
P_2 = R_K(\theta) P_1\\ R_x(\theta) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & cos\theta & -sin\theta & 0 \\ 0 & sin\theta & cos\theta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\\ R_y(\theta) = \begin{bmatrix} cos\theta & 0 & sin\theta & 0 \\ 0 & 1 & 0 & 0\\ -sin\theta & 0 & cos\theta & 0\\ 0 & 0 & 0 & 1 \end{bmatrix}\\ R_z(\theta) = \begin{bmatrix} cos\theta & -sin\theta & 0 & 0 \\ sin\theta & cos\theta & 0 & 0\\ 0& 0 & 1 & 0\\ 0 & 0 & 0 & 1 \end{bmatrix}
P2=RK(θ)P1Rx(θ)=⎣⎢⎢⎡10000cosθsinθ00−sinθcosθ00001⎦⎥⎥⎤Ry(θ)=⎣⎢⎢⎡cosθ0−sinθ00100sinθ0cosθ00001⎦⎥⎥⎤Rz(θ)=⎣⎢⎢⎡cosθsinθ00−sinθcosθ0000100001⎦⎥⎥⎤
旋转变换不具有可交换性,变换的顺序会影响最终结果。
广义旋转变换
不妨假设T
绕任意轴k
旋转
θ
\theta
θ。将向量k
作为一个坐标系C
的z
轴,必然存在一个坐标系X
,使得T
是X
绕着C
得到的,即:
T
=
C
X
T=CX
T=CX。这样,T
绕着k
旋转等价于X
绕着C
的z
轴旋转,即
R
k
(
θ
)
=
C
R
z
(
θ
)
X
=
C
R
Z
(
θ
)
C
−
1
T
R_k(\theta)=CR_z(\theta)X=CR_Z(\theta)C^{-1}T
Rk(θ)=CRz(θ)X=CRZ(θ)C−1T。
R
k
(
θ
)
=
C
R
z
(
θ
)
C
−
1
=
[
n
x
o
x
a
x
0
n
y
o
y
a
y
0
n
z
o
z
a
z
0
0
0
0
1
]
[
c
o
s
θ
0
−
s
i
n
θ
0
s
i
n
θ
c
o
s
θ
0
0
0
0
1
0
0
0
0
1
]
[
n
x
n
y
n
z
0
o
x
o
y
o
z
0
a
x
a
y
a
z
0
0
0
0
1
]
=
[
K
x
2
v
e
r
s
θ
+
c
o
s
θ
K
x
K
y
v
e
r
s
θ
−
K
z
s
i
n
θ
K
x
K
z
v
e
r
s
θ
+
K
y
s
i
n
θ
0
K
x
K
y
v
e
r
s
θ
+
K
z
s
i
n
θ
K
y
2
v
e
r
s
θ
+
c
o
s
θ
K
y
K
z
v
e
r
s
θ
−
K
x
s
i
n
θ
0
K
x
K
z
v
e
r
s
θ
−
K
y
s
i
n
θ
K
y
K
z
v
e
r
s
θ
+
K
x
s
i
n
θ
K
z
2
v
e
r
s
θ
+
c
o
s
θ
0
0
0
0
1
]
w
h
e
r
e
,
v
e
r
s
θ
=
1
−
c
o
s
θ
;
(
k
x
,
k
y
,
k
z
)
=
(
a
x
,
a
y
,
a
z
)
R_k(\theta) = CR_z(\theta)C^{-1}\\ =\begin{bmatrix} n_x & o_x & a_x & 0 \\ n_y & o_y & a_y & 0 \\ n_z & o_z & a_z & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} cos\theta & 0 & -sin\theta & 0 \\ sin\theta & cos\theta & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} n_x & n_y & n_z & 0 \\ o_x & o_y & o_z & 0 \\ a_x & a_y & a_z & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\\ = \begin{bmatrix} K^2_xvers\theta+cos\theta & K_xK_yvers\theta-K_zsin\theta & K_xK_zvers\theta+K_ysin\theta & 0\\ K_xK_yvers\theta+K_zsin\theta & K^2_yvers\theta+cos\theta & K_yK_zvers\theta-K_xsin\theta & 0\\ K_xK_zvers\theta-K_ysin\theta & K_yK_zvers\theta+K_xsin\theta & K^2_zvers\theta+cos\theta & 0\\ 0 & 0 & 0 & 1 \end{bmatrix}\\ where,vers\theta=1-cos\theta;(k_x,k_y,k_z)=(a_x,a_y,a_z)
Rk(θ)=CRz(θ)C−1=⎣⎢⎢⎡nxnynz0oxoyoz0axayaz00001⎦⎥⎥⎤⎣⎢⎢⎡cosθsinθ000cosθ00−sinθ0100001⎦⎥⎥⎤⎣⎢⎢⎡nxoxax0nyoyay0nzozaz00001⎦⎥⎥⎤=⎣⎢⎢⎡Kx2versθ+cosθKxKyversθ+KzsinθKxKzversθ−Kysinθ0KxKyversθ−KzsinθKy2versθ+cosθKyKzversθ+Kxsinθ0KxKzversθ+KysinθKyKzversθ−KxsinθKz2versθ+cosθ00001⎦⎥⎥⎤where,versθ=1−cosθ;(kx,ky,kz)=(ax,ay,az)
广义变换
既有平移变换又有旋转变换
T
=
[
n
x
o
x
a
x
p
x
n
y
o
y
a
y
p
y
n
z
o
z
a
z
p
z
0
0
0
1
]
T = \begin{bmatrix} n_x & o_x & a_x & p_x \\ n_y & o_y & a_y & p_y\\ n_z & o_z & a_z & p_z\\ 0 & 0 & 0 & 1 \end{bmatrix}
T=⎣⎢⎢⎡nxnynz0oxoyoz0axayaz0pxpypz1⎦⎥⎥⎤
矩阵乘的顺序问题
- 如果平移旋转变换都是基于本坐标系进行的,则应该右乘(后乘)
- 如果平移旋转变换都是基于参考坐标系进行的,则应该左乘(前乘)
复合变换和逆变换
B
P
=
B
T
C
∙
C
P
^BP=^BT_C\bullet ^CP \\
BP=BTC∙CP
A
P
=
A
T
B
∙
B
P
^AP=^AT_B\bullet ^BP \\
AP=ATB∙BP
A
P
=
A
T
B
∙
B
T
C
∙
C
P
=
A
T
C
∙
C
P
T
−
1
=
[
n
x
n
y
n
z
−
p
∙
n
o
x
o
y
o
z
−
p
∙
o
a
x
a
y
a
z
−
p
∙
a
0
0
0
1
]
^AP=^AT_B\bullet ^BT_C\bullet ^CP = ^AT_C\bullet ^CP T^{-1} = \begin{bmatrix} n_x & n_y & n_z & -p\bullet n \\ o_x & o_y & o_z & -p\bullet o\\ a_x & a_y & a_z & -p\bullet a\\ 0 & 0 & 0 & 1 \end{bmatrix}
AP=ATB∙BTC∙CP=ATC∙CPT−1=⎣⎢⎢⎡nxoxax0nyoyay0nzozaz0−p∙n−p∙o−p∙a1⎦⎥⎥⎤
2.3 等效转角轴
给定任意一个旋转矩阵
R
=
[
n
x
o
x
a
x
0
n
y
o
y
a
y
0
n
z
y
z
a
z
0
0
0
0
1
]
R=\begin{bmatrix}n_x&o_x&a_x&0\\n_y&o_y& a_y&0\\n_z&y_z&a_z&0\\0&0&0&1\end{bmatrix}
R=⎣⎢⎢⎡nxnynz0oxoyyz0axayaz00001⎦⎥⎥⎤,将旋转变换
R
R
R等价于绕向量k旋转θ角
。
由线性代数的知识
T
r
a
c
e
(
R
)
=
n
x
+
o
y
+
a
z
+
1
=
K
x
2
v
e
r
s
θ
+
c
o
s
θ
+
K
y
2
v
e
r
s
θ
+
c
o
s
θ
+
K
z
2
v
e
r
s
θ
+
c
o
s
θ
+
1
=
2
+
2
c
o
s
θ
c
o
s
θ
=
1
2
(
n
x
+
o
y
+
a
z
−
1
)
s
i
n
θ
=
±
1
2
(
o
z
−
a
y
)
2
+
(
a
x
−
n
z
)
2
+
(
n
y
−
o
x
)
2
t
a
n
θ
=
s
i
n
θ
c
o
s
θ
0
≤
θ
≤
18
0
ο
Trace(R) = n_x+o_y+a_z+1 \\ =K^2_xvers\theta+cos\theta+K^2_yvers\theta+cos\theta+K^2_zvers\theta+cos\theta+1\\ =2+2cos\theta cos\theta\\=\frac{1}{2}(n_x+o_y+a_z-1) sin\theta=\\\pm\frac{1}{2}\sqrt{(o_z-a_y)^2+(a_x-n_z)^2+(n_y-o_x)^2}\\ tan\theta=\frac{sin\theta}{cos\theta}\\ 0\leq\theta\leq180^\omicron
Trace(R)=nx+oy+az+1=Kx2versθ+cosθ+Ky2versθ+cosθ+Kz2versθ+cosθ+1=2+2cosθcosθ=21(nx+oy+az−1)sinθ=±21(oz−ay)2+(ax−nz)2+(ny−ox)2tanθ=cosθsinθ0≤θ≤180ο
2.4 旋转表示法
欧拉角
E u l e r ( ϕ , θ , ψ ) = R Z ( ϕ ) ∗ R Y ( θ ) ∗ R Z ( ψ ) Euler(\phi,\theta,\psi) = R_Z(\phi)*R_Y(\theta)*R_Z(\psi) Euler(ϕ,θ,ψ)=RZ(ϕ)∗RY(θ)∗RZ(ψ)
旋转顺序:
- 绕Z轴旋转 ϕ \phi ϕ
- 绕Y轴旋转 θ \theta θ
- 绕Z轴旋转 ψ \psi ψ
E
u
l
e
r
(
ϕ
,
θ
,
ψ
)
=
R
Z
(
ϕ
)
∗
R
Y
(
θ
)
∗
R
Z
(
ψ
)
=
[
c
o
s
ϕ
c
o
s
θ
c
o
s
ψ
−
s
i
n
ϕ
s
i
n
ψ
−
c
o
s
ϕ
c
o
s
θ
s
i
n
ψ
−
s
i
n
ϕ
c
o
s
ψ
c
o
s
ϕ
s
i
n
θ
0
s
i
n
ϕ
c
o
s
θ
c
o
s
ψ
+
c
o
s
ϕ
s
i
n
ψ
−
s
i
n
ϕ
c
o
s
θ
s
i
n
ψ
+
c
o
s
ϕ
c
o
s
s
i
n
ϕ
s
i
n
θ
0
−
s
i
n
θ
c
o
s
ψ
s
i
n
θ
s
i
n
ψ
c
o
s
θ
0
0
0
0
1
]
t
a
n
ϕ
=
s
i
n
ϕ
c
o
s
ϕ
=
a
y
a
x
Euler(\phi,\theta,\psi) = R_Z(\phi)*R_Y(\theta)*R_Z(\psi) \\ = \begin{bmatrix} cos\phi cos\theta cos\psi - sin\phi sin\psi & -cos\phi cos\theta sin\psi -sin\phi cos\psi & cos\phi sin\theta & 0 \\ sin\phi cos\theta cos\psi + cos\phi sin\psi & -sin\phi cos\theta sin\psi +cos\phi cos & sin\phi sin\theta & 0 \\ -sin\theta cos\psi & sin\theta sin\psi & cos\theta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\\ tan\phi = \frac{sin\phi}{cos\phi}=\frac{a_y}{a_x}
Euler(ϕ,θ,ψ)=RZ(ϕ)∗RY(θ)∗RZ(ψ)=⎣⎢⎢⎡cosϕcosθcosψ−sinϕsinψsinϕcosθcosψ+cosϕsinψ−sinθcosψ0−cosϕcosθsinψ−sinϕcosψ−sinϕcosθsinψ+cosϕcossinθsinψ0cosϕsinθsinϕsinθcosθ00001⎦⎥⎥⎤tanϕ=cosϕsinϕ=axay
根据矩阵获得三个角的解:
ϕ = t a n − 1 ( a y a x ) o r ϕ = t a n − 1 ( a y a x ) + 18 0 ο θ = t a n − 1 ( s i n θ c o s θ ) = t a n − 1 ( c o s ϕ a x + s i n ϕ a y a z ) ψ = t a n − 1 ( s i n ψ c o s ψ ) = t a n − 1 ( − s i n ϕ n x + c o s ϕ n y − s i n ϕ o x + c o s ϕ o y ) \phi=tan^{-1}(\frac{a_y}{a_x})\space or \space \phi=tan^{-1}(\frac{a_y}{a_x})+180^\omicron\\ \theta=tan^{-1}(\frac{sin\theta}{cos\theta})=tan^{-1}(\frac{cos\phi a_x+sin\phi a_y }{a_z})\\ \psi=tan^{-1}(\frac{sin\psi}{cos\psi})=tan^{-1}(\frac{-sin\phi n_x+cos\phi n_y }{-sin\phi o_x+cos\phi o_y}) ϕ=tan−1(axay) or ϕ=tan−1(axay)+180οθ=tan−1(cosθsinθ)=tan−1(azcosϕax+sinϕay)ψ=tan−1(cosψsinψ)=tan−1(−sinϕox+cosϕoy−sinϕnx+cosϕny)
RPY角
R P Y ( ϕ , θ , ψ ) = R z ( ϕ ) ∗ R y ( θ ) ∗ R x ( ψ ) RPY(\phi,\theta,\psi) = R_z(\phi)*R_y(\theta)*R_x(\psi) RPY(ϕ,θ,ψ)=Rz(ϕ)∗Ry(θ)∗Rx(ψ)
旋转顺序:
- 绕z轴旋转 ϕ a \phi_a ϕa,称为滚动(Roll,滚动角)
- 绕y轴旋转 ϕ o \phi_o ϕo,称为俯仰(Pitch,俯仰角)
- 绕x轴旋转 ϕ n \phi_n ϕn,称为偏航(Yaw,偏航角)
R P Y = R o t ( a , ϕ a ) ∗ R o t ( o , ϕ o ) ∗ R o t ( n , ϕ n ) = [ c o s ϕ a c o s ϕ o c o s ϕ a s i n ϕ o s i n ϕ n − s i n ϕ a c o s ϕ n c o s ϕ a s i n ϕ o c o s ϕ n + s i n ϕ a s i n ϕ n 0 s i n ϕ a c o s ϕ o s i n p h i a s i n ϕ o s i n + c o s p h i a c o s ϕ n s i n ϕ a s i n ϕ o c o s ϕ n − c o s ϕ a s i n ϕ n 0 − s i n ϕ o c o s ϕ o s i n ϕ n c o s ϕ o c o s ϕ n 0 0 0 0 1 ] RPY = Rot(a,\phi_a)*Rot(o,\phi_o)*Rot(n,\phi_n) \\ = \begin{bmatrix} cos\phi_a cos\phi_o & cos\phi_a sin\phi_o sin\phi_n - sin\phi_a cos\phi_n & cos\phi_a sin\phi_o cos\phi_n + sin\phi_asin\phi_n & 0 \\ sin\phi_a cos\phi_o & sinphi_a sin\phi_o sin + cosphi_acos\phi_n & sin\phi_a sin\phi_o cos\phi_n - cos\phi_a sin\phi_n & 0 \\ -sin\phi_o & cos\phi_o sin\phi_n & cos\phi_o cos\phi_n & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} RPY=Rot(a,ϕa)∗Rot(o,ϕo)∗Rot(n,ϕn)=⎣⎢⎢⎡cosϕacosϕosinϕacosϕo−sinϕo0cosϕasinϕosinϕn−sinϕacosϕnsinphiasinϕosin+cosphiacosϕncosϕosinϕn0cosϕasinϕocosϕn+sinϕasinϕnsinϕasinϕocosϕn−cosϕasinϕncosϕocosϕn00001⎦⎥⎥⎤
根据矩阵获得三个角的解:
ϕ = t a n − 1 ( n y n x ) o r ϕ = t a n − 1 ( n y n x ) + 18 0 ο θ = t a n − 1 ( − n z c o s ϕ n x + s i n ϕ n y ) ψ = t a n − 1 ( s i n ϕ a x − c o s ϕ a y − s i n ϕ o x + c o s ϕ o y ) \phi=tan^{-1}(\frac{n_y}{n_x})\space or \space \phi=tan^{-1}(\frac{n_y}{n_x})+180^\omicron\\ \theta=tan^{-1}(\frac{-n_z}{cos\phi n_x+sin\phi n_y})\\ \psi=tan^{-1}(\frac{sin\phi a_x-cos\phi a_y }{-sin\phi o_x+cos\phi o_y}) ϕ=tan−1(nxny) or ϕ=tan−1(nxny)+180οθ=tan−1(cosϕnx+sinϕny−nz)ψ=tan−1(−sinϕox+cosϕoysinϕax−cosϕay)
2.5 位置表示法
圆柱坐标系
- 沿x轴移动 γ \gamma γ
- 绕z轴旋转 α \alpha α
- 沿z轴移动 z z z
都是相对于全局参考坐标系来讲的,因此可以总变换可以由依次左乘每个矩阵求得。
c y l ( z , α , γ ) = T r a n s ( 0 , 0 , z ) ∗ R z ( α ) ∗ T r a n s ( γ , 0 , 0 ) = [ c o s α − s i n α 0 γ ∗ c o s α s i n α c o s α 0 γ ∗ s i n α 0 0 1 z 0 0 0 1 ] P = [ γ c o s α γ s i n α z 1 ] cyl(z, \alpha,\gamma) = Trans(0,0,z)*R_z(\alpha)*Trans(\gamma,0,0) \\ = \begin{bmatrix} cos\alpha & -sin\alpha & 0 & \gamma*cos\alpha \\ sin\alpha & cos\alpha & 0 & \gamma*sin\alpha \\ 0 & 0 & 1 & z \\ 0 & 0 & 0 & 1 \end{bmatrix}\\ P=\begin{bmatrix}\gamma cos\alpha \\\gamma sin\alpha\\z\\1 \end{bmatrix} cyl(z,α,γ)=Trans(0,0,z)∗Rz(α)∗Trans(γ,0,0)=⎣⎢⎢⎡cosαsinα00−sinαcosα000010γ∗cosαγ∗sinαz1⎦⎥⎥⎤P=⎣⎢⎢⎡γcosαγsinαz1⎦⎥⎥⎤
球坐标
- 沿z轴移动 γ \gamma γ
- 绕y轴旋转 β \beta β
- 绕z轴旋转 α \alpha α
都是相对于全局参考坐标系来讲的,因此可以总变换可以由依次左乘每个矩阵求得。
S ( α , β , γ ) = R z ( α ) ∗ R y ( β ) ∗ T r a n s ( 0 , 0 , γ ) = [ c o s α c o s β − s i n α c o s α s i n β γ ∗ c o s α s i n β s i n α c o s β c o s α s i n α s i n β γ ∗ s i n α s i n β − s i n β 0 c o s β r ∗ c o s β 0 0 0 1 ] P = [ γ c o s α s i n β γ s i n α s i n β γ c o s β 1 ] S(\alpha,\beta,\gamma) = R_z(\alpha)*R_y(\beta)*Trans(0,0,\gamma) \\ = \begin{bmatrix} cos\alpha cos\beta & -sin\alpha & cos\alpha sin\beta & \gamma *cos\alpha sin\beta\\ sin\alpha cos\beta & cos\alpha & sin\alpha sin\beta & \gamma *sin\alpha sin\beta\\ -sin\beta & 0 & cos\beta & r*cos\beta \\ 0 & 0 & 0 & 1 \end{bmatrix}\\ P=\begin{bmatrix}\gamma cos\alpha sin\beta \\\gamma sin\alpha sin\beta \\\gamma cos\beta \\1 \end{bmatrix} S(α,β,γ)=Rz(α)∗Ry(β)∗Trans(0,0,γ)=⎣⎢⎢⎡cosαcosβsinαcosβ−sinβ0−sinαcosα00cosαsinβsinαsinβcosβ0γ∗cosαsinβγ∗sinαsinβr∗cosβ1⎦⎥⎥⎤P=⎣⎢⎢⎡γcosαsinβγsinαsinβγcosβ1⎦⎥⎥⎤