Skip to content

Commit 67c9704

Browse files
committed
modify to work with branched robots, returns the length of the longest branch
1 parent 28638ad commit 67c9704

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

roboticstoolbox/robot/ERobot.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -467,14 +467,29 @@ def reach(self):
467467
subsequently change this will not be reflected.
468468
"""
469469
if self._reach is None:
470-
d = 0
471-
for link in self:
472-
for et in link.ets():
473-
if et.isprismatic:
474-
d += abs(et.eta)
475-
if link.isprismatic and link.qlim is not None:
476-
d += link.qlim[1]
477-
self._reach = d
470+
d_all = []
471+
for link in self.ee_links:
472+
d = 0
473+
while True:
474+
for et in link.ets():
475+
if et.istranslation:
476+
if et.isjoint:
477+
# the length of a prismatic joint depends on the
478+
# joint limits. They might be set in the ET
479+
# or in the Link depending on how the robot
480+
# was constructed
481+
if link.qlim is not None:
482+
d += max(link.qlim)
483+
elif et.qlim is not None:
484+
d += max(et.qlim)
485+
else:
486+
d += abs(et.eta)
487+
link = link.parent
488+
if link is None:
489+
d_all.append(d)
490+
break
491+
492+
self._reach = max(d_all)
478493
return self._reach
479494

480495
# --------------------------------------------------------------------- #

0 commit comments

Comments
 (0)