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


cob_camera_sensors
Author(s): Jan Fischer
autogenerated on Sun Oct 5 2014 23:07:54