Skip to content

Commit d9836f3

Browse files
author
David Butterworth
committed
Add optional 'manipulator' argument, save LinkTransformation, GetEndEffectorTransform()
1 parent 7c3f6e8 commit d9836f3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/prpy/util.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ def CheckJointLimits(robot, q):
10271027
description='position')
10281028

10291029

1030-
def GetForwardKinematics(robot, q):
1030+
def GetForwardKinematics(robot, q, manipulator=None):
10311031
"""
10321032
Get the forward kinematics for a specific joint configuration.
10331033
@@ -1037,14 +1037,20 @@ def GetForwardKinematics(robot, q):
10371037
@returns T_ee: The pose of the end effector (or last link in the
10381038
serial chain) as a 4x4 matrix.
10391039
"""
1040+
if manipulator == None:
1041+
manipulator = GetActiveManipulator()
1042+
10401043
T_ee = None
10411044

10421045
# Save the robot state
10431046
sp = openravepy.Robot.SaveParameters
1044-
with robot.CreateRobotStateSaver():
1047+
robot_saver = robot.CreateRobotStateSaver(sp.LinkTransformation)
1048+
1049+
with robot_saver:
10451050
robot.SetActiveDOFValues(q)
1046-
T_ee = robot.GetActiveManipulator().GetTransform()
1051+
T_ee = robot.manipulator.GetEndEffectorTransform()
10471052
# Robot state is restored
1053+
10481054
return T_ee
10491055

10501056

0 commit comments

Comments
 (0)