1#ifndef CLIENT_CLASS_HPP
2#define CLIENT_CLASS_HPP
4#include "rclcpp/rclcpp.hpp"
13using namespace std::chrono_literals;
22template<
class T,
class Treq,
class... Rs>
40 while (!
client->wait_for_service(1s)) {
42 RCLCPP_ERROR(rclcpp::get_logger(
"rclcpp"),
"Interrupted while waiting for the service. Exiting...");
45 RCLCPP_INFO(rclcpp::get_logger(
"rclcpp"), this->
client_name +
" client is waiting for service...");
52 if (rclcpp::spin_until_future_complete(this->
self_ptr, result) ==
53 rclcpp::FutureReturnCode::SUCCESS)
57 RCLCPP_ERROR(rclcpp::get_logger(
"rclcpp"),
"Failed to call service");
58 throw std::runtime_error(
"Failed to call service");
ClientT class.
Definition: ClientT.hpp:23
std::shared_ptr< ClientT< T, Treq, Rs... > > self_ptr
Definition: ClientT.hpp:63
ClientT(const std::string &client_name)
Definition: ClientT.hpp:30
std::string client_name
Definition: ClientT.hpp:64
void wait_for_connection()
Definition: ClientT.hpp:39
struct_wrapper< Treq, Rs... > request
Definition: ClientT.hpp:66
auto send(Rs... args)
Definition: ClientT.hpp:49
typename rclcpp::Client< T >::SharedFuture shared_future_T
Definition: ClientT.hpp:28
typename rclcpp::Client< T >::SharedPtr shared_ptr_T
Definition: ClientT.hpp:27
shared_ptr_T client
Definition: ClientT.hpp:65
void set_shared(std::shared_ptr< ClientT< T, Treq, Rs... > > ptr)
Definition: ClientT.hpp:35
Definition: struct_wrapper.hpp:5
void set_values(Ts... args)
Definition: struct_wrapper.hpp:14
std::shared_ptr< T > value
Definition: struct_wrapper.hpp:8