@@ -506,7 +506,7 @@ def ets(self, start=None, end=None, explored=None, path=None):
506
506
>>> panda = rtb.models.ETS.Panda()
507
507
>>> panda.ets()
508
508
"""
509
- v = self ._getlink (start , self .base_link )
509
+ link = self ._getlink (start , self .base_link )
510
510
if end is None and len (self .ee_links ) > 1 :
511
511
raise ValueError (
512
512
'ambiguous, specify which end-effector is required' )
@@ -516,34 +516,38 @@ def ets(self, start=None, end=None, explored=None, path=None):
516
516
explored = set ()
517
517
toplevel = path is None
518
518
519
- explored .add (v )
520
- if v == end :
519
+ explored .add (link )
520
+ if link == end :
521
521
return path
522
522
523
523
# unlike regular DFS, the neighbours of the node are its children
524
524
# and its parent.
525
525
526
- # visit child nodes
526
+ # visit child nodes below start
527
527
if toplevel :
528
- path = v .ets ()
529
- for w in v .children :
530
- if w not in explored :
531
- p = self .ets (w , end , explored , path * w .ets ())
532
- if p :
528
+ path = link .ets ()
529
+ for child in link .children :
530
+ if child not in explored :
531
+ p = self .ets (child , end , explored , path * child .ets ())
532
+ if p is not None :
533
533
return p
534
534
535
- # visit parent node
535
+ # we didn't find the node below, keep going up a level, and recursing
536
+ # down again
536
537
if toplevel :
537
- path = ETS ()
538
- if v .parent is not None :
539
- w = v .parent
540
- if w not in explored :
541
- p = self .ets (w , end , explored , path * v .ets ().inv ())
542
- if p :
538
+ path = None
539
+ if link .parent is not None :
540
+ parent = link .parent # go up one level toward the root
541
+ if parent not in explored :
542
+ if path is None :
543
+ p = self .ets (parent , end , explored , link .ets ().inv ())
544
+ else :
545
+ p = self .ets (parent , end , explored , path * link .ets ().inv ())
546
+ if p is not None :
543
547
return p
544
-
545
548
return None
546
549
550
+
547
551
# --------------------------------------------------------------------- #
548
552
549
553
def showgraph (self , ** kwargs ):
@@ -745,8 +749,8 @@ def _get_limit_links(self, end=None, start=None):
745
749
"""
746
750
747
751
# Try cache
748
- if self ._cache_end is not None :
749
- return self ._cache_end , self ._cache_start , self ._cache_end_tool
752
+ # if self._cache_end is not None:
753
+ # return self._cache_end, self._cache_start, self._cache_end_tool
750
754
751
755
tool = None
752
756
if end is None :
@@ -900,8 +904,8 @@ def URDF(cls, file_path, gripper=None):
900
904
Construct an ERobot object from URDF file
901
905
:param file_path: [description]
902
906
:type file_path: [type]
903
- :param gripper: index or name of the gripper link
904
- :type gripper: int or str
907
+ :param gripper: index or name of the gripper link(s)
908
+ :type gripper: int or str or list
905
909
:return: [description]
906
910
:rtype: [type]
907
911
If ``gripper`` is specified, links from that link outward are removed
@@ -922,7 +926,9 @@ def URDF(cls, file_path, gripper=None):
922
926
else :
923
927
raise TypeError ('bad argument passed as gripper' )
924
928
925
- return cls (links , name = name , gripper = gripper )
929
+ links , name = ERobot .URDF_read (file_path )
930
+
931
+ return cls (links , name = name , gripper_links = gripper )
926
932
927
933
def _reset_cache (self ):
928
934
self ._path_cache = {}
@@ -1126,7 +1132,8 @@ def fkine(
1126
1132
T = SE3 .Empty ()
1127
1133
1128
1134
for k , qk in enumerate (q ):
1129
- qk = self .toradians (qk )
1135
+ if unit == 'deg' :
1136
+ qk = self .toradians (qk )
1130
1137
link = end # start with last link
1131
1138
1132
1139
# add tool if provided
@@ -1998,9 +2005,9 @@ def jacob0(self, q):
1998
2005
def jacobe (self , q ):
1999
2006
return self .ets ().jacobe (q )
2000
2007
2001
- def fkine (self , q , unit = 'rad' ):
2008
+ def fkine (self , q , unit = 'rad' , end = None , start = None ):
2002
2009
2003
- return self .ets ().eval (q , unit = unit )
2010
+ return self .ets (start , end ).eval (q , unit = unit )
2004
2011
# --------------------------------------------------------------------- #
2005
2012
2006
2013
def plot (
@@ -2185,6 +2192,7 @@ def teach(
2185
2192
return env
2186
2193
2187
2194
2195
+
2188
2196
if __name__ == "__main__" : # pragma nocover
2189
2197
2190
2198
# import roboticstoolbox as rtb
0 commit comments