当前位置: 首页>>代码示例>>Python>>正文


Python message_filters.Subscriber方法代码示例

本文整理汇总了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.') 
开发者ID:nebbles,项目名称:DE3-ROB1-CHESS,代码行数:27,代码来源:camera_subscriber.py

示例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() 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:39,代码来源:face_recognizer.py

示例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() 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:38,代码来源:projection.py

示例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 
开发者ID:alexlee-gk,项目名称:visual_dynamics,代码行数:10,代码来源:camera_sensor.py

示例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) 
开发者ID:facebookresearch,项目名称:pyrobot,代码行数:32,代码来源:core.py

示例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') 
开发者ID:nebbles,项目名称:DE3-ROB1-CHESS,代码行数:17,代码来源:camera_subscriber_processes.py

示例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') 
开发者ID:nebbles,项目名称:DE3-ROB1-CHESS,代码行数:16,代码来源:camera_subscriber.py


注:本文中的message_filters.Subscriber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。