mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
service_server_handler.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <mrs_lib/coro/runners.hpp>
8#include <mrs_lib/coro/task.hpp>
9#include <mrs_lib/internal/coroutine_callback_helpers.hpp>
10#include <rclcpp/rclcpp.hpp>
11
12namespace mrs_lib
13{
14
15 /* class ServiceServerHandler //{ */
16
20 template <class ServiceType>
22 {
23
24 public:
25 using callback_t = typename rclcpp::Service<ServiceType>::CallbackType;
26
38 ServiceServerHandler(rclcpp::Node::SharedPtr& node, const std::string& address, const callback_t& cbk, const rclcpp::QoS& qos = rclcpp::ServicesQoS());
39
47
58 ServiceServerHandler(rclcpp::Node::SharedPtr& node, const std::string& address, const callback_t& cbk, const rclcpp::QoS& qos,
59 const rclcpp::CallbackGroup::SharedPtr& callback_group);
60
71 template <typename ClassType>
72 ServiceServerHandler(rclcpp::Node::SharedPtr& node, const std::string& address,
73 mrs_lib::Task<bool> (ClassType::*method)(const std::shared_ptr<typename ServiceType::Request> request,
74 const std::shared_ptr<typename ServiceType::Response> response),
75 ClassType* instance, const rclcpp::QoS& qos, const rclcpp::CallbackGroup::SharedPtr& callback_group);
76
86 ServiceServerHandler(rclcpp::Node::SharedPtr& node, const std::string& address, const callback_t& cbk,
87 const rclcpp::CallbackGroup::SharedPtr& callback_group);
88
89 private:
90 rclcpp::CallbackGroup::SharedPtr callback_group_;
91 typename rclcpp::Service<ServiceType>::SharedPtr service_server_;
92
93 //}
94 };
95
96} // namespace mrs_lib
97
user wrapper of the service client handler implementation
Definition service_server_handler.h:22
ServiceServerHandler()
Default constructor to avoid having to use pointers.
Definition service_server_handler.hpp:29
Task type for creating coroutines.
Definition task.hpp:300
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition attitude_converter.h:24
Implements the ServiceServerHandler wrapper to ROS2's ServiceServer.