Skip to content

Commit 33ecd1c

Browse files
committed
erobot tests passing
1 parent 30d5c83 commit 33ecd1c

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

examples/swifty.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# env.launch()
1515

1616
# Create a Panda robot object
17-
panda = rtb.models.Panda()
17+
panda = rtb.models.ETS.Panda()
1818

1919
# print(panda)
2020
# print(panda.base_link)

roboticstoolbox/robot/ERobot.py

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def __init__(
139139

140140
# Set the ee links
141141
self.ee_links = []
142-
if gripper_links is None:
142+
if len(gripper_links) == 0:
143143
for link in elinks:
144144
# is this a leaf node? and do we not have any grippers
145145
if len(link.child) == 0:
@@ -525,8 +525,6 @@ def ee_links(self, link):
525525

526526
# --------------------------------------------------------------------- #
527527

528-
# TODO would prefer this was called ets, but that name taken for
529-
# a property earlier
530528
def ets(self, ee=None):
531529
if ee is None:
532530
if len(self.ee_links) == 1:
@@ -625,22 +623,35 @@ def fkine(self, q=None, from_link=None, to_link=None):
625623
if to_link is None:
626624
to_link = self.ee_links[0]
627625

628-
q = self._getq(q)
626+
trajn = 1
627+
628+
if q is None:
629+
q = self.q
630+
631+
try:
632+
q = getvector(q, self.n, 'col')
633+
except ValueError:
634+
trajn = q.shape[1]
635+
verifymatrix(q, (self.n, trajn))
629636

630637
path, _ = self.get_path(from_link, to_link)
631-
j = 0
632-
tr = self.base.A
633638

634-
for link in path:
635-
if link.isjoint:
636-
T = link.A(q[j], fast=True)
637-
j += 1
638-
else:
639-
T = link.A(fast=True)
639+
for i in range(trajn):
640+
tr = self.base.A
641+
for link in path:
642+
if link.isjoint:
643+
T = link.A(q[link.jindex, i], fast=True)
644+
else:
645+
T = link.A(fast=True)
646+
647+
tr = tr @ T
640648

641-
tr = tr @ T
649+
if i == 0:
650+
t = SE3(tr)
651+
else:
652+
t.append(SE3(tr))
642653

643-
return SE3(tr)
654+
return t
644655

645656
def fkine_all(self, q=None):
646657
'''

tests/test_ERobot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_fkine(self):
107107
def test_fkine_traj(self):
108108
panda = rp.models.ETS.Panda()
109109
q = np.array([1.4, 0.2, 1.8, 0.7, 0.1, 3.1, 2.9])
110-
qq = np.r_[q, q, q, q]
110+
qq = np.c_[q, q, q, q]
111111

112112
ans = np.array([
113113
[-0.50827907, -0.57904589, 0.63746234, 0.44682295],
@@ -418,7 +418,7 @@ def test_jacobe(self):
418418
def test_init(self):
419419
l0 = rp.ELink()
420420
l1 = rp.ELink(parent=l0)
421-
r = rp.ERobot([l0, l1], base=sm.SE3.Rx(1.3), base_link=l1, ee_links=l0)
421+
r = rp.ERobot([l0, l1], base=sm.SE3.Rx(1.3), base_link=l1)
422422
r.base_link = l1
423423

424424
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)