|
mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
|
Go to the documentation of this file.
5 #ifndef SERVICE_CLIENT_HANDLER_H
6 #define SERVICE_CLIENT_HANDLER_H
9 #include <ros/package.h>
23 template <
class ServiceType>
52 bool call(ServiceType& srv);
62 bool call(ServiceType& srv,
const int& attempts);
73 bool call(ServiceType& srv,
const int& attempts,
const double& repeat_delay);
82 std::future<ServiceType>
callAsync(ServiceType& srv);
92 std::future<ServiceType>
callAsync(ServiceType& srv,
const int& attempts);
103 std::future<ServiceType>
callAsync(ServiceType& srv,
const int& attempts,
const double& repeat_delay);
106 ros::ServiceClient service_client_;
107 std::mutex mutex_service_client_;
108 std::atomic<bool> service_initialized_;
110 std::string _address_;
112 ServiceType async_data_;
114 double async_repeat_delay_;
115 std::mutex mutex_async_;
117 ServiceType asyncRun(
void);
127 template <
class ServiceType>
171 void initialize(ros::NodeHandle& nh,
const std::string& address);
180 bool call(ServiceType& srv);
190 bool call(ServiceType& srv,
const int& attempts);
201 bool call(ServiceType& srv,
const int& attempts,
const double& repeat_delay);
210 std::future<ServiceType>
callAsync(ServiceType& srv);
220 std::future<ServiceType>
callAsync(ServiceType& srv,
const int& attempts);
231 std::future<ServiceType>
callAsync(ServiceType& srv,
const int& attempts,
const double& repeat_delay);
234 std::shared_ptr<ServiceClientHandler_impl<ServiceType>> impl_;
241 #include <mrs_lib/impl/service_client_handler.hpp>
243 #endif // SERVICE_CLIENT_HANDLER_H
~ServiceClientHandler(void)
generic destructor
Definition: service_client_handler.h:139
user wrapper of the service client handler implementation
Definition: service_client_handler.h:128
implementation of the service client handler
Definition: service_client_handler.h:24
ServiceClientHandler_impl(void)
default constructor
Definition: service_client_handler.hpp:14
ServiceClientHandler(void)
generic constructor
Definition: service_client_handler.h:134
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition: attitude_converter.h:29
std::future< ServiceType > callAsync(ServiceType &srv)
asynchronous call
Definition: service_client_handler.hpp:284
std::future< ServiceType > callAsync(ServiceType &srv)
asynchronous service call
Definition: service_client_handler.hpp:123
~ServiceClientHandler_impl(void)
default destructor
Definition: service_client_handler.h:35
void initialize(ros::NodeHandle &nh, const std::string &address)
initializer
Definition: service_client_handler.hpp:244
bool call(ServiceType &srv)
"classic" synchronous service call
Definition: service_client_handler.hpp:43
bool call(ServiceType &srv)
"standard" synchronous call
Definition: service_client_handler.hpp:254
ServiceClientHandler & operator=(const ServiceClientHandler &other)
operator=
Definition: service_client_handler.hpp:204