MoveIt Pro Behavior
Core Behaviors for MoveIt Pro
|
A base class for behaviors which need to send a request to a ROS service client and wait for a result. More...
#include <service_client_behavior_base.hpp>
Public Member Functions | |
ServiceClientBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
Constructs ServiceClientBehaviorBase using the RclcppClientInterface. More... | |
ServiceClientBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< ServiceT >> client_interface) | |
Constructs ServiceClientBehaviorBase using a user-provided implementation of ClientInterfaceBase. More... | |
virtual | ~ServiceClientBehaviorBase ()=default |
Public Member Functions inherited from moveit_studio::behaviors::AsyncBehaviorBase | |
AsyncBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
virtual | ~AsyncBehaviorBase ()=default |
BT::NodeStatus | onStart () override |
Required implementation of BT::StatefulActionNode::onStart(). More... | |
BT::NodeStatus | onRunning () override |
Required implementation of BT::StatefulActionNode::onRunning(). More... | |
void | onHalted () override |
Required implementation of BT::StatefulActionNode::onHalted(). More... | |
void | resetStatus () |
Resets the internal status of this node. More... | |
Public Member Functions inherited from moveit_studio::behaviors::SharedResourcesNode< BT::StatefulActionNode > | |
SharedResourcesNode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node. More... | |
Static Public Attributes | |
static constexpr std::chrono::seconds | kTimeoutWaitForServiceServer { 3 } |
Protected Member Functions | |
virtual tl::expected< std::string, std::string > | getServiceName ()=0 |
User-provided function to get the name of the service when initializing the service client. More... | |
virtual tl::expected< std::chrono::duration< double >, std::string > | getResponseTimeout () |
Optional user-provided function to set the timeout used when waiting for the service response. More... | |
virtual tl::expected< typename ServiceT::Request, std::string > | createRequest ()=0 |
User-provided function to create the service request. More... | |
virtual tl::expected< bool, std::string > | processResponse (const typename ServiceT::Response &) |
Optional user-provided function to process the service response after the service has finished. More... | |
Protected Member Functions inherited from moveit_studio::behaviors::AsyncBehaviorBase | |
virtual std::shared_future< tl::expected< bool, std::string > > & | getFuture ()=0 |
Gets the shared future which is used to monitor the progress of the async process. More... | |
void | notifyCanHalt () |
Called when runAsync() finishes to notify onHalted() that the async process has finished. More... | |
Additional Inherited Members | |
Protected Attributes inherited from moveit_studio::behaviors::SharedResourcesNode< BT::StatefulActionNode > | |
std::shared_ptr< BehaviorContext > | shared_resources_ |
A base class for behaviors which need to send a request to a ROS service client and wait for a result.
Important: If a halt is requested before the service request is sent to the service server, the behavior will wait to halt until the service response has been received or the timeout duration has elapsed.
ServiceT | ROS service message type used to specialize this class for a specific service. |
moveit_studio::behaviors::ServiceClientBehaviorBase< ServiceT >::ServiceClientBehaviorBase | ( | const std::string & | name, |
const BT::NodeConfiguration & | config, | ||
const std::shared_ptr< BehaviorContext > & | shared_resources | ||
) |
Constructs ServiceClientBehaviorBase using the RclcppClientInterface.
moveit_studio::behaviors::ServiceClientBehaviorBase< ServiceT >::ServiceClientBehaviorBase | ( | const std::string & | name, |
const BT::NodeConfiguration & | config, | ||
const std::shared_ptr< BehaviorContext > & | shared_resources, | ||
std::unique_ptr< ClientInterfaceBase< ServiceT >> | client_interface | ||
) |
Constructs ServiceClientBehaviorBase using a user-provided implementation of ClientInterfaceBase.
|
virtualdefault |
|
protectedpure virtual |
User-provided function to create the service request.
|
inlineprotectedvirtual |
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.
|
protectedpure virtual |
User-provided function to get the name of the service when initializing the service client.
|
inlineprotectedvirtual |
Optional user-provided function to process the service response after the service has finished.
If no user-defined implementation is provided, then no additional processing will be performed on succeeding service responses and this function will always return void.
response | Service response message to process. |
|
staticconstexpr |