@@ -598,8 +598,8 @@ def test_SampleTimeGenerator_EndPointLessThanHalfStepSize(self):
598
598
599
599
# GetForwardKinematics()
600
600
601
- def test_GetForwardKinematics (self ):
602
- # Zero configuration, use thes the active manipulator by default
601
+ def test_GetForwardKinematics_UseActiveManipulator (self ):
602
+ # Zero configuration, uses the the active manipulator by default
603
603
q0 = numpy .array ([0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ])
604
604
T_ee = prpy .util .GetForwardKinematics (self .robot , q0 )
605
605
@@ -613,6 +613,7 @@ def test_GetForwardKinematics(self):
613
613
numpy .testing .assert_array_almost_equal (T_ee , expected_T_ee0 , decimal = 7 , \
614
614
err_msg = error , verbose = True )
615
615
616
+ def test_GetForwardKinematics_SpecifyManipulator (self ):
616
617
# A different configuration, specifying the manipulator to use
617
618
q1 = numpy .array ([- 1.8 , 0.0 , - 0.7 , 2.0 , 0.5 , 0.2 , 0.0 ])
618
619
manip = self .robot .GetActiveManipulator ()
@@ -628,6 +629,31 @@ def test_GetForwardKinematics(self):
628
629
numpy .testing .assert_array_almost_equal (T_ee , expected_T_ee1 , decimal = 7 , \
629
630
err_msg = error , verbose = True )
630
631
632
+ def test_GetForwardKinematics_SpecifyFrame (self ):
633
+ # Get the FK with respect to the base frame ('segway') of the
634
+ # manipulator chain. This should give the same result as not
635
+ # specifying the reference frame at all.
636
+ q1 = numpy .array ([- 1.8 , 0.0 , - 0.7 , 2.0 , 0.5 , 0.2 , 0.0 ])
637
+ manip = self .robot .GetActiveManipulator ()
638
+ frame = 'segway'
639
+ T_ee = prpy .util .GetForwardKinematics (self .robot , q1 , manip , frame )
640
+
641
+ expected_T_ee2 = numpy .array ([[ 0.7126777 , 0.3653714 , - 0.5988272 , - 0.3313395 ],
642
+ [- 0.0541115 , - 0.8224716 , - 0.5662263 , - 0.3259651 ],
643
+ [- 0.6994014 , 0.4359404 , - 0.5663864 , 1.4394693 ],
644
+ [ 0.0 , 0.0 , 0.0 , 1.0 ]])
645
+
646
+ # We need to transform the expected result along the z-axis
647
+ # because the Segway-WAM model is strange
648
+ T_segway = self .robot .GetLink ('segway' ).GetTransform ()
649
+ expected_T_ee2 = numpy .dot (numpy .linalg .inv (T_segway ), expected_T_ee2 )
650
+
651
+ error = 'The end-effector transform ' + str (T_ee ) + \
652
+ ' does not equal the expected end-effector' + \
653
+ ' transform ' + str (expected_T_ee2 )
654
+ numpy .testing .assert_array_almost_equal (T_ee , expected_T_ee2 , decimal = 7 , \
655
+ err_msg = error , verbose = True )
656
+
631
657
632
658
class Test_GetPointFrom (unittest .TestCase ):
633
659
"""
0 commit comments