MoveIt Pro Behavior
Core Behaviors for MoveIt Pro
moveit_studio::behaviors::ClientInterfaceBase< ServiceT > Class Template Referenceabstract

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...

#include <service_client_interface.hpp>

Inheritance diagram for moveit_studio::behaviors::ClientInterfaceBase< ServiceT >:

Public Member Functions

virtual ~ClientInterfaceBase ()=default
 
virtual void initialize (const std::string &service_name, std::chrono::duration< double > wait_for_server_timeout, std::chrono::duration< double > response_timeout)=0
 Initialize the service client. More...
 
virtual bool waitForServiceServer () const =0
 Block until the service server is ready or a timeout is exceeded. More...
 
virtual tl::expected< typename ServiceT::Response, std::string > syncSendRequest (const typename ServiceT::Request &request)=0
 Send a service request and block until the response is received or a timeout is exceeded. More...
 
virtual void cancelRequest ()=0
 Abort waiting on the service response future, if it has not yet been completed. More...
 

Detailed Description

template<typename ServiceT>
class moveit_studio::behaviors::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.

Constructor & Destructor Documentation

◆ ~ClientInterfaceBase()

template<typename ServiceT >
virtual moveit_studio::behaviors::ClientInterfaceBase< ServiceT >::~ClientInterfaceBase ( )
virtualdefault

Member Function Documentation

◆ cancelRequest()

template<typename ServiceT >
virtual void moveit_studio::behaviors::ClientInterfaceBase< ServiceT >::cancelRequest ( )
pure virtual

Abort waiting on the service response future, if it has not yet been completed.

Implemented in moveit_studio::behaviors::RclcppClientInterface< ServiceT >.

◆ initialize()

template<typename ServiceT >
virtual void moveit_studio::behaviors::ClientInterfaceBase< ServiceT >::initialize ( const std::string &  service_name,
std::chrono::duration< double >  wait_for_server_timeout,
std::chrono::duration< double >  response_timeout 
)
pure virtual

Initialize the service client.

Parameters
service_nameService name to use when initializing the client.
wait_for_server_timeoutDuration to wait for the service server to be available before failing.
response_timeoutDuration to wait for a response before failing. If the duration is negative, wait forever.

Implemented in moveit_studio::behaviors::RclcppClientInterface< ServiceT >.

◆ syncSendRequest()

template<typename ServiceT >
virtual tl::expected<typename ServiceT::Response, std::string> moveit_studio::behaviors::ClientInterfaceBase< ServiceT >::syncSendRequest ( const typename ServiceT::Request &  request)
pure virtual

Send a service request and block until the response is received or a timeout is exceeded.

Returns
Returns the service response if it was received. If the timeout limit was reached before the response was received, return an error result.

Implemented in moveit_studio::behaviors::RclcppClientInterface< ServiceT >.

◆ waitForServiceServer()

template<typename ServiceT >
virtual bool moveit_studio::behaviors::ClientInterfaceBase< ServiceT >::waitForServiceServer ( ) const
pure virtual

Block until the service server is ready or a timeout is exceeded.

Returns
True if the service server was found to be available before the timeout. False if it was not.

Implemented in moveit_studio::behaviors::RclcppClientInterface< ServiceT >.


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