def set_callback(self, camera_name, callback, callback_args=None,
queue_size=10, rectify_image=True):
"""
Setup the callback function to show image.
@type camera_name: str
@param camera_name: camera name
@type callback: fn(msg, cb_args)
@param callback: function to call when data is received
@type callback_args: any
@param callback_args: additional arguments to pass to the callback
@type queue_size: int
@param queue_size: maximum number of messages to receive at a time
@type rectify_image: bool
@param rectify_image: specify whether subscribe to the rectified or
raw (unrectified) image topic
"""
if self.verify_camera_exists(camera_name):
if rectify_image == True:
if self.cameras_io[camera_name]['is_color']:
image_string = "image_rect_color"
else:
image_string = "image_rect"
else:
image_string = "image_raw"
rospy.Subscriber('/'.join(["/io/internal_camera", camera_name,
image_string]), Image, callback, callback_args=callback_args)
评论列表
文章目录