Skip to main content

CallEmptyService Class

Calls a std_srvs/Empty service and succeeds when it responds. More...

Declaration​

class moveit_pro::behaviors::CallEmptyService { ... }

Included Headers​

#include <call_empty_service.hpp>

Base class​

classServiceClientBehaviorBase<ServiceT>

A base class for behaviors which need to send a request to a ROS service client and wait for a result. More...

Public Constructors Index​

CallEmptyService (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
CallEmptyService (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< Empty > > client_interface)

Private Member Functions Index​

tl::expected< std::string, std::string >getServiceName () override

User-provided function to get the name of the service when initializing the service client. More...

tl::expected< std::chrono::duration< double >, std::string >getResponseTimeout () override

Optional user-provided function to set the timeout used when waiting for the service response. More...

tl::expected< std::chrono::duration< double >, std::string >getWaitForServerAvailableTimeout () override

Optional user-provided function to set the timeout used when waiting for the service server to be available. More...

tl::expected< Empty::Request, std::string >createRequest () override

Creates a service request message. More...

tl::expected< bool, std::string >processResponse (const Empty::Response &response) override

Treats any response as success, since Empty::Response carries no fields. More...

std::shared_future< tl::expected< bool, std::string > > &getFuture () override

Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member. More...

Private Member Attributes Index​

std::shared_future< tl::expected< bool, std::string > >future_

Holds the result of calling the service asynchronously. More...

Public Static Functions Index​

static BT::PortsListprovidedPorts ()
static BT::KeyValueVectormetadata ()

Description​

Calls a std_srvs/Empty service and succeeds when it responds.

Data Port NamePort TypeObject Type
service_nameinputstd::string
response_timeoutinputdouble
wait_for_server_available_timeoutinputdouble

Definition at line 27 of file call_empty_service.hpp.

Public Constructors​

CallEmptyService()​

moveit_pro::behaviors::CallEmptyService::CallEmptyService (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources)
explicit

Declaration at line 30 of file call_empty_service.hpp, definition at line 25 of file call_empty_service.cpp.

CallEmptyService()​

moveit_pro::behaviors::CallEmptyService::CallEmptyService (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< Empty > > client_interface)
explicit

Declaration at line 33 of file call_empty_service.hpp, definition at line 31 of file call_empty_service.cpp.

Private Member Functions​

createRequest()​

tl::expected< Empty::Request, std::string > moveit_pro::behaviors::CallEmptyService::createRequest ()
virtual

Creates a service request message.

Returns

Returns an instance of Empty::Request. Since the request message is empty, this always succeeds.

Declaration at line 51 of file call_empty_service.hpp, definition at line 91 of file call_empty_service.cpp.

getFuture()​

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::CallEmptyService::getFuture ()
inline virtual

Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.

Definition at line 61 of file call_empty_service.hpp.

getResponseTimeout()​

tl::expected< std::chrono::duration< double >, std::string > moveit_pro::behaviors::CallEmptyService::getResponseTimeout ()
virtual

Optional user-provided function to set the timeout used when waiting for the service response.

If no user-defined implementation is provided, the default implementation returns a negative duration, which will cause the service client to wait for the response without timing out.

Returns

Returns the service response timeout duration. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 44 of file call_empty_service.hpp, definition at line 65 of file call_empty_service.cpp.

getServiceName()​

tl::expected< std::string, std::string > moveit_pro::behaviors::CallEmptyService::getServiceName ()
virtual

User-provided function to get the name of the service when initializing the service client.

Returns

Returns the name of the service. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 42 of file call_empty_service.hpp, definition at line 53 of file call_empty_service.cpp.

getWaitForServerAvailableTimeout()​

tl::expected< std::chrono::duration< double >, std::string > moveit_pro::behaviors::CallEmptyService::getWaitForServerAvailableTimeout ()
virtual

Optional user-provided function to set the timeout used when waiting for the service server to be available.

If no user-defined implementation is provided, the default implementation returns 3.0 seconds, which will be the timeout duration for waiting for the service server to become available.

Returns

Returns the service server wait timeout duration. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 45 of file call_empty_service.hpp, definition at line 78 of file call_empty_service.cpp.

processResponse()​

tl::expected< bool, std::string > moveit_pro::behaviors::CallEmptyService::processResponse (const Empty::Response & response)

Treats any response as success, since Empty::Response carries no fields.

Parameters
response

Response message received from the service server.

Returns

Always true.

Declaration at line 58 of file call_empty_service.hpp, definition at line 97 of file call_empty_service.cpp.

Private Member Attributes​

future_​

std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::CallEmptyService::future_

Holds the result of calling the service asynchronously.

Definition at line 69 of file call_empty_service.hpp.

Public Static Functions​

metadata()​

BT::KeyValueVector moveit_pro::behaviors::CallEmptyService::metadata ()
static

Declaration at line 39 of file call_empty_service.hpp, definition at line 48 of file call_empty_service.cpp.

providedPorts()​

BT::PortsList moveit_pro::behaviors::CallEmptyService::providedPorts ()
static

Declaration at line 37 of file call_empty_service.hpp, definition at line 38 of file call_empty_service.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.