Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import rospy
00019 from sensor_msgs.msg import *
00020 from sensor_msgs.srv import *
00021
00022 rospy.init_node('set_camera_info')
00023 rospy.wait_for_service('camera/set_camera_info')
00024 set_camera_info = rospy.ServiceProxy('camera/set_camera_info', SetCameraInfo)
00025 req = SetCameraInfoRequest()
00026 req.camera_info.header.stamp = rospy.Time.now()
00027 req.camera_info.header.frame_id = rospy.get_param('~frame_id')
00028 req.camera_info.height = rospy.get_param('~image_height')
00029 req.camera_info.width = rospy.get_param('~image_width')
00030 req.camera_info.distortion_model = "plumb_bob"
00031 req.camera_info.D = rospy.get_param('~distortion_coefficients/data')
00032 req.camera_info.K = rospy.get_param('~camera_matrix/data')
00033 req.camera_info.R = rospy.get_param('~rectification_matrix/data')
00034 req.camera_info.P = rospy.get_param('~projection_matrix/data')
00035 print req.camera_info
00036 try:
00037 resp1 = set_camera_info(req)
00038 except rospy.ServiceException, e:
00039 print "Service did not process request: %s"%str(e)