MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT > Class Template Reference

Base class for Behaviors that send a message to a topic. The message contents and topic name are specified as input ports. More...

#include <send_message_to_topic.hpp>

Inheritance diagram for moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >:
Collaboration diagram for moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >:

Public Member Functions

 SendMessageToTopicBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 Constructs SendMessageToTopicBehaviorBase using the RclcppPublisherInterface.
 
 SendMessageToTopicBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< PublisherInterfaceBase< MessageT > > publisher_interface)
 Constructs SendMessageToTopicBehaviorBase using a user-provided implementation of PublisherInterfaceBase.
 
virtual ~SendMessageToTopicBehaviorBase ()=default
 
BT::NodeStatus tick () override
 
- Public Member Functions inherited from moveit_pro::behaviors::SharedResourcesNode< BT::SyncActionNode >
 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.
 

Static Public Attributes

static constexpr auto kPortIDMessage = "message"
 Port names.
 
static constexpr auto kPortIDTopicName = "topic"
 
static constexpr auto kPortIDQueueSize = "queue_size"
 
static constexpr auto kPortIDUseBestEffort = "use_best_effort"
 

Additional Inherited Members

- Protected Attributes inherited from moveit_pro::behaviors::SharedResourcesNode< BT::SyncActionNode >
std::shared_ptr< BehaviorContextshared_resources_
 

Detailed Description

template<typename MessageT>
class moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >

Base class for Behaviors that send a message to a topic. The message contents and topic name are specified as input ports.

Template Parameters
MessageTROS message type used to specialize this class.
Note
The default message input data port type is MessageT. This means you might need to create a separate Behavior that generates an MessageT instance. If you do not want to create a separate Behavior to generate an instance of MessageT, consider creating a template specialization of BT::convertFromString which converts a string to a MessageT instance. This allows for the message input data port to take a std::string as its input. For an example of how this is done, look at the PublishString Behavior. If the "message" input port is not set, then the Behavior will publish a default instance of the specified message type.

The "queue_size" (for the underlying publisher's quality of service) input port value must be > 0.

If The "use_best_effort" (for the underlying publisher's quality of service) is set to true, "best effort" reliability is used. If false, "reliable" reliability is used.

Data Port Name Port Type Object Type
message Input MessageT
topic Input std::string
queue_size Input size_t
use_best_effort Input bool

Constructor & Destructor Documentation

◆ SendMessageToTopicBehaviorBase() [1/2]

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

◆ SendMessageToTopicBehaviorBase() [2/2]

template<typename MessageT >
moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >::SendMessageToTopicBehaviorBase ( const std::string &  name,
const BT::NodeConfiguration &  config,
const std::shared_ptr< BehaviorContext > &  shared_resources,
std::unique_ptr< PublisherInterfaceBase< MessageT > >  publisher_interface 
)

Constructs SendMessageToTopicBehaviorBase using a user-provided implementation of PublisherInterfaceBase.

◆ ~SendMessageToTopicBehaviorBase()

Member Function Documentation

◆ tick()

template<typename MessageT >
BT::NodeStatus moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >::tick ( )
override

Member Data Documentation

◆ kPortIDMessage

template<typename MessageT >
constexpr auto moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >::kPortIDMessage = "message"
staticconstexpr

Port names.

◆ kPortIDQueueSize

template<typename MessageT >
constexpr auto moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >::kPortIDQueueSize = "queue_size"
staticconstexpr

◆ kPortIDTopicName

template<typename MessageT >
constexpr auto moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >::kPortIDTopicName = "topic"
staticconstexpr

◆ kPortIDUseBestEffort

template<typename MessageT >
constexpr auto moveit_pro::behaviors::SendMessageToTopicBehaviorBase< MessageT >::kPortIDUseBestEffort = "use_best_effort"
staticconstexpr

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