39 from tf.transformations
import quaternion_matrix, euler_from_matrix
44 PKG =
'hironx_ros_bridge' 51 for av
in [[-0.6, 0, -100, 15.2, 9.4, 3.2]]:
53 self.rarm.send_goal_and_wait(goal)
56 now = rospy.Time.now()
57 self.listener.waitForTransform(
"WAIST",
"RARM_JOINT5_Link", now, rospy.Duration(1.0))
58 (pos_tf, rot_tf) = self.listener.lookupTransform(
"WAIST",
"RARM_JOINT5_Link", now)
59 rot_tf = quaternion_matrix(rot_tf)[0:3,0:3]
60 pos_c = self.robot.getCurrentPosition(
'RARM_JOINT5',
'WAIST')
61 rot_c = self.robot.getCurrentRotation(
'RARM_JOINT5',
'WAIST')
62 numpy.testing.assert_array_almost_equal(pos_tf, pos_c, decimal=3)
63 numpy.testing.assert_array_almost_equal(rot_tf, rot_c, decimal=2)
66 for av
in [[0.6, 0, -100, -15.2, 9.4, -3.2]]:
68 self.larm.send_goal_and_wait(goal)
71 now = rospy.Time.now()
72 self.listener.waitForTransform(
"WAIST",
"LARM_JOINT5_Link", now, rospy.Duration(1.0))
73 (pos_tf, rot_tf) = self.listener.lookupTransform(
"WAIST",
"LARM_JOINT5_Link", now)
74 rot_tf = quaternion_matrix(rot_tf)[0:3,0:3]
75 pos_c = self.robot.getCurrentPosition(
'LARM_JOINT5',
'WAIST')
76 rot_c = self.robot.getCurrentRotation(
'LARM_JOINT5',
'WAIST')
77 numpy.testing.assert_array_almost_equal(pos_tf, pos_c, decimal=3)
78 numpy.testing.assert_array_almost_equal(rot_tf, rot_c, decimal=2)
80 if __name__ ==
'__main__':
82 rostest.rosrun(PKG,
'test_hronx_ros_bridge_controller', TestHiroROSBridgeController)
def test_tf_and_controller(self)
def setup_Positions(self, goal, positions, tm=1.0)