3 from jsk_topic_tools
import ConnectionBasedTransport
5 from sensor_msgs.msg
import CameraInfo
11 super(VirtualCameraInfoPublisher, self).
__init__()
12 self.
frame_id = rospy.get_param(
'~frame_id',
None)
13 self.
pub = self.advertise(
14 '~output/camera_info', CameraInfo, queue_size=1)
15 self.
height = rospy.get_param(
'~height',
None)
16 self.
width = rospy.get_param(
'~width',
None)
19 self.
sub = rospy.Subscriber(
'~input/camera_info', CameraInfo, self.
_cb)
24 def _cb(self, info_msg):
29 info_msg.header.frame_id = self.
frame_id
31 if self.
height is not None:
32 info_msg.height = self.
height
36 if self.
width is not None:
37 info_msg.width = self.
width
38 K[2] = self.
width // 2
39 P[2] = self.
width // 2
47 self.
pub.publish(info_msg)
50 if __name__ ==
'__main__':
51 rospy.init_node(
'virtual_camera_info_publisher')