Modern Robotics指数坐标推导雅可比(Jacobian)
空间雅可比(Space Jacobian)
假设一个开链机构的正运动学以指数积形式写成
T
(
θ
)
=
e
[
S
1
]
θ
1
…
e
[
S
n
]
θ
n
M
.
T(\theta)=e^{[\mathcal S_1]\theta_1}\dots e^{[\mathcal S_n]\theta_n}M.
T(θ)=e[S1]θ1…e[Sn]θnM.
空间雅可比
J
s
(
θ
)
∈
R
6
×
n
J_s(\theta)\in \mathbb R^{6\times n}
Js(θ)∈R6×n关联了关节速度向量
θ
˙
∈
R
n
\dot \theta \in\mathbb R^n
θ˙∈Rn和空间旋量
V
s
\mathcal V_s
Vs,即
V
s
=
J
s
(
θ
)
θ
˙
\mathcal V_s=J_s(\theta)\dot \theta
Vs=Js(θ)θ˙。
J
s
(
θ
)
J_s(\theta)
Js(θ)第
i
i
i列由下式确定
J
s
i
(
θ
)
=
A
d
e
[
S
1
]
θ
1
.
.
.
e
[
S
i
−
1
]
θ
i
−
1
(
S
i
)
,
J_{si}(\theta)=Ad_{e^{[\mathcal S_1]\theta_1}...e^{[\mathcal S_{i-1}]\theta_{i-1}}}(\mathcal S_i),
Jsi(θ)=Ade[S1]θ1...e[Si−1]θi−1(Si),
对于
i
=
2
,
…
,
n
,
i=2, \dots, n,
i=2,…,n,第1列
J
s
1
=
S
1
J_{s1}=\mathcal S_1
Js1=S1。螺旋矢量
J
s
i
J_{si}
Jsi的物理意义是在任意非零关节角度
θ
\theta
θ下,第
i
i
i个关节在空间固定坐标系下的表达。
推导:
已知正运动学指数形式表达为
T
(
θ
)
=
e
[
S
1
]
θ
1
…
e
[
S
n
]
θ
n
M
.
(5.5)
T(\theta)=e^{[\mathcal S_1]\theta_1}\dots e^{[\mathcal S_n]\theta_n}M.\tag{5.5}
T(θ)=e[S1]θ1…e[Sn]θnM.(5.5)
空间旋量
V
s
\mathcal V_s
Vs由齐次变换矩阵给出
[
V
s
]
=
T
˙
T
−
1
[\mathcal V_s]=\dot TT^{-1}
[Vs]=T˙T−1, 其中
T
˙
=
(
d
d
t
e
[
S
1
]
θ
1
)
…
e
[
S
n
]
θ
n
M
+
e
[
S
1
]
θ
1
(
d
d
t
e
[
S
2
]
θ
2
)
…
e
[
S
n
]
θ
n
M
+
…
=
[
S
1
]
θ
˙
1
e
[
S
1
]
θ
1
…
e
[
S
n
]
θ
n
M
+
e
[
S
1
]
θ
1
[
S
2
]
θ
˙
2
e
[
S
2
]
θ
2
…
e
[
S
n
]
θ
n
M
+
…
\dot T=(\frac {d}{dt}e^{[\mathcal S_1]\theta_1})\dots e^{[\mathcal S_n]\theta_n}M+e^{[\mathcal S_1]\theta_1}(\frac{d}{dt}e^{[\mathcal S_2]\theta_2})\dots e^{[\mathcal S_n]\theta_n}M+\dots\\ =[\mathcal S_1]\dot \theta_1e^{[\mathcal S_1]\theta_1}\dots e^{[\mathcal S_n]\theta_n}M+e^{[\mathcal S_1]\theta_1}[\mathcal S_2]\dot \theta_2e^{[\mathcal S_2]\theta_2}\dots e^{[\mathcal S_n]\theta_n}M+\dots\\
T˙=(dtde[S1]θ1)…e[Sn]θnM+e[S1]θ1(dtde[S2]θ2)…e[Sn]θnM+…=[S1]θ˙1e[S1]θ1…e[Sn]θnM+e[S1]θ1[S2]θ˙2e[S2]θ2…e[Sn]θnM+…
也有
T
−
1
=
M
−
1
e
−
[
S
n
]
θ
n
…
e
−
[
S
1
]
θ
1
.
T^{-1}=M^{-1}e^{-[\mathcal S_n]\theta_n}\dots e^{-[\mathcal S_1]\theta_1}.
T−1=M−1e−[Sn]θn…e−[S1]θ1.
计算
T
˙
T
−
1
\dot TT^{-1}
T˙T−1得到
[
V
s
]
=
[
S
1
]
θ
˙
1
+
e
[
S
1
]
θ
˙
1
[
S
2
]
e
−
[
S
1
]
θ
˙
1
+
e
[
S
1
]
θ
˙
1
e
[
S
2
]
θ
˙
2
[
S
3
]
e
−
[
S
1
]
θ
˙
1
e
−
[
S
2
]
θ
˙
2
+
…
[\mathcal V_s]=[\mathcal S_1]\dot \theta_1+e^{[\mathcal S_1]\dot \theta_1}[\mathcal S_2]e^{-[\mathcal S_1]\dot \theta_1}+e^{[\mathcal S_1]\dot \theta_1}e^{[\mathcal S_2]\dot \theta_2}[\mathcal S_3]e^{-[\mathcal S_1]\dot \theta_1}e^{-[\mathcal S_2]\dot \theta_2}+\dots
[Vs]=[S1]θ˙1+e[S1]θ˙1[S2]e−[S1]θ˙1+e[S1]θ˙1e[S2]θ˙2[S3]e−[S1]θ˙1e−[S2]θ˙2+…
上式可以进一步写成向量形式的伴随映射
V
s
=
S
1
⏟
J
s
1
θ
˙
1
+
Ad
e
[
S
1
]
θ
1
(
S
2
)
⏟
J
s
2
θ
˙
2
+
Ad
e
[
S
1
]
θ
1
e
[
S
2
]
θ
2
(
S
3
)
⏟
J
s
3
θ
˙
3
+
…
(5.6)
\mathcal V_s=\underbrace {\mathcal S_1}_{J_{s1}}\dot\theta_1+\underbrace{\text{Ad}_{e^{[\mathcal S_1]\theta_1}}(\mathcal S_2)}_{J_{s2}}\dot \theta_2+\underbrace{\text{Ad}_{e^{[\mathcal S_1]\theta_1}{e^{[\mathcal S_2]\theta_2}}}(\mathcal S_3)}_{J_{s3}}\dot \theta_3+\dots \tag{5.6}
Vs=Js1
S1θ˙1+Js2
Ade[S1]θ1(S2)θ˙2+Js3
Ade[S1]θ1e[S2]θ2(S3)θ˙3+…(5.6)
观察发现,
V
s
\mathcal V_s
Vs是
n
n
n个空间旋量的和的形式
V
s
=
J
s
1
θ
˙
1
+
J
s
2
(
θ
)
θ
˙
2
+
⋯
+
J
s
n
(
θ
)
θ
˙
n
,
(5.7)
\mathcal V_s=J_{s1}\dot\theta_1+J_{s2}(\theta)\dot\theta_2+\dots +J_{sn}(\theta)\dot \theta_n,\tag{5.7}
Vs=Js1θ˙1+Js2(θ)θ˙2+⋯+Jsn(θ)θ˙n,(5.7)
这里对任意
i
=
2
,
…
,
n
i=2, \dots,n
i=2,…,n, 每个
J
s
i
(
θ
)
=
(
ω
s
i
(
θ
,
v
s
i
(
θ
)
)
)
J_{si}(\theta)=(\omega_{si}(\theta,v_{si}(\theta)))
Jsi(θ)=(ωsi(θ,vsi(θ)))显式地决定于关节变量
θ
∈
R
n
\theta\in\mathbb R^n
θ∈Rn. 写成矩阵形式
V
s
=
[
J
s
1
J
s
2
(
θ
)
…
J
s
n
(
θ
)
]
[
θ
˙
1
θ
˙
⋮
θ
˙
]
=
J
s
(
θ
)
θ
˙
.
(5.8)
\mathcal V_s=\left[ \begin{matrix} J_{s1} & J_{s2} (\theta)&\dots &J_{sn}(\theta) \end{matrix}\right] \left[ \begin{matrix} \dot\theta_1 \\ \dot \theta\\ \vdots\\\dot\theta \end{matrix}\right] =J_s(\theta)\dot\theta .\tag {5.8}
Vs=[Js1Js2(θ)…Jsn(θ)]⎣⎢⎢⎢⎡θ˙1θ˙⋮θ˙⎦⎥⎥⎥⎤=Js(θ)θ˙.(5.8)
矩阵
J
s
(
θ
)
J_s(\theta)
Js(θ)称为在(空间)固定坐标系的雅可比,或称为空间雅可比。
**补充:**这里伴随映射的定义:给定一个齐次变换矩阵
T
=
[
R
p
0
1
]
∈
S
E
(
3
)
T=\left[ \begin{matrix} R&p\\0&1 \end {matrix}\right]\in SE(3)
T=[R0p1]∈SE(3),其伴随表示
[
Ad
T
]
[\text{Ad}_T]
[AdT]是
Ad
T
=
[
R
R
[
p
]
R
0
]
∈
R
6
×
6
\text{Ad}_T=\left[ \begin{matrix} R&R\\ [p]R&0 \end {matrix}\right] \in \mathbb R^{6\times6}
AdT=[R[p]RR0]∈R6×6
这里
[
p
]
[p]
[p] 表示向量
p
p
p对应的反对称矩阵。
[
Ad
T
]
[\text{Ad}_T]
[AdT]的物理意义实际是对6维旋量进行坐标变换,类似于齐次矩阵对3维向量进行坐标变换。例如,坐标系{s}到坐标系{b}的其次变换为
T
s
b
T_{sb}
Tsb,对一个旋量
V
b
\mathcal V_b
Vb进行伴随表示可以写成
V
s
=
[
Ad
T
s
b
]
V
b
=
Ad
T
s
b
(
V
b
)
\mathcal V_s=[\text{Ad}_{T_{sb}}]\mathcal V_b=\text{Ad}_{T_{sb}}(\mathcal V_b)
Vs=[AdTsb]Vb=AdTsb(Vb)
物体雅可比(Body Jacobian)
类似的,若旋量在物体坐标系里描述,那么可以推导出在物体坐标系描述的运动学表达式,进而推导出物体雅可比,即
假设一个开链机构的正运动学以指数积形式写成
T
(
θ
)
=
M
e
[
B
1
]
θ
1
…
e
[
B
n
]
θ
n
.
T(\theta)=Me^{[\mathcal B_1]\theta_1}\dots e^{[\mathcal B_n]\theta_n}.
T(θ)=Me[B1]θ1…e[Bn]θn.
空间雅可比
J
b
(
θ
)
∈
R
6
×
n
J_b(\theta)\in \mathbb R^{6\times n}
Jb(θ)∈R6×n关联了关节速度向量
θ
˙
∈
R
n
\dot \theta \in\mathbb R^n
θ˙∈Rn和空间旋量
V
b
\mathcal V_b
Vb,即
V
b
=
J
b
(
θ
)
θ
˙
\mathcal V_b=J_b(\theta)\dot \theta
Vb=Jb(θ)θ˙。
J
b
(
θ
)
J_b(\theta)
Jb(θ)第
i
i
i列由下式确定
J
b
i
(
θ
)
=
A
d
e
[
B
1
]
θ
1
.
.
.
e
[
B
i
−
1
]
θ
i
−
1
(
B
i
)
,
J_{bi}(\theta)=Ad_{e^{[\mathcal B_1]\theta_1}...e^{[\mathcal B_{i-1}]\theta_{i-1}}}(\mathcal B_i),
Jbi(θ)=Ade[B1]θ1...e[Bi−1]θi−1(Bi),
对于
i
=
n
−
1
,
…
,
1
,
i=n-1, \dots, 1,
i=n−1,…,1,第n列
J
B
n
=
B
n
J_{B_n}=\mathcal B_n
JBn=Bn。螺旋矢量
J
b
i
J_{bi}
Jbi的物理意义是在任意非零关节角度
θ
\theta
θ下,第
i
i
i个关节在物体坐标系下的表达。
空间雅可比与物体雅可比的联系
物体雅可比和空间雅可比的关系用下式表达
J
s
(
θ
)
=
[
Ad
T
s
b
]
J
b
(
θ
)
,
J
b
(
θ
)
=
[
Ad
T
b
s
]
J
s
(
θ
)
,
J_s(\theta)=[\text {Ad}_{T_{sb}}]J_b(\theta),\\ J_b(\theta)=[\text {Ad}_{T_{bs}}]J_s(\theta),
Js(θ)=[AdTsb]Jb(θ),Jb(θ)=[AdTbs]Js(θ),
这里
T
s
b
=
T
(
θ
)
T_{sb}=T(\theta)
Tsb=T(θ)。
##例子:雅可比计算
Example 1: 计算如图的RRRP空间机器人的空间雅可比。
我们知道雅可比的第 i i i列,就是第 i i i个关节的螺旋轴(旋量)在空间坐标系(固定坐标)的表示 J s i = [ ω s i , v s i ] T J_{si}=[\omega_{si},v_{si}]^T Jsi=[ωsi,vsi]T。有时不能直接看出其旋量时,可以通过 [ Ad T i − 1 ] [\text {Ad}_{T_{i-1}}] [AdTi−1]矩阵对螺旋轴进行坐标变换,得到其在固定坐标系的表示。
(1)观察发现 ω s 1 \omega _{s1} ωs1始终沿 z ^ s \hat z_s z^s方向不变,因此 ω s 1 = [ 0 , 0 , 1 ] T \omega_{s1}=[0,0,1]^T ωs1=[0,0,1]T。选择坐标原点为 q 1 q_1 q1,那么 v s 1 = [ 0 , 0 , 0 ] T v_{s1}=[0,0,0]^T vs1=[0,0,0]T.
(2) ω s 2 \omega _{s2} ωs2始终沿 z ^ s \hat z_s z^s方向不变,因此 ω s 2 = [ 0 , 0 , 1 ] T \omega_{s2}=[0,0,1]^T ωs2=[0,0,1]T。选择轴线上 [ L 1 c 1 , L 1 s 1 , 0 ] T [L_1c_1,L_1s_1,0]^T [L1c1,L1s1,0]T为 q 2 q_2 q2,其中 c 1 = cos θ 1 , s 1 = sin ( θ 2 ) c_1=\text{cos}\theta_1,s_1=\text{sin}(\theta_2) c1=cosθ1,s1=sin(θ2),那么 v s 2 = − ω 2 × q 2 = [ L 1 s 1 , − L 1 c 1 , 0 ] T v_{s2}=-\omega_2\times q_2=[L_1s_1,-L_1c_1,0]^T vs2=−ω2×q2=[L1s1,−L1c1,0]T.
(3)不管如何运动, ω s 3 \omega_{s3} ωs3也是沿固定坐标系 z ^ s \hat z_s z^s方向,因此 ω s 3 = [ 0 , 0 , 1 ] 2 \omega_{s3}=[0,0,1]^2 ωs3=[0,0,1]2,选择 q 3 = [ L 1 c 1 + L 2 c 12 , L 1 s 1 + L 2 s 12 , 0 ] T q_3=[L_1c_1+L_2c_{12}, L_1s_1+L_2s_{12},0]^T q3=[L1c1+L2c12,L1s1+L2s12,0]T,其中 c 12 = cos ( θ 1 + θ 2 ) , s 12 = sin ( θ 1 + θ 2 ) c_{12}=\text{cos}(\theta_1+\theta_2),s_{12}=\text{sin}(\theta_1+\theta_2) c12=cos(θ1+θ2),s12=sin(θ1+θ2),那么 v s 3 = ( L 1 s 1 + L 2 s 12 , − L 1 c 1 − L 2 c 1 2 , 0 ) v_{s3}=(L_1s_1+L_2s_{12},-L_1c_1-L_2c_12,0) vs3=(L1s1+L2s12,−L1c1−L2c12,0).
(4)最后一个关节时移动副, ω s 4 = [ 0 , 0 , 0 ] 2 \omega_{s4}=[0,0,0]^2 ωs4=[0,0,0]2,轴的方向为 v s 4 = [ 0 , 0 , 1 ] 2 v_{s4}=[0,0,1]^2 vs4=[0,0,1]2
综合上述分析,空间雅可比为
J
s
(
θ
)
=
[
0
0
0
0
0
0
0
0
1
1
1
0
0
L
1
s
1
L
1
s
1
+
L
2
s
12
0
0
−
L
1
c
1
−
L
1
c
1
−
L
2
c
12
0
0
0
0
1
]
J_s(\theta)=\left[ \begin{matrix} 0 & 0 & 0& 0\\ 0 &0 &0 &0\\ 1 & 1 &1 & 0\\ 0 &L_1s_1 &L_1s_1+L_2s_{12}&0\\ 0 &-L_1c_1& -L_1c_1-L_2c_{12}&0\\ 0 & 0& 0 &1 \end{matrix}\right]
Js(θ)=⎣⎢⎢⎢⎢⎢⎢⎡001000001L1s1−L1c10001L1s1+L2s12−L1c1−L2c120000001⎦⎥⎥⎥⎥⎥⎥⎤
Example 2: 计算如图的RRPRRR空间机器人的空间雅可比。
(1)第一个轴线始终保持不变, ω s 1 = [ 0 , 0 , 1 ] 2 \omega_{s1}=[0,0,1]^2 ωs1=[0,0,1]2,选择 q 1 = [ 0 , 0 , L 1 ] 2 q_1=[0,0,L1]^2 q1=[0,0,L1]2,得到 w s 1 = − ω s 1 × q 1 = [ 0 , 0 , 0 ] T w_{s1}=-\omega_{s1}\times q_1=[0,0,0]^T ws1=−ωs1×q1=[0,0,0]T
(2)第二个关节的轴线随 θ 1 \theta_1 θ1变化, ω s 2 = [ − c 1 , − s 1 , 0 ] 2 \omega_{s2}=[-c_1,-s_1,0]^2 ωs2=[−c1,−s1,0]2 ,选择 q 1 = ( 0 , 0 , L 1 ) q_1=(0,0,L_1) q1=(0,0,L1) ,那么 v s 2 = − ω s 2 × q 2 = [ L 1 s 1 , − L 1 c 1 , 0 ] v_{s2}=-\omega_{s2}\times q_2=[L_1s_1,-L_1c_1,0] vs2=−ωs2×q2=[L1s1,−L1c1,0]。
(3)第三个关节是移动副,因此 ω s 3 = [ 0 , 0 , 0 ] T \omega_{s3}=[0,0,0]^T ωs3=[0,0,0]T,轴线方向
v
s
3
=
R
o
t
(
z
^
,
θ
1
)
R
o
t
(
x
^
,
−
θ
2
)
[
0
,
1
,
0
]
T
=
[
−
s
1
c
2
,
c
1
c
2
,
−
s
2
]
T
v_{s3}=Rot(\hat z,\theta_1)Rot(\hat x,-\theta_2)[0,1,0]^T=[-s_1c_2,c_1c_2,-s_2]^T
vs3=Rot(z^,θ1)Rot(x^,−θ2)[0,1,0]T=[−s1c2,c1c2,−s2]T
(4)后三个轴交于一点
q
w
=
[
0
0
L
1
]
+
R
o
t
(
z
^
,
θ
1
)
R
o
t
(
x
^
,
−
θ
2
)
[
0
L
2
+
θ
3
0
]
=
[
−
(
L
2
+
θ
3
)
s
1
c
2
(
L
2
+
θ
3
)
c
1
c
2
L
1
−
(
L
2
+
θ
3
)
s
2
]
q_w=\left[ \begin{matrix} 0\\ 0\\ L_1 \end{matrix}\right] +Rot(\hat z,\theta_1)Rot(\hat x,-\theta_2) \left[ \begin{matrix} 0\\ L_2+\theta_3\\ 0 \end{matrix}\right] =\left[ \begin{matrix} -(L_2+\theta_3)s_1c_2\\ (L_2+\theta_3)c_1c_2\\ L_1-(L_2+\theta_3)s_2 \end{matrix}\right]
qw=⎣⎡00L1⎦⎤+Rot(z^,θ1)Rot(x^,−θ2)⎣⎡0L2+θ30⎦⎤=⎣⎡−(L2+θ3)s1c2(L2+θ3)c1c2L1−(L2+θ3)s2⎦⎤
后三个轴的轴线方向为
ω
s
4
=
R
o
t
(
z
^
,
θ
1
)
R
o
t
(
x
^
,
−
θ
2
)
[
0
0
1
]
=
[
−
s
1
s
2
c
1
s
2
c
2
]
,
ω
s
5
=
R
o
t
(
z
^
,
θ
1
)
R
o
t
(
x
^
,
−
θ
2
)
R
o
t
(
z
^
,
θ
4
)
[
−
1
0
0
]
=
[
−
c
1
c
4
+
s
1
c
2
s
4
−
s
1
c
4
−
c
1
c
2
s
4
s
2
s
4
]
,
ω
s
6
=
R
o
t
(
z
^
,
θ
1
)
R
o
t
(
x
^
,
−
θ
2
)
R
o
t
(
z
^
,
θ
4
)
R
o
t
(
x
^
,
−
θ
5
)
[
0
1
0
]
=
[
−
c
5
(
s
1
c
2
c
4
+
c
1
s
4
)
+
s
1
s
2
s
5
c
5
(
c
1
c
2
c
4
−
s
1
s
4
)
−
c
1
s
2
s
5
−
s
2
c
4
c
5
−
c
2
s
5
]
\omega_{s4}=Rot(\hat z,\theta_1)Rot(\hat x,-\theta_2) \left[ \begin{matrix} 0\\ 0\\ 1 \end{matrix}\right] =\left[ \begin{matrix} -s_1s_2\\ c_1s_2\\ c_2 \end{matrix}\right],\\ \omega_{s5}=Rot(\hat z,\theta_1)Rot(\hat x,-\theta_2)Rot(\hat z,\theta_4) \left[ \begin{matrix} -1\\ 0\\ 0 \end{matrix}\right] =\left[ \begin{matrix} -c_1c_4+s_1c_2s_4\\ -s_1c_4-c_1c_2s_4\\ s_2s_4 \end{matrix}\right],\\ \omega_{s6}=Rot(\hat z,\theta_1)Rot(\hat x,-\theta_2)Rot(\hat z,\theta_4)Rot(\hat x,-\theta_5) \left[ \begin{matrix} 0\\ 1\\ 0 \end{matrix}\right]\\ =\left[ \begin{matrix} -c_5(s_1c_2c_4+c_1s_4)+s_1s_2s_5\\ c_5(c_1c_2c_4-s_1s_4)-c_1s_2s_5\\ -s_2c_4c_5-c_2s_5 \end{matrix}\right]
ωs4=Rot(z^,θ1)Rot(x^,−θ2)⎣⎡001⎦⎤=⎣⎡−s1s2c1s2c2⎦⎤,ωs5=Rot(z^,θ1)Rot(x^,−θ2)Rot(z^,θ4)⎣⎡−100⎦⎤=⎣⎡−c1c4+s1c2s4−s1c4−c1c2s4s2s4⎦⎤,ωs6=Rot(z^,θ1)Rot(x^,−θ2)Rot(z^,θ4)Rot(x^,−θ5)⎣⎡010⎦⎤=⎣⎡−c5(s1c2c4+c1s4)+s1s2s5c5(c1c2c4−s1s4)−c1s2s5−s2c4c5−c2s5⎦⎤
因此,空间雅可比可以写成矩阵的形式为
J
s
(
θ
)
=
[
ω
s
1
ω
s
2
0
ω
s
4
ω
s
5
ω
s
6
0
−
ω
s
2
×
q
2
v
s
3
−
ω
s
4
×
q
w
−
ω
s
5
×
q
w
−
ω
s
6
×
q
w
]
J_s(\theta)=\left[ \begin{matrix} \omega_{s1}&\omega_{s2}&0 &\omega_{s4}&\omega_{s5}& \omega_{s6}\\ 0&-\omega_{s2}\times q_2 & v_{s3}&-\omega_{s4}\times q_w &-\omega_{s5}\times q_w& -\omega_{s6}\times q_w \end{matrix}\right]
Js(θ)=[ωs10ωs2−ωs2×q20vs3ωs4−ωs4×qwωs5−ωs5×qwωs6−ωs6×qw]
注意到,我们不需要对正运动学模型进行微分,就可以直接获得整个雅可比。
算法实现(C语言)
基于指数坐标计算雅可比的算法,我已用C语言实现,包括两个函数JacobianBody和JacobianSpace 。下面只列出这两个函数的实现。代码不断更新迭代,完整的最新源码参见github–链接
/**
* @brief Description: Algorithm module of robotics, according to the
* book[modern robotics : mechanics, planning, and control].
* @file: RobotAlgorithmModule.c
* @author: Brian
* @date: 2019/03/01 12:23
* Copyright(c) 2019 Brian. All rights reserved.
*
* Contact https://blog.csdn.net/Galaxy_Robot
* @warning:
*/
/**
*@brief Description: Computes the body Jacobian Jb(theta) in 6×n given a list of joint screws Bi
expressed in the body frame and a list of joint angles.
*@param[in] Blist The joint screw axes in the end - effector frame when the manipulator is
* at the home position, in the format of a matrix with the screw axes as the row.
*@param[in] thetalist A list of joint coordinates.
*@param[out] Jb Body Jacobian matrix.
*@return No return value.
*@note: when Blist and Jb are matrixes ,make sure that columns number of Slist or Jb is equal to JointNum,
* rows number of Slist or Jb is 6 .The function call should be written as
* JacobianSpace(JointNum,(double *)Slist,thetalist,(double *)Jb).
*@waring:
*/
void JacobianBody(int JointNum,double *Blist, double *thetalist,double *Jb)
{
int i;
int j;
int k;
double T1[4][4];
double T2[4][4];
double se3mat[4][4];
double V[6];
double AdT[6][6];
double T[4][4] = {
1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1
};
//Fist column of Jbn.
for (i=0;i<6;i++)
{
Jb[i*JointNum+JointNum -1] = Blist[i*JointNum + JointNum-1];
}
//Jbi for i=n-1,n-2,...,1.
for (i= JointNum -2;i>=0;i--)
{
for (j=0;j<6;j++)
{
V[j] = -1.0*Blist[j*JointNum+i+1];
}
VecTose3(V, se3mat);
Matrix4MultValue(se3mat, thetalist[i + 1], se3mat);
MatrixExp6(se3mat, T1);
Matrix4Mult(T, T1,T2);
Matrix4Equal(T2, T);
Adjoint(T, AdT);
for (j=0;j<6; j++)
{
Jb[j*JointNum + i] = 0;
for (k=0;k<6;k++)
{
Jb[j*JointNum + i] = Jb[j*JointNum + i] + AdT[j][k] * Blist[k*JointNum + i];
}
}
}
return ;
}
/**
*@brief Description:Computes the space Jacobian Js(theta) in R6 x n given a list of joint screws Si
* expressed in the fixed space frame and a list of joint angles.
*@param[in] Slist The joint screw axes expressed in the fixed space frame when the manipulator is
* at the home position, in the format of a matrix with the screw axes as the column.
*@param[in] thetalist A list of joint coordinates.
*@param[out] Js Space Jacobian matrix.
*@return No return value.
*@note: when Slist and Js are matrixes ,make sure that columns number of Slist or Js is equal to JointNum,
* rows number of Slist or Js is 6 .The function call should be written as
* JacobianSpace(JointNum,(double *)Slist,thetalist,(double *)Js).
*@waring:
*/
void JacobianSpace(int JointNum, double *Slist, double *thetalist, double *Js)
{
int i;
int j;
int k;
double T1[4][4];
double T2[4][4];
double se3mat[4][4];
double V[6];
double AdT[6][6];
double T[4][4] = {
1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1
};
//Fist column of Js.
for (i = 0; i < 6; i++)
{
Js[i*JointNum + 0] = Slist[i*JointNum + 0];
}
//Jsi for i=2,3,...,n.
for (i = 1; i <JointNum; i++)
{
for (j = 0; j < 6; j++)
{
V[j] = Slist[j*JointNum + i - 1];
}
VecTose3(V, se3mat);
Matrix4MultValue(se3mat, thetalist[i - 1], se3mat);
MatrixExp6(se3mat, T1);
Matrix4Mult(T, T1, T2);
Matrix4Equal(T2, T);
Adjoint(T, AdT);
for (j = 0; j < 6; j++)
{
Js[j*JointNum + i] = 0;
for (k = 0; k < 6; k++)
{
Js[j*JointNum + i] = Js[j*JointNum + i] + AdT[j][k] * Slist[k*JointNum + i];
}
}
}
return;
}
参考文献
Kenvin M. Lynch , Frank C. Park, Modern Robotics Mechanics,Planning , and Control. May 3, 2017