Beispiel #1
0
    def create_client(self,
                      srv_type,
                      srv_name: str,
                      *,
                      qos_profile: QoSProfile = qos_profile_services_default,
                      callback_group: CallbackGroup = None) -> Client:
        """
        Create a new service client.

        :param srv_type: The service type.
        :param srv_name: The name of the service.
        :param qos_profile: The quality of service profile to apply the service client.
        :param callback_group: The callback group for the service client. If ``None``, then the
            nodes default callback group is used.
        """
        if callback_group is None:
            callback_group = self.default_callback_group
        check_for_type_support(srv_type)
        failed = False
        try:
            [client_handle, client_pointer
             ] = _rclpy.rclpy_create_client(self.handle, srv_type, srv_name,
                                            qos_profile.get_c_qos_profile())
        except ValueError:
            failed = True
        if failed:
            self._validate_topic_or_service_name(srv_name, is_service=True)
        client = Client(self.handle, self.context, client_handle,
                        client_pointer, srv_type, srv_name, qos_profile,
                        callback_group)
        self.clients.append(client)
        callback_group.add_entity(client)
        return client
Beispiel #2
0
    def __init__(self, node):
        super().__init__(ReentrantCallbackGroup())

        self.client = _rclpy.rclpy_create_client(
            node.handle, EmptySrv, 'test_client', qos_profile_default.get_c_qos_profile())[0]
        self.client_index = None
        self.client_is_ready = False

        self.node = node
        self.future = None
    def __init__(self, node):
        super().__init__(ReentrantCallbackGroup())

        with node.handle as node_capsule:
            self.client = _rclpy.rclpy_create_client(
                node_capsule, EmptySrv, 'test_client', QoSProfile(depth=10).get_c_qos_profile())
        self.client_index = None
        self.client_is_ready = False

        self.node = node
        self.future = None
Beispiel #4
0
 def create_client(self, srv_type, srv_name, qos_profile=qos_profile_services_default):
     if srv_type.__class__._TYPE_SUPPORT is None:
         srv_type.__class__.__import_type_support__()
     if srv_type.__class__._TYPE_SUPPORT is None:
         raise NoTypeSupportImportedException
     [client_handle, client_pointer] = _rclpy.rclpy_create_client(
         self.handle,
         srv_type,
         srv_name,
         qos_profile.get_c_qos_profile())
     client = Client(
         self.handle, client_handle, client_pointer, srv_type, srv_name, qos_profile)
     self.clients.append(client)
     return client
Beispiel #5
0
 def create_client(self,
                   srv_type,
                   srv_name,
                   *,
                   qos_profile=qos_profile_services_default,
                   callback_group=None):
     if callback_group is None:
         callback_group = self._default_callback_group
     check_for_type_support(srv_type)
     failed = False
     try:
         [client_handle, client_pointer
          ] = _rclpy.rclpy_create_client(self.handle, srv_type, srv_name,
                                         qos_profile.get_c_qos_profile())
     except ValueError:
         failed = True
     if failed:
         self._validate_topic_or_service_name(srv_name, is_service=True)
     client = Client(self.handle, client_handle, client_pointer, srv_type,
                     srv_name, qos_profile, callback_group)
     self.clients.append(client)
     callback_group.add_entity(client)
     return client