head_display.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:intera_sdk 作者: RethinkRobotics 项目源码 文件源码
def display_image(self, image_path, display_in_loop=False, display_rate=1.0):
        """
        Displays image(s) to robot's head

        @type image_path: list
        @param image_path: the relative or absolute file path to the image file(s)

        @type display_in_loop: bool
        @param display_in_loop: Set True to loop through all image files infinitely

        @type display_rate: float
        @param display_rate: the rate to publish image into head
        """
        rospy.logdebug("Display images in loop:'{0}', frequency: '{1}'".format(display_in_loop, display_rate))

        image_msg = []
        image_list = image_path if isinstance(image_path, list) else [image_path]
        for one_path in image_list:
            cv_img = self._setup_image(one_path)
            if cv_img:
                image_msg.append(cv_img)

        if not image_msg:
            rospy.logerr("Image message list is empty")
        else:
            r = rospy.Rate(display_rate)
            while not rospy.is_shutdown():
                for one_msg in image_msg:
                    self._image_pub.publish(one_msg)
                    r.sleep()
                if not display_in_loop:
                    break
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号