Skip to content

Commit 0b1def4

Browse files
author
David Butterworth
committed
Remove dependency on TF and improved input checking for GetForwardKinematics()
1 parent 28a32d5 commit 0b1def4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/prpy/util.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,6 @@ def GetForwardKinematics(robot, q, manipulator=None, frame=None):
10401040
@returns T_ee: The pose of the end effector (or last link in the
10411041
serial chain) as a 4x4 matrix.
10421042
"""
1043-
from tf import transformations
1044-
10451043
if manipulator == None:
10461044
manipulator = robot.GetActiveManipulator()
10471045

@@ -1057,8 +1055,12 @@ def GetForwardKinematics(robot, q, manipulator=None, frame=None):
10571055
# Robot state is restored
10581056

10591057
if frame != None:
1060-
T_ref_frame = robot.GetLink(frame).GetTransform()
1061-
T_ee = transformations.concatenate_matrices(numpy.linalg.inv(T_ref_frame), T_ee)
1058+
link = robot.GetLink(frame)
1059+
if link == None:
1060+
raise ValueError('Failed to get link \'{:s}\''.format(frame))
1061+
1062+
T_ref_frame = link.GetTransform()
1063+
T_ee = numpy.dot(numpy.linalg.inv(T_ref_frame), T_ee)
10621064

10631065
return T_ee
10641066

0 commit comments

Comments
 (0)