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(const rclcpp::Node::SharedPtr& node, const std::string& address, const callback_t& cbk,
39 const rclcpp::QoS& qos = rclcpp::ServicesQoS());
40
48
59 ServiceServerHandler(const rclcpp::Node::SharedPtr& node, const std::string& address, const callback_t& cbk, const rclcpp::QoS& qos,
60 const rclcpp::CallbackGroup::SharedPtr& callback_group);
61
72 template <typename ClassType>
73 ServiceServerHandler(const rclcpp::Node::SharedPtr& node, const std::string& address,
74 mrs_lib::Task<bool> (ClassType::*method)(const std::shared_ptr<typename ServiceType::Request> request,
75 const std::shared_ptr<typename ServiceType::Response> response),
76 ClassType* instance, const rclcpp::QoS& qos, const rclcpp::CallbackGroup::SharedPtr& callback_group);
77
87 ServiceServerHandler(const rclcpp::Node::SharedPtr& node, const std::string& address, const callback_t& cbk,
88 const rclcpp::CallbackGroup::SharedPtr& callback_group);
89
90 private:
91 rclcpp::CallbackGroup::SharedPtr callback_group_;
92 typename rclcpp::Service<ServiceType>::SharedPtr service_server_;
93
94 //}
95 };
96
97} // namespace mrs_lib
98
ServiceServerHandler()
Default constructor to avoid having to use pointers.
Definition service_server_handler.hpp:29
ServiceServerHandler(const rclcpp::Node::SharedPtr &node, const std::string &address, const callback_t &cbk, const rclcpp::QoS &qos=rclcpp::ServicesQoS())
The main constructor with all the options.
Definition service_server_handler.hpp:22
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 the ServiceServerHandler wrapper to ROS2's ServiceServer.