|
AutoAPMS
Streamlining behaviors in ROS 2
|
Condition node that succeeds once the mode with the expected nav_state reports successful completion. More...

Additional Inherited Members | |
Public Member Functions inherited from RosSubscriberNode< px4_msgs::msg::ModeCompleted > | |
| RosSubscriberNode (const std::string &instance_name, const Config &config, Context context, const rclcpp::QoS &qos={10}) | |
| Constructor. | |
| virtual BT::NodeStatus | onMessageReceived (const px4_msgs::msg::ModeCompleted &msg) |
| Callback invoked when the node is ticked and a valid message has been received. | |
| bool | createSubscriber (const std::string &topic_name) |
| Create the ROS 2 subscriber. | |
| std::string | getTopicName () const |
| Get the name of the topic name this node subscribes to. | |
Static Public Member Functions inherited from RosSubscriberNode< px4_msgs::msg::ModeCompleted > | |
| static BT::PortsList | providedBasicPorts (BT::PortsList addition) |
| Derived nodes implementing the static method RosSubscriberNode::providedPorts may call this method to also include the default port for ROS 2 behavior tree nodes. | |
| static BT::PortsList | providedPorts () |
| If a behavior tree requires input/output data ports, the developer must define this method accordingly. | |
Protected Member Functions inherited from RosNodeBase | |
| void | applyPortAliasing (const BT::TreeNode *node) const |
| Support the node manifest 'port_alias' feature: copy the aliased port values onto the original ports the node implementation reads. | |
| template<typename InstanceT> | |
| std::shared_ptr< InstanceT > | getSharedEntity (const std::string &entity_name, const std::function< std::shared_ptr< InstanceT >()> &factory) |
Retrieve a process-wide shared ROS 2 entity, creating it via factory on first use. | |
Condition node that succeeds once the mode with the expected nav_state reports successful completion.
Subscribes to fmu/out/mode_completed (message version suffix resolved at runtime). PX4's auto modes (e.g. Takeoff, Land, RTL, Mission) publish a single ModeCompleted message when the maneuver finishes; this node returns SUCCESS on the tick that delivers a completion for the nav_state input port with result RESULT_SUCCESS, otherwise FAILURE.
Because mode_completed is published only once (not continuously like vehicle_status), wrap this node in an infinite RetryUntilSuccessful decorator: the subscription callback buffers the one-shot message and the retry loop catches it on the next tick. Unlike CheckNavState (which confirms a mode merely became active), this node waits for the mode to actually run to completion - use it to build the execution ("Do") behaviors such as DoTakeoff/DoLanding.
Definition at line 42 of file check_mode_completed.cpp.