00001
00002
00003 PKG = 'camera_pose_calibration'
00004 import roslib; roslib.load_manifest(PKG)
00005 import rospy
00006
00007
00008 import tf
00009 import PyKDL
00010 import unittest
00011 import rostest
00012
00013
00014 class TestCameraPose(unittest.TestCase):
00015 def test_one(self):
00016
00017
00018 tf_listener = tf.TransformListener()
00019 fr1 = 'camera_a/openni_depth_optical_frame'
00020 fr2 = 'camera_c/prosilica_optical_frame'
00021
00022
00023
00024
00025
00026
00027
00028
00029 tf_listener.waitForTransform(fr1, fr2, rospy.Time(0), rospy.Duration(60))
00030 ((x, y, z), (rx, ry, rz, rw)) = tf_listener.lookupTransform(fr1, fr2, rospy.Time(0))
00031 self.assertAlmostEqual(x, -0.011, 1)
00032 self.assertAlmostEqual(y, 0.027, 1)
00033 self.assertAlmostEqual(z, 0.048, 1)
00034 self.assertAlmostEqual(rx, 0.022, 1)
00035 self.assertAlmostEqual(ry, 0.007, 1)
00036 self.assertAlmostEqual(rz, -0.006, 1)
00037 self.assertAlmostEqual(rw, 1.00, 1)
00038
00039
00040
00041 if __name__ == "__main__":
00042 rospy.init_node('test_camera_pose_calibration')
00043 rostest.rosrun(PKG, 'test_camera_pose_calibration', TestCameraPose)