base.py 文件源码

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

项目:needybot-core 作者: needybot 项目源码 文件源码
def register_services(self, services):

        """
        Similar to `pub_sub.create_publishers` and `pub_sub.create_subscribers`,
        this method takes a list of service definition pairs, and registers
        a `rospy.Service` object for each.

        Because services must be uniquely namespaced, each service will be
        exposed externally using the class's namespace as defined at
        construction time. This means services map as follows

        /self.namespace_method       ->       self.method(req)

        Each pair consists of the name of the service and its service type, as
        defined by a .srv file.
        """

        for service in services:
            callback_name, service_type = service
            service_name = '{}_{}'.format(self.namespace, callback_name)
            callback = getattr(self, callback_name)
            self.registered.append(rospy.Service(service_name, service_type, callback))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号