Template Class Client
Defined in File agnocast_client.hpp
Nested Relationships
Nested Types
Class Documentation
-
template<typename ServiceT>
class Client Service client for zero-copy Agnocast service communication. The service/client API is experimental and may change in future versions.
- Template Parameters:
ServiceT – The ROS service type (e.g., std_srvs::srv::SetBool).
Public Types
-
using Future = std::future<ipc_shared_ptr<typename ServiceT::Response>>
Future that resolves to the service response. Returned by async_send_request() (no-callback overload).
Shared future that resolves to the service response. Passed to the callback in async_send_request().
Public Functions
-
inline ipc_shared_ptr<typename ServiceT::Request> borrow_loaned_request()
Allocate a request message in shared memory.
- Returns:
Owned pointer to the request message in shared memory.
-
inline const char *get_service_name() const
Return the resolved service name.
- Returns:
Null-terminated service name string.
-
inline bool service_is_ready() const
Check if the service server is available.
- Returns:
True if the service server is available.
-
template<typename RepT, typename RatioT>
inline bool wait_for_service(std::chrono::duration<RepT, RatioT> timeout = std::chrono::nanoseconds(-1)) const Block until the service is available or the timeout expires.
- Parameters:
timeout – Maximum duration to wait (-1 = wait forever).
- Returns:
True if service became available, false on timeout.
Send a request asynchronously and invoke a callback when the response arrives.
- Parameters:
request – Request from borrow_loaned_request(). Must be moved in.
callback – Invoked with a SharedFuture when the response arrives. Call future.get() to obtain the response.
- Returns:
A SharedFutureAndRequestId containing the shared future (
.future) and a sequence number (.request_id).
Send a request asynchronously and return a future for the response.
- Parameters:
request – Request from borrow_loaned_request(). Must be moved in.
- Returns:
A FutureAndRequestId containing the future (
.future) and a sequence number (.request_id). Call.future.get()to block until the response arrives.
-
struct FutureAndRequestId : public rclcpp::detail::FutureAndRequestId<Future>
Return type of async_send_request() (no-callback overload). Contains a Future and the request ID. Access the future via the
futuremember and the request ID viarequest_id.Public Functions
Convert to a SharedFutureAndRequestId by sharing the underlying future.
Return type of async_send_request() (callback overload). Contains a SharedFuture and the request ID. Access the shared future via the
futuremember and the request ID viarequest_id.