MoveIt Pro Behavior Interface  5.0.1
Library for developing custom behaviors for use in MoveIt Pro
moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT > Class Template Reference

Base class for Behaviors that get the latest message from a topic specified on an input data port and set that message to an output data port. More...

#include <get_message_from_topic.hpp>

Inheritance diagram for moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >:
Collaboration diagram for moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >:

Classes

class  RclcppSubscriberInterface
 Implementation of the subscriber interface for a rclcpp subscription. More...
 
class  SubscriberInterfaceBase
 Defines an interface to a subscriber that blocks while waiting for a message to be received on a topic. More...
 

Public Member Functions

 GetMessageFromTopicBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 Constructs GetMessageFromTopicBehaviorBase using the RclcppSubscriberInterface. More...
 
 GetMessageFromTopicBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< SubscriberInterfaceBase > subscriber_interface)
 Constructs GetMessageFromTopicBehaviorBase using a user-provided implementation of SubscriberInterfaceBase. More...
 
virtual ~GetMessageFromTopicBehaviorBase ()=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 auto kPortIDTopicName = "topic_name"
 Port names. More...
 
static constexpr auto kPortIDMessageOut = "message_out"
 

Protected Member Functions

virtual tl::expected< std::chrono::duration< double >, std::string > getWaitForMessageTimeout ()
 Optional user-provided function to set the timeout used when waiting for a message to be received on the topic. 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< BehaviorContextshared_resources_
 

Detailed Description

template<typename MessageT>
class moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >

Base class for Behaviors that get the latest message from a topic specified on an input data port and set that message to an output data port.

Template Parameters
MessageTROS message type used to specialize this class.

Constructor & Destructor Documentation

◆ GetMessageFromTopicBehaviorBase() [1/2]

template<typename MessageT >
moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >::GetMessageFromTopicBehaviorBase ( const std::string &  name,
const BT::NodeConfiguration &  config,
const std::shared_ptr< BehaviorContext > &  shared_resources 
)

◆ GetMessageFromTopicBehaviorBase() [2/2]

template<typename MessageT >
moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >::GetMessageFromTopicBehaviorBase ( const std::string &  name,
const BT::NodeConfiguration &  config,
const std::shared_ptr< BehaviorContext > &  shared_resources,
std::unique_ptr< SubscriberInterfaceBase subscriber_interface 
)

Constructs GetMessageFromTopicBehaviorBase using a user-provided implementation of SubscriberInterfaceBase.

◆ ~GetMessageFromTopicBehaviorBase()

template<typename MessageT >
virtual moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >::~GetMessageFromTopicBehaviorBase ( )
virtualdefault

Member Function Documentation

◆ getWaitForMessageTimeout()

template<typename MessageT >
virtual tl::expected<std::chrono::duration<double>, std::string> moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >::getWaitForMessageTimeout ( )
inlineprotectedvirtual

Optional user-provided function to set the timeout used when waiting for a message to be received on the topic.

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

Returns
Returns the message 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.

Member Data Documentation

◆ kPortIDMessageOut

template<typename MessageT >
constexpr auto moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >::kPortIDMessageOut = "message_out"
staticconstexpr

◆ kPortIDTopicName

template<typename MessageT >
constexpr auto moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >::kPortIDTopicName = "topic_name"
staticconstexpr

Port names.


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