rclcpp  master
C++ ROS Client Library API
Public Types | Public Member Functions | List of all members
rclcpp::client::Client< ServiceT > Class Template Reference

#include <client.hpp>

Inheritance diagram for rclcpp::client::Client< ServiceT >:
rclcpp::client::ClientBase

Public Types

using SharedRequest = typename ServiceT::Request::SharedPtr
 
using SharedResponse = typename ServiceT::Response::SharedPtr
 
using Promise = std::promise< SharedResponse >
 
using PromiseWithRequest = std::promise< std::pair< SharedRequest, SharedResponse > >
 
using SharedPromise = std::shared_ptr< Promise >
 
using SharedPromiseWithRequest = std::shared_ptr< PromiseWithRequest >
 
using SharedFuture = std::shared_future< SharedResponse >
 
using SharedFutureWithRequest = std::shared_future< std::pair< SharedRequest, SharedResponse > >
 
using CallbackType = std::function< void(SharedFuture)>
 
using CallbackWithRequestType = std::function< void(SharedFutureWithRequest)>
 

Public Member Functions

 Client (rclcpp::node_interfaces::NodeBaseInterface *node_base, rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph, const std::string &service_name, rcl_client_options_t &client_options)
 
virtual ~Client ()
 
std::shared_ptr< void > create_response ()
 
std::shared_ptr< rmw_request_id_tcreate_request_header ()
 
void handle_response (std::shared_ptr< rmw_request_id_t > request_header, std::shared_ptr< void > response)
 
SharedFuture async_send_request (SharedRequest request)
 
template<typename CallbackT , typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, CallbackType >::value >::type * = nullptr>
SharedFuture async_send_request (SharedRequest request, CallbackT &&cb)
 
template<typename CallbackT , typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, CallbackWithRequestType >::value >::type * = nullptr>
SharedFutureWithRequest async_send_request (SharedRequest request, CallbackT &&cb)
 
- Public Member Functions inherited from rclcpp::client::ClientBase
 ClientBase (rclcpp::node_interfaces::NodeBaseInterface *node_base, rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph, const std::string &service_name)
 
virtual ~ClientBase ()
 
const std::string & get_service_name () const
 
const rcl_client_tget_client_handle () const
 
bool service_is_ready () const
 
template<typename RatioT = std::milli>
bool wait_for_service (std::chrono::duration< int64_t, RatioT > timeout=std::chrono::duration< int64_t, RatioT >(-1))
 

Additional Inherited Members

- Protected Member Functions inherited from rclcpp::client::ClientBase
bool wait_for_service_nanoseconds (std::chrono::nanoseconds timeout)
 
rcl_node_tget_rcl_node_handle () const
 
- Protected Attributes inherited from rclcpp::client::ClientBase
rclcpp::node_interfaces::NodeGraphInterface::WeakPtr node_graph_
 
std::shared_ptr< rcl_node_tnode_handle_
 
rcl_client_t client_handle_ = rcl_get_zero_initialized_client()
 
std::string service_name_
 

Member Typedef Documentation

◆ SharedRequest

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::SharedRequest = typename ServiceT::Request::SharedPtr

◆ SharedResponse

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::SharedResponse = typename ServiceT::Response::SharedPtr

◆ Promise

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::Promise = std::promise<SharedResponse>

◆ PromiseWithRequest

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::PromiseWithRequest = std::promise<std::pair<SharedRequest, SharedResponse> >

◆ SharedPromise

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::SharedPromise = std::shared_ptr<Promise>

◆ SharedPromiseWithRequest

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::SharedPromiseWithRequest = std::shared_ptr<PromiseWithRequest>

◆ SharedFuture

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::SharedFuture = std::shared_future<SharedResponse>

◆ SharedFutureWithRequest

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::SharedFutureWithRequest = std::shared_future<std::pair<SharedRequest, SharedResponse> >

◆ CallbackType

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::CallbackType = std::function<void(SharedFuture)>

◆ CallbackWithRequestType

template<typename ServiceT>
using rclcpp::client::Client< ServiceT >::CallbackWithRequestType = std::function<void(SharedFutureWithRequest)>

Constructor & Destructor Documentation

◆ Client()

template<typename ServiceT>
rclcpp::client::Client< ServiceT >::Client ( rclcpp::node_interfaces::NodeBaseInterface node_base,
rclcpp::node_interfaces::NodeGraphInterface::SharedPtr  node_graph,
const std::string &  service_name,
rcl_client_options_t client_options 
)
inline

◆ ~Client()

template<typename ServiceT>
virtual rclcpp::client::Client< ServiceT >::~Client ( )
inlinevirtual

Member Function Documentation

◆ create_response()

template<typename ServiceT>
std::shared_ptr<void> rclcpp::client::Client< ServiceT >::create_response ( )
inlinevirtual

◆ create_request_header()

template<typename ServiceT>
std::shared_ptr<rmw_request_id_t> rclcpp::client::Client< ServiceT >::create_request_header ( )
inlinevirtual

◆ handle_response()

template<typename ServiceT>
void rclcpp::client::Client< ServiceT >::handle_response ( std::shared_ptr< rmw_request_id_t request_header,
std::shared_ptr< void >  response 
)
inlinevirtual

◆ async_send_request() [1/3]

template<typename ServiceT>
SharedFuture rclcpp::client::Client< ServiceT >::async_send_request ( SharedRequest  request)
inline

◆ async_send_request() [2/3]

template<typename ServiceT>
template<typename CallbackT , typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, CallbackType >::value >::type * = nullptr>
SharedFuture rclcpp::client::Client< ServiceT >::async_send_request ( SharedRequest  request,
CallbackT &&  cb 
)
inline

◆ async_send_request() [3/3]

template<typename ServiceT>
template<typename CallbackT , typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, CallbackWithRequestType >::value >::type * = nullptr>
SharedFutureWithRequest rclcpp::client::Client< ServiceT >::async_send_request ( SharedRequest  request,
CallbackT &&  cb 
)
inline

The documentation for this class was generated from the following file: