rclpy.experimental.async_client module
- class rclpy.experimental.async_client.AsyncClient(context: ~rclpy.context.Context, client_impl: object, srv_type: ~typing.Type[rosidl_pycommon.interface_base_classes.BaseService.(~SrvRequestT, ~SrvResponseT).(~SrvRequestT, ~SrvResponseT)], srv_name: str, qos_profile: rclpy.qos.QoSProfile, on_destroy: ~typing.Callable[[~rclpy.experimental.async_client.AsyncClient], None], tg: ~asyncio.taskgroups.TaskGroup | None = None)
Bases:
BaseClient[SrvRequestT,SrvResponseT]A client of a ROS service.
Experimental
This API is experimental.
Create a container for a ROS service client.
Warning
Users should not create a service client with this constructor, instead they should call
Node.create_client()orAsyncNode.create_client().- async call(request: SrvRequestT) SrvResponseT
Send a service request and await the response.
- async wait_for_service(*, check_interval: float = 0.1) None
Wait for a service server to become ready.
To apply a timeout, wrap the call with
async with asyncio.timeout().- Parameters:
check_interval – Seconds between checks. Defaults to 0.1.