@@ -1599,16 +1599,21 @@ def GetManipulatorIndex(robot, manip=None):
1599
1599
1600
1600
return (manip , manip_idx )
1601
1601
1602
- def GetPointFrom (env , focus ):
1602
+ def GetPointFrom (focus ):
1603
1603
"""
1604
1604
Given a kinbody, array or transform, returns the xyz
1605
1605
location.
1606
- param env The environment where the item exists
1607
- param focus THe area to be referred to
1606
+ param focus The area to be referred to
1608
1607
"""
1609
- #Pointing at an object
1610
- if isinstance (focus , (openravepy .KinBody , openravepy .KinBody .Link )):
1611
- with env :
1608
+ #Pointing at a kinbody
1609
+ if isinstance (focus , openravepy .KinBody ):
1610
+ with focus .GetEnv ():
1611
+ focus_trans = focus .GetTransform ()
1612
+ coord = list (focus_trans [0 :3 , 3 ])
1613
+
1614
+ #Pointing at a kinbody link
1615
+ elif isinstance (focus , openravepy .KinBody .Link ):
1616
+ with focus .GetParent ().GetEnv ():
1612
1617
focus_trans = focus .GetTransform ()
1613
1618
coord = list (focus_trans [0 :3 , 3 ])
1614
1619
@@ -1626,7 +1631,6 @@ def GetPointFrom(env, focus):
1626
1631
coord = focus
1627
1632
1628
1633
else :
1629
- raise prpy .exceptions .PrPyException (
1630
- 'Focus of the point is an unknown object' )
1634
+ raise ValueError ('Focus of the point is an unknown object' )
1631
1635
1632
1636
return coord
0 commit comments