Skip to content

Commit d76774e

Browse files
author
Rachel
committed
Removing need for environment in rogue util
1 parent 08b2aa3 commit d76774e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/prpy/util.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,16 +1599,21 @@ def GetManipulatorIndex(robot, manip=None):
15991599

16001600
return (manip, manip_idx)
16011601

1602-
def GetPointFrom(env, focus):
1602+
def GetPointFrom(focus):
16031603
"""
16041604
Given a kinbody, array or transform, returns the xyz
16051605
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
16081607
"""
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():
16121617
focus_trans = focus.GetTransform()
16131618
coord = list(focus_trans[0:3, 3])
16141619

@@ -1626,7 +1631,6 @@ def GetPointFrom(env, focus):
16261631
coord = focus
16271632

16281633
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')
16311635

16321636
return coord

0 commit comments

Comments
 (0)