Template Class ServiceClient
Defined in File service_client.hpp
Class Documentation
A simple wrapper on ROS2 services client.
Public Types
Public Functions
A constructor.
- Parameters:
service_name – name of the service to call
provided_node – Node to create the service client off of
use_internal_executor – Whether to create an internal executor or not
Invoke the service and block until completed or timed out.
- Parameters:
request – The request object to call the service using
timeout – Maximum timeout to wait for, default infinite
- Returns:
Response A pointer to the service response from the request
Invoke the service and block until completed.
- Parameters:
request – The request object to call the service using
Response – A pointer to the service response from the request
- Returns:
bool Whether it was successfully called
Asynchronously call the service.
- Parameters:
request – The request object to call the service using
- Returns:
std::shared_future<typename ResponseType::SharedPtr> The shared future of the service response
Asynchronously call the service with a callback.
- Parameters:
request – The request object to call the service using
callback – The callback to call when the service response is received
Block until a service is available or timeout.
- Parameters:
timeout – Maximum timeout to wait for, default infinite
- Returns:
bool true if service is available
Spins the executor until the provided future is complete or the timeout is reached.
- Parameters:
future – The shared future to wait for completion.
timeout – The maximum time to wait for the future to complete. Default is -1 (no timeout).
- Returns:
rclcpp::FutureReturnCode indicating the result of the spin operation.
Gets the service name.
- Returns:
string Service name
Stop any running spin operations on the internal executor.
Protected Attributes