master_sync.py 文件源码

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

项目:multimaster_udp 作者: AlexisTM 项目源码 文件源码
def spin(self):
        # @todo: is this excessively hitting the master?
        r = rospy.Rate(10.0)

        while not rospy.is_shutdown():
            for srv in self._local_services:
                srv_uri = self._local_manager.lookup_service(srv)
                if srv_uri:
                    self._foreign_manager.advertise_service(srv, srv_uri)
                else:
                    self._foreign_manager.unadvertise_service(srv)

            for srv in self._foreign_services:
                srv_uri = self._foreign_manager.lookup_service(srv)
                if srv_uri:
                    self._local_manager.advertise_service(srv, srv_uri)
                else:
                    self._local_manager.unadvertise_service(srv)

            r.sleep()

        if self._local_manager:
            self._local_manager.unsubscribe_all()
        if self._foreign_manager:
            self._foreign_manager.unsubscribe_all()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号