39 from tf.transformations 
import quaternion_matrix, euler_from_matrix
    44 PKG = 
'hironx_ros_bridge'    54         for torso_angle 
in ([0, -10, 10]):
    57             self.torso.send_goal_and_wait(torso_goal)
    58             for p 
in [[ 0.325, 0.182, 0.074], 
    59                       [ 0.3, -0.2, 0.074], [ 0.3, -0.1, 0.074], 
    61                       [ 0.3,  0.2, 0.074], [ 0.3,  0.3, 0.074],
    62                       [ 0.4, -0.1, 0.074], [ 0.4, -0.0, 0.074],
    64                       [ 0.4,  0.3, 0.074], [ 0.4,  0.4, 0.074],
    67                 print "solve ik at p = ", p
    69                 self.assertTrue(ret.operation_return, 
"ik failed")
    71                 self.assertTrue(ret.operation_return, 
"wait interpolation failed")
    74                 now = rospy.Time.now()
    75                 self.listener.waitForTransform(
"WAIST", 
"LARM_JOINT5_Link", now, rospy.Duration(1.0))
    76                 (trans, rot) = self.listener.lookupTransform(
"WAIST", 
"LARM_JOINT5_Link", now)
    77                 numpy.testing.assert_array_almost_equal(trans, p, decimal=1)
    78                 print "current position   p = ", trans
    80                 print "                     = ", quaternion_matrix(rot)[0:3,0:3]
    92                                            [  25,-139,-157,  45,   0,   0],
    93                                            [ 0.618, -0.157,-100.0,-15.212, 9.501, -3.188]])
    94         self.larm.send_goal_and_wait(goal)
    97         now = rospy.Time.now()
    98         self.listener.waitForTransform(
"WAIST", 
"LARM_JOINT5_Link", now, rospy.Duration(1.0))
    99         (trans, rot) = self.listener.lookupTransform(
"WAIST", 
"LARM_JOINT5_Link", now)
   100         numpy.testing.assert_array_almost_equal(trans, [0.325493, 0.18236, 0.0744674], decimal=3)
   101         numpy.testing.assert_array_almost_equal(quaternion_matrix(rot)[0:3,0:3],
   102                                                 numpy.array([[ 0, 0,-1],
   104                                                              [ 1, 0, 0]]), decimal=2)
   109                                            [  25,-139,-157,  45,   0,   0],
   110                                            [-0.618, -0.157,-100.0,15.212, 9.501, 3.188]])
   111         self.rarm.send_goal_and_wait(goal)
   114         now = rospy.Time.now()
   115         self.listener.waitForTransform(
"WAIST", 
"RARM_JOINT5_Link", now, rospy.Duration(1.0))
   116         (trans, rot) = self.listener.lookupTransform(
"WAIST", 
"RARM_JOINT5_Link", now)
   117         numpy.testing.assert_array_almost_equal(trans, [0.325493,-0.18236, 0.0744674], decimal=3)
   118         numpy.testing.assert_array_almost_equal(quaternion_matrix(rot)[0:3,0:3],
   119                                                 numpy.array([[ 0, 0,-1],
   121                                                              [ 1, 0, 0]]), decimal=2)
   128         self.torso.send_goal_and_wait(goal)
   131         now = rospy.Time.now()
   132         self.listener.waitForTransform(
"WAIST", 
"CHEST_JOINT0_Link", now, rospy.Duration(1.0))
   133         (trans, rot) = self.listener.lookupTransform(
"WAIST", 
"CHEST_JOINT0_Link", now)
   134         numpy.testing.assert_array_almost_equal(trans, [0.0, 0.0, 0.0], decimal=3)
   135         numpy.testing.assert_array_almost_equal(quaternion_matrix(rot)[0:3,0:3],
   136                                                 numpy.array([[-0.956044, -0.293223, 0.0],
   137                                                              [ 0.293223, -0.956044, 0.0],
   138                                                              [ 0.0,       0.0,      1.0]]), decimal=3)
   145         self.head.send_goal_and_wait(goal)
   148         now = rospy.Time.now()
   149         self.listener.waitForTransform(
"WAIST", 
"HEAD_JOINT1_Link", now, rospy.Duration(1.0))
   150         (trans, rot) = self.listener.lookupTransform(
"WAIST", 
"HEAD_JOINT1_Link", now)
   151         numpy.testing.assert_array_almost_equal(trans, [0.0, 0.0, 0.5695], decimal=3)
   152         numpy.testing.assert_array_almost_equal(quaternion_matrix(rot)[0:3,0:3],
   153                                                 numpy.array([[0.321394, 0.939693, -0.116978],
   154                                                              [-0.883022, 0.34202, 0.321394],
   155                                                              [0.34202, 0.0, 0.939693]]), decimal=3)
   157 if __name__ == 
'__main__':
   159     rostest.rosrun(PKG, 
'test_hronx_ros_bridge_pose', TestHiroROSBridgePose)
 
wait_interpolation_of_group
def setup_Positions(self, goal, positions, tm=1.0)