本文整理汇总了Python中message_filters.Subscriber方法的典型用法代码示例。如果您正苦于以下问题:Python message_filters.Subscriber方法的具体用法?Python message_filters.Subscriber怎么用?Python message_filters.Subscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message_filters
的用法示例。
在下文中一共展示了message_filters.Subscriber方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import message_filters [as 别名]
# 或者: from message_filters import Subscriber [as 别名]
def __init__(self, debug=False, init_ros_node=False):
self.debug = debug
self.rgb_raw = None
self.depth_raw = None
self.bridge = CvBridge()
if init_ros_node:
rospy.init_node('image_converter', anonymous=True)
self.image_sub = Subscriber("/camera/rgb/image_rect_color", Image)
self.depth_sub = Subscriber("/camera/depth_registered/image_raw", Image)
self.tss = message_filters.ApproximateTimeSynchronizer([self.image_sub, self.depth_sub],
queue_size=10, slop=0.5)
self.tss.registerCallback(self.callback)
time.sleep(0.5)
if self.debug:
print("Waiting for subscriber to return initial camera feed.")
while self.depth_raw is None:
time.sleep(0.1)
if self.debug:
print('Camera feed initialisation successful.')
示例2: __init__
# 需要导入模块: import message_filters [as 别名]
# 或者: from message_filters import Subscriber [as 别名]
def __init__(self):
super(FaceRecognitionNode, self).__init__()
# init the node
rospy.init_node('face_recognition_node', anonymous=False)
# Get the parameters
(image_topic, detection_topic, output_topic, output_topic_rgb) \
= self.get_parameters()
self._bridge = CvBridge()
# Advertise the result of Object Tracker
self.pub_det = rospy.Publisher(output_topic, \
DetectionArray, queue_size=1)
self.pub_det_rgb = rospy.Publisher(output_topic_rgb, \
Image, queue_size=1)
self.sub_detection = message_filters.Subscriber(detection_topic, \
DetectionArray)
self.sub_image = message_filters.Subscriber(image_topic, Image)
# Scaling factor for face recognition image
self.scaling_factor = 1.0
# Read the images from folder and create a database
self.database = self.initialize_database()
ts = message_filters.ApproximateTimeSynchronizer(\
[self.sub_detection, self.sub_image], 2, 0.3)
ts.registerCallback(self.detection_callback)
# spin
rospy.spin()
示例3: __init__
# 需要导入模块: import message_filters [as 别名]
# 或者: from message_filters import Subscriber [as 别名]
def __init__(self):
super(ProjectionNode, self).__init__()
# init the node
rospy.init_node('projection_node', anonymous=False)
self._bridge = CvBridge()
(depth_topic, face_topic, output_topic, f, cx, cy) = \
self.get_parameters()
# Subscribe to the face positions
sub_obj = message_filters.Subscriber(face_topic,\
DetectionArray)
sub_depth = message_filters.Subscriber(depth_topic,\
Image)
# Advertise the result of Face Depths
self.pub = rospy.Publisher(output_topic, \
DetectionArray, queue_size=1)
# Create the message filter
ts = message_filters.ApproximateTimeSynchronizer(\
[sub_obj, sub_depth], \
2, \
0.9)
ts.registerCallback(self.detection_callback)
self.f = f
self.cx = cx
self.cy = cy
# spin
rospy.spin()
示例4: __init__
# 需要导入模块: import message_filters [as 别名]
# 或者: from message_filters import Subscriber [as 别名]
def __init__(self, topic_name=None, encoding=None):
self.topic_name = topic_name or "/camera/rgb/image_color"
self.encoding = encoding or "bgr8"
self.subcriber = rospy.Subscriber(self.topic_name, Image, self._update_image_msg)
self.bridge = CvBridge()
self._latest_image_msg = None
示例5: __init__
# 需要导入模块: import message_filters [as 别名]
# 或者: from message_filters import Subscriber [as 别名]
def __init__(self, configs):
"""
Constructor for Camera parent class.
:param configs: configurations for camera
:type configs: YACS CfgNode
"""
self.configs = configs
self.cv_bridge = CvBridge()
self.camera_info_lock = threading.RLock()
self.camera_img_lock = threading.RLock()
self.rgb_img = None
self.depth_img = None
self.camera_info = None
self.camera_P = None
rospy.Subscriber(
self.configs.CAMERA.ROSTOPIC_CAMERA_INFO_STREAM,
CameraInfo,
self._camera_info_callback,
)
rgb_topic = self.configs.CAMERA.ROSTOPIC_CAMERA_RGB_STREAM
self.rgb_sub = message_filters.Subscriber(rgb_topic, Image)
depth_topic = self.configs.CAMERA.ROSTOPIC_CAMERA_DEPTH_STREAM
self.depth_sub = message_filters.Subscriber(depth_topic, Image)
img_subs = [self.rgb_sub, self.depth_sub]
self.sync = message_filters.ApproximateTimeSynchronizer(
img_subs, queue_size=10, slop=0.2
)
self.sync.registerCallback(self._sync_callback)
示例6: __init__
# 需要导入模块: import message_filters [as 别名]
# 或者: from message_filters import Subscriber [as 别名]
def __init__(self, rgb_q, depth_q, debug=False):
self.debug = debug
self.rgb_q = rgb_q
self.depth_q = depth_q
self.bridge = CvBridge()
image_sub = Subscriber("/camera/rgb/image_rect_color", Image)
depth_sub = Subscriber("/camera/depth_registered/image_raw", Image)
tss = message_filters.ApproximateTimeSynchronizer([image_sub, depth_sub], queue_size=10,
slop=0.5)
tss.registerCallback(self.callback)
if self.debug:
print('Initialised ImageConverter')
示例7: __init__
# 需要导入模块: import message_filters [as 别名]
# 或者: from message_filters import Subscriber [as 别名]
def __init__(self, rgb_q, depth_q, debug=False):
self.debug = debug
self.rgb_q = rgb_q
self.depth_q = depth_q
self.bridge = CvBridge()
image_sub = Subscriber("/camera/rgb/image_rect_color", Image)
depth_sub = Subscriber("/camera/depth_registered/image_raw", Image)
tss = message_filters.ApproximateTimeSynchronizer([image_sub, depth_sub],queue_size=10, slop=0.5)
tss.registerCallback(self.callback)
if self.debug:
print('Initialised ImageConverter')