Skip to content

Commit 0000db7

Browse files
committed
fix bug in ETS hessian for terms with jindex set
1 parent d6d3bf3 commit 0000db7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

roboticstoolbox/robot/ETS.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,17 +1578,24 @@ def jacob0(self, q, T=None):
15781578
# E = np.zeros((3, 3))
15791579
j = 0
15801580
J = np.zeros((3, self.n))
1581-
jindex = self.joints()
1581+
etjoints = self.joints()
1582+
1583+
if not all([self[i].jindex for i in etjoints]):
1584+
# not all joints have a jindex it is required, set them
1585+
for j in range(self.n):
1586+
i = etjoints[j]
1587+
self[i].jindex = j
1588+
15821589
for j in range(self.n):
1583-
i = jindex[j]
1590+
i = etjoints[j]
15841591

15851592
axis = self[i].axis
15861593
if axis == 'R':
15871594
dTdq = np.array([
15881595
[0, -1, 0],
15891596
[1, 0, 0],
15901597
[0, 0, 0]
1591-
]) @ self[i].eval(q[j]).A
1598+
]) @ self[i].eval(q).A
15921599
elif axis == 'tx':
15931600
dTdq = np.array([
15941601
[0, 0, 1],
@@ -1608,7 +1615,7 @@ def jacob0(self, q, T=None):
16081615

16091616
Ef = self[i+1:]
16101617
if len(Ef) > 0:
1611-
dTdq = dTdq @ Ef.eval(q[j+1:]).A
1618+
dTdq = dTdq @ Ef.eval(q).A
16121619

16131620
T = self.eval(q).A
16141621
dRdt = dTdq[:2, :2] @ T[:2, :2].T

0 commit comments

Comments
 (0)