mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
service_client_handler.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <rclcpp/rclcpp.hpp>
9
10#include <string>
11#include <future>
12
13namespace mrs_lib
14{
15
16 /* class ServiceClientHandler //{ */
17
21 template <class ServiceType>
23
24 public:
25
37 ServiceClientHandler(rclcpp::Node::SharedPtr& node, const std::string& address, const rclcpp::QoS& qos = rclcpp::ServicesQoS());
38
46
57 ServiceClientHandler(rclcpp::Node::SharedPtr& node, const std::string& address, const rclcpp::QoS& qos, const rclcpp::CallbackGroup::SharedPtr& callback_group);
58
68 ServiceClientHandler(rclcpp::Node::SharedPtr& node, const std::string& address, const rclcpp::CallbackGroup::SharedPtr& callback_group);
69
83 std::optional<std::shared_ptr<typename ServiceType::Response>> callSync(const std::shared_ptr<typename ServiceType::Request>& request);
84
92 std::optional<std::shared_future<std::shared_ptr<typename ServiceType::Response>>> callAsync(const std::shared_ptr<typename ServiceType::Request>& request);
93
94 private:
95 class Impl;
96 std::shared_ptr<Impl> impl_;
97 };
98
99 //}
100
101} // namespace mrs_lib
102
implementation of the service client handler
Definition service_client_handler.hpp:85
user wrapper of the service client handler implementation
Definition service_client_handler.h:22
ServiceClientHandler()
Default constructor to avoid having to use pointers.
Definition service_client_handler.hpp:26
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:48
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:63
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.