Skip to content

Commit 73aaef5

Browse files
committed
Changed parent of ETS
1 parent e32a52c commit 73aaef5

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

roboticstoolbox/backend/urdf/urdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,15 +1718,15 @@ def __init__(self, name, links, joints=None,
17181718
for j in range(len(elinks)):
17191719
if i != j:
17201720
if self.joints[i].parent == self.joints[j].child:
1721-
elinks[i]._parent.append(elinks[j])
1721+
elinks[i]._parent = elinks[j]
17221722
found = True
17231723

17241724
if not found:
17251725
link = self._link_map[self.joints[i].parent]
17261726
base_link = rp.ELink(
17271727
rp.ET(),
17281728
name=link.name)
1729-
elinks[i]._parent.append(base_link)
1729+
elinks[i]._parent = base_link
17301730
try:
17311731
for visual in link.visuals:
17321732
base_link.geometry.append(visual.geometry.ob)

roboticstoolbox/robot/ELink.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,12 @@ def __init__(
7575
self._name = name
7676

7777
if isinstance(parent, ELink):
78-
parent = [parent]
78+
pass
7979
elif parent is None:
80-
parent = []
81-
elif not isinstance(parent, list):
80+
pass
81+
elif isinstance(parent, list):
8282
raise TypeError(
83-
'The parent link must be of type ELink'
84-
' or list of Elink')
83+
'Only one parent link can be present')
8584

8685
self._parent = parent
8786
self._child = []
@@ -118,6 +117,9 @@ def __init__(
118117
self.Tc = Tc
119118
self.G = G
120119

120+
def __repr__(self):
121+
return self.name
122+
121123
@property
122124
def collision(self):
123125
return self._collision

roboticstoolbox/robot/ETS.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def __init__(
7474
raise TypeError('The links must be stored in a list.')
7575

7676
self._ets = []
77+
self._elinks = {}
7778
self._n = 0
7879
self._M = 0
7980
self._q_idx = []
@@ -82,6 +83,7 @@ def __init__(
8283
for link in elinks:
8384
if isinstance(link, ELink):
8485
self._M += 1
86+
self._elinks[link.name] = link
8587
else:
8688
raise TypeError("Input can be only ELink")
8789

@@ -90,11 +92,12 @@ def __init__(
9092
self.root = []
9193
self.end = []
9294
for link in elinks:
93-
for li in link.parent:
94-
li._child.append(link)
95-
96-
if len(link.parent) == 0:
95+
if link.parent is None:
9796
self.root.append(link)
97+
else:
98+
link.parent._child.append(link)
99+
100+
98101

99102
# Find the bottom of the tree
100103
for link in elinks:
@@ -336,6 +339,10 @@ def qlim(self):
336339

337340
return v
338341

342+
@property
343+
def elinks(self):
344+
return self._elinks
345+
339346
@property
340347
def base_link(self):
341348
return self._base_link
@@ -570,7 +577,7 @@ def fkine_all(self, q=None):
570577
else:
571578
t = self.ets[i].A()
572579

573-
self.ets[i]._fk = self.ets[i].parent[0]._fk * t
580+
self.ets[i]._fk = self.ets[i].parent._fk * t
574581

575582
# Update the collision objects transform as well
576583
for col in self.ets[i].collision:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy