BreakpointSubscriber Class
A behavior that subscribes to a topic that can be used for pausing an objective during execution to allow introspection. This behavior will listen on the configured topic for a True/False message which will cause it to continue or abort from a breakpoint that is included in an objective. More...
Declaration
Included Headers
Base class
| class | AsyncBehaviorBase |
|
A base class for behaviors which need to asynchronously run a function that might take a long time to complete. More... | |
Public Constructors Index
| BreakpointSubscriber (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
| BreakpointSubscriber (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< SubscriberInterface< std_msgs::msg::Bool > > subscriber_interface, std::unique_ptr< PublisherInterfaceBase< moveit_studio_agent_msgs::msg::BreakpointStatus > > encountered_publisher_interface, std::unique_ptr< PublisherInterfaceBase< moveit_studio_agent_msgs::msg::BreakpointStatus > > resumed_publisher_interface) | |
|
Constructor with injected interfaces for testing. More... | |
Private Member Functions Index
| tl::expected< bool, std::string > | doWork () override |
|
Function called in the async process thread after the behavior starts running. More... | |
| tl::expected< void, std::string > | doHalt () override |
|
Stops message checking if in progress. More... | |
| std::shared_future< tl::expected< bool, std::string > > & | getFuture () override |
|
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member. More... | |
Private Member Attributes Index
| std::shared_future< tl::expected< bool, std::string > > | future_ |
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member. More... | |
| std::unique_ptr< SubscriberInterface< std_msgs::msg::Bool > > | subscriber_interface_ |
|
Subscriber interface used to get messages from the breakpoint topic. More... | |
| std::unique_ptr< PublisherInterfaceBase< moveit_studio_agent_msgs::msg::BreakpointStatus > > | breakpoint_encountered_publisher_interface_ |
|
Publisher interface for broadcasting that a breakpoint has been encountered on a particular subscriber topic. More... | |
| std::unique_ptr< PublisherInterfaceBase< moveit_studio_agent_msgs::msg::BreakpointStatus > > | breakpoint_resumed_publisher_interface_ |
|
Publisher interface for broadcasting that a breakpoint has been resumed on a particular subscriber topic. More... | |
| rclcpp::TimerBase::SharedPtr | breakpoint_timer_ |
|
Wall timer that periodically publishes the breakpoint encountered message while waiting. More... | |
| std::optional< std::string > | breakpoint_topic_ |
|
The breakpoint topic name read from the port during doWork(). More... | |
Public Static Functions Index
| static BT::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
Description
A behavior that subscribes to a topic that can be used for pausing an objective during execution to allow introspection. This behavior will listen on the configured topic for a True/False message which will cause it to continue or abort from a breakpoint that is included in an objective.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| breakpoint_topic | Input | std::string |
| message | Input | std::string |
The optional message port lets the objective author surface a human-readable hint describing why this breakpoint exists. It is published on /breakpoint_encountered alongside the topic name so the UI can display it under the breakpoint prompt.
IMPORTANT: The breakpoint subscriber has QoS settings of reliable so the publisher to continue or abort is required to match those settings.
EXAMPLE: To continue from a breakpoint on the topic /breakpoint_topic_name the user can enter the following in a terminal to continue. If the value of data is False then the objective will be aborted. ros2 topic pub -1 /breakpoint_topic_name std_msgs/msg/Bool "{data: True}"
Definition at line 48 of file breakpoint_subscriber.hpp.
Public Constructors
BreakpointSubscriber()
|
Declaration at line 51 of file breakpoint_subscriber.hpp, definition at line 34 of file breakpoint_subscriber.cpp.
BreakpointSubscriber()
|
Constructor with injected interfaces for testing.
Declaration at line 55 of file breakpoint_subscriber.hpp, definition at line 45 of file breakpoint_subscriber.cpp.
Private Member Functions
doHalt()
| virtual |
Stops message checking if in progress.
Halts the subscriber interface to interrupt waiting for messages.
Declaration at line 81 of file breakpoint_subscriber.hpp, definition at line 199 of file breakpoint_subscriber.cpp.
doWork()
| virtual |
Function called in the async process thread after the behavior starts running.
Initializes the subscriber, waits for a message on the breakpoint topic, and publishes notifications about breakpoint status.
- Returns
True if the breakpoint should continue, False if it should abort. Returns an error result if initialization failed or message reception failed.
Declaration at line 75 of file breakpoint_subscriber.hpp, definition at line 74 of file breakpoint_subscriber.cpp.
getFuture()
| inline virtual |
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.
Definition at line 86 of file breakpoint_subscriber.hpp.
Private Member Attributes
breakpoint_encountered_publisher_interface_
|
Publisher interface for broadcasting that a breakpoint has been encountered on a particular subscriber topic.
Definition at line 105 of file breakpoint_subscriber.hpp.
breakpoint_resumed_publisher_interface_
|
Publisher interface for broadcasting that a breakpoint has been resumed on a particular subscriber topic.
Definition at line 111 of file breakpoint_subscriber.hpp.
breakpoint_timer_
|
Wall timer that periodically publishes the breakpoint encountered message while waiting.
Definition at line 116 of file breakpoint_subscriber.hpp.
breakpoint_topic_
|
The breakpoint topic name read from the port during doWork().
Definition at line 121 of file breakpoint_subscriber.hpp.
future_
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member.
Definition at line 94 of file breakpoint_subscriber.hpp.
subscriber_interface_
|
Subscriber interface used to get messages from the breakpoint topic.
Definition at line 99 of file breakpoint_subscriber.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 65 of file breakpoint_subscriber.hpp, definition at line 69 of file breakpoint_subscriber.cpp.
providedPorts()
| static |
Declaration at line 63 of file breakpoint_subscriber.hpp, definition at line 59 of file breakpoint_subscriber.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.