proxy.py 文件源码

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

项目:Cloudroid 作者: cyberdb 项目源码 文件源码
def on_message(self, ws, message):
        data = json.loads(message)

        ts = get_message_timestamp(data['msg'])
        if not comp_and_replace_value(data['topic'], self.topic_type, ts):
            return

        rosmsg = self.rostype()
        if not data or data['op'] != 'publish' or data['topic'] != self.topic_name:
            rospy.logerr('Failed to handle message on subscribed topic %s [%s]', self.topic_name, data)
            return

        data.pop('_format', None)      
        try:
            msgconv.populate_instance(data['msg'], rosmsg)
            self.publisher.publish(rosmsg)
        except Exception, e:
            rospy.logerr('Failed to publish message on topic %s. Reason: %s', self.topic_name, str(e))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号