8#include <rclcpp/rclcpp.hpp>
13#include <mrs_lib/coro/internal/thread_local_continuation_scheduler.hpp>
14#include <mrs_lib/coro/task.hpp>
24 template <
class ServiceType>
40 ServiceClientHandler(rclcpp::Node::SharedPtr& node,
const std::string& address,
const rclcpp::QoS& qos = rclcpp::ServicesQoS());
60 ServiceClientHandler(rclcpp::Node::SharedPtr& node,
const std::string& address,
const rclcpp::QoS& qos,
61 const rclcpp::CallbackGroup::SharedPtr& callback_group);
72 ServiceClientHandler(rclcpp::Node::SharedPtr& node,
const std::string& address,
const rclcpp::CallbackGroup::SharedPtr& callback_group);
87 std::optional<std::shared_ptr<typename ServiceType::Response>>
callSync(
const std::shared_ptr<typename ServiceType::Request>& request);
96 std::optional<std::shared_future<std::shared_ptr<typename ServiceType::Response>>>
callAsync(
const std::shared_ptr<typename ServiceType::Request>& request);
132 template <
typename RepT =
int64_t,
typename RatioT = std::milli>
133 bool waitForService(std::chrono::duration<RepT, RatioT> timeout = std::chrono::seconds(1));
156 std::shared_ptr<Impl> impl_;
implementation of the service client handler
Definition service_client_handler.hpp:161
user wrapper of the service client handler implementation
Definition service_client_handler.h:26
ServiceClientHandler()
Default constructor to avoid having to use pointers.
Definition service_client_handler.hpp:28
std::optional< std::shared_ptr< typename ServiceType::Response > > callSync(const std::shared_ptr< typename ServiceType::Request > &request)
Synchronous (blocking) call of the service.
Definition service_client_handler.hpp:52
std::string getServiceName() const
Returns the name of the service this client connects to.
Definition service_client_handler.hpp:96
bool waitForService(std::chrono::duration< RepT, RatioT > timeout=std::chrono::seconds(1))
Waits for the service to be available.
Definition service_client_handler.hpp:112
std::optional< std::shared_future< std::shared_ptr< typename ServiceType::Response > > > callAsync(const std::shared_ptr< typename ServiceType::Request > &request)
Asynchronous (non-blocking) call of the service.
Definition service_client_handler.hpp:68
size_t prunePendingRequests()
Clean all pending requests.
Definition service_client_handler.hpp:139
bool isServiceReady() const
Checks if the service is available.
Definition service_client_handler.hpp:126
Task< std::optional< std::shared_ptr< typename ServiceType::Response > > > callAwaitable(std::shared_ptr< typename ServiceType::Request > request)
Awaitable call of the service.
Definition service_client_handler.hpp:82
Task type for creating coroutines.
Definition task.hpp:268
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition attitude_converter.h:24
Implements ServiceClientHandler and related convenience classes for upgrading the ROS service client.