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
25 public:
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,
58 const rclcpp::CallbackGroup::SharedPtr& callback_group);
59
69 ServiceClientHandler(rclcpp::Node::SharedPtr& node, const std::string& address, const rclcpp::CallbackGroup::SharedPtr& callback_group);
70
84 std::optional<std::shared_ptr<typename ServiceType::Response>> callSync(const std::shared_ptr<typename ServiceType::Request>& request);
85
93 std::optional<std::shared_future<std::shared_ptr<typename ServiceType::Response>>> callAsync(const std::shared_ptr<typename ServiceType::Request>& request);
94
95 private:
96 class Impl;
97 std::shared_ptr<Impl> impl_;
98 };
99
100 //}
101
102} // namespace mrs_lib
103
implementation of the service client handler
Definition service_client_handler.hpp:89
user wrapper of the service client handler implementation
Definition service_client_handler.h:23
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:50
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:66
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.