RclcppClientInterface Class Template
Implements ClientInterfaceBase for the rclcpp service client. More...
Declaration
class moveit_pro::behaviors::RclcppClientInterface<ServiceT> { ... }
Included Headers
Base class
| class | ClientInterfaceBase<ServiceT> |
|
Provides an interface to a service client that can send a single request at a time. WARNING - This class currently does not support calling syncSendRequest function asynchronously from multiple threads. More... | |
Public Constructors Index
template <typename ServiceT> | |
| RclcppClientInterface (const std::shared_ptr< BehaviorContext > &behavior_context) | |
|
Constructor for this implementation. More... | |
Public Member Functions Index
template <typename ServiceT> | |
| void | initialize (const std::string &service_name, std::chrono::duration< double > wait_for_server_timeout, std::chrono::duration< double > result_timeout) override |
|
Implementation of ClientInterfaceBase::initialize for an rclcpp service client. More... | |
template <typename ServiceT> | |
| bool | waitForServiceServer () const override |
|
Implementation of ClientInterfaceBase::waitForServiceServer for an rclcpp service client. More... | |
template <typename ServiceT> | |
| auto | syncSendRequest (const typename ServiceT::Request &request) override -> tl::expected< typename ServiceT::Response, std::string > |
|
Implementation of ClientInterfaceBase::syncGetResult for an rclcpp service client. More... | |
template <typename ServiceT> | |
| void | cancelRequest () override |
|
Implementation of ClientInterfaceBase::cancelRequest for an rclcpp service client. More... | |
Private Member Attributes Index
template <typename ServiceT> | |
| std::shared_ptr< rclcpp::Node > | node_ |
|
Node to use when initializing the service client. More... | |
template <typename ServiceT> | |
| std::shared_ptr< rclcpp::CallbackGroup > | reentrant_callback_group_ |
|
Reentrant callback group used by the service client. More... | |
template <typename ServiceT> | |
| std::shared_ptr< rclcpp::Client< ServiceT > > | client_ |
|
Service client. More... | |
template <typename ServiceT> | |
| std::chrono::duration< double > | wait_for_server_timeout_ |
|
Duration to wait for the service server to be available before failing. More... | |
template <typename ServiceT> | |
| std::chrono::duration< double > | result_timeout_ |
|
Duration to wait for a result before failing. More... | |
template <typename ServiceT> | |
| std::atomic_bool | request_canceled_ { false } |
|
Notifies the request waiting loop to exit early. More... | |
Public Static Attributes Index
template <typename ServiceT> | |
| static constexpr std::chrono::milliseconds | kResponseBusyWaitPeriod { 100 } |
Description
Implements ClientInterfaceBase for the rclcpp service client.
Definition at line 60 of file service_client_interface.hpp.
Public Constructors
RclcppClientInterface()
| explicit |
Constructor for this implementation.
- Parameters
-
behavior_context A shared_ptr to an instance of BehaviorContext. When this behavior is created using
Declaration at line 67 of file service_client_interface.hpp, definition at line 17 of file service_client_interface_impl.hpp.
Public Member Functions
cancelRequest()
| virtual |
Implementation of ClientInterfaceBase::cancelRequest for an rclcpp service client.
Aborts the busy-waiting request loop causing it to return (almost) immediately.
Declaration at line 93 of file service_client_interface.hpp, definition at line 78 of file service_client_interface_impl.hpp.
initialize()
| virtual |
Implementation of ClientInterfaceBase::initialize for an rclcpp service client.
Sets client_ to a new service client instance
Declaration at line 73 of file service_client_interface.hpp, definition at line 23 of file service_client_interface_impl.hpp.
syncSendRequest()
| virtual |
Implementation of ClientInterfaceBase::syncGetResult for an rclcpp service client.
Calls the service client's async_send_request function and blocks while waiting on the future which it returns.
Declaration at line 87 of file service_client_interface.hpp, definition at line 44 of file service_client_interface_impl.hpp.
waitForServiceServer()
| virtual |
Implementation of ClientInterfaceBase::waitForServiceServer for an rclcpp service client.
Calls the service client's wait_for_service function.
Declaration at line 80 of file service_client_interface.hpp, definition at line 37 of file service_client_interface_impl.hpp.
Private Member Attributes
client_
|
Service client.
Definition at line 105 of file service_client_interface.hpp.
node_
|
Node to use when initializing the service client.
Definition at line 99 of file service_client_interface.hpp.
reentrant_callback_group_
|
Reentrant callback group used by the service client.
Definition at line 102 of file service_client_interface.hpp.
request_canceled_
|
Notifies the request waiting loop to exit early.
Definition at line 114 of file service_client_interface.hpp.
result_timeout_
|
Duration to wait for a result before failing.
Definition at line 111 of file service_client_interface.hpp.
wait_for_server_timeout_
|
Duration to wait for the service server to be available before failing.
Definition at line 108 of file service_client_interface.hpp.
Public Static Attributes
kResponseBusyWaitPeriod
| constexpr static |
Definition at line 95 of file service_client_interface.hpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.