MoveIt Pro Behavior Interface
5.0.1
Library for developing custom behaviors for use in MoveIt Pro
|
Implementation of the subscriber interface for a rclcpp subscription. More...
#include <get_message_from_topic.hpp>
Public Member Functions | |
RclcppSubscriberInterface (const std::shared_ptr< rclcpp::Node > node) | |
tl::expected< void, std::string > | initialize (const std::string &topic_name, const std::chrono::duration< double > wait_for_message_timeout) override |
Initializes the rclcpp subscriber interface to listen on the provided topic. More... | |
tl::expected< MessageT, std::string > | syncGetNextMessage () override |
Block until a message is received on the topic. More... | |
Implementation of the subscriber interface for a rclcpp subscription.
|
explicit |
|
overridevirtual |
Initializes the rclcpp subscriber interface to listen on the provided topic.
This blocks for a brief duration until a publisher is available on the topic. If no publisher appears before the timeout, returns an error result.
After the publisher appears, get its current QoS settings, and set the subscriber's QoS settings to have the same reliability setting as the publisher. This ensures that the subscriber QoS always matches the publisher in situations where the same behavior may need to get messages from different sources which use different QoS settings (for example, retrieving images from a simulated camera publisher vs. a real-hardware camera driver).
If a subscriber was previously created for this behavior (for example, if the behavior is under a RepeatUntilFailure decorator node), the new topic name and QoS settings are compared to the existing subscriber's topic name and QoS settings. The subscriber is reinitialized if the topic name and QoS settings have changed since it was created. Otherwise the same subscriber is reused.
topic_name | The topic name to use when creating the subscriber. |
wait_for_message_timeout | The timeout duration to use when waiting for a message to be received on the topic. |
Implements moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >::SubscriberInterfaceBase.
|
overridevirtual |
Block until a message is received on the topic.
Implements moveit_studio::behaviors::GetMessageFromTopicBehaviorBase< MessageT >::SubscriberInterfaceBase.