|
MoveIt Pro API
Core Behaviors for MoveIt Pro
|
Implementation of the subscriber interface using rclcpp subscription. More...
#include <subscriber_interface.hpp>


Public Member Functions | |
| RclcppSubscriberInterface (const std::shared_ptr< BehaviorContext > &shared_resources) | |
| tl::expected< void, std::string > | initialize (const std::string &topic_name, const std::chrono::duration< double > &wait_for_message_timeout, const std::chrono::duration< double > &wait_for_publisher_timeout, bool bypass_qos_negotiation=false) override |
| Initializes the rclcpp subscriber interface to listen on the provided topic. | |
| tl::expected< void, std::string > | initialize (const std::string &topic_name, const std::chrono::duration< double > &wait_for_message_timeout, const std::chrono::duration< double > &wait_for_publisher_timeout, std::optional< std::function< void()> > on_haltable, bool bypass_qos_negotiation=false) |
An overloaded form of initialize with an additional callback parameter that is called when the current task can be halted. | |
| std::future< tl::expected< MessageT, std::string > > | getNextMessage () override |
| Get a future for the next message on the topic. | |
| tl::expected< MessageT, std::string > | syncGetNextMessage () override |
| Block until a message is received on the topic. | |
| void | halt () override |
| Stops any publisher or message checking. | |
Public Member Functions inherited from moveit_studio::behaviors::SubscriberInterface< MessageT > | |
| virtual | ~SubscriberInterface ()=default |
Implementation of the subscriber interface using rclcpp subscription.
| MessageT | ROS message type used to specialize this implementation. |
|
explicit |
|
overridevirtual |
Get a future for the next message on the topic.
Implements moveit_studio::behaviors::SubscriberInterface< MessageT >.
|
overridevirtual |
Stops any publisher or message checking.
Implements moveit_studio::behaviors::SubscriberInterface< MessageT >.
|
overridevirtual |
Initializes the rclcpp subscriber interface to listen on the provided topic.
By default, 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.
When bypass_qos_negotiation is false (default), 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).
When bypass_qos_negotiation is true, use default QoS settings without waiting for or negotiating with a publisher. This is useful for transient topics or situations where the publisher's presence cannot be waited for.
| 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. |
| wait_for_publisher_timeout | The timeout duration to use when waiting for a publisher to advertise on the topic. Ignored if bypass_qos_negotiation is true. |
| bypass_qos_negotiation | If true, use default QoS instead of negotiating with publisher. |
Implements moveit_studio::behaviors::SubscriberInterface< MessageT >.
| tl::expected< void, std::string > moveit_studio::behaviors::RclcppSubscriberInterface< MessageT >::initialize | ( | const std::string & | topic_name, |
| const std::chrono::duration< double > & | wait_for_message_timeout, | ||
| const std::chrono::duration< double > & | wait_for_publisher_timeout, | ||
| std::optional< std::function< void()> > | on_haltable, | ||
| bool | bypass_qos_negotiation = false |
||
| ) |
An overloaded form of initialize with an additional callback parameter that is called when the current task can be halted.
| 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. |
| wait_for_publisher_timeout | The timeout duration to use when waiting for a publisher to advertise on the topic. Ignored if bypass_qos_negotiation is true. |
| on_haltable | Optional callback that is called when the current task can be halted. |
| bypass_qos_negotiation | If true, use default QoS instead of negotiating with publisher. |
|
overridevirtual |
Block until a message is received on the topic.
Implements moveit_studio::behaviors::SubscriberInterface< MessageT >.