Nav2 Navigation Stack - lyrical  lyrical
ROS 2 Navigation Stack
Public Member Functions | Static Public Member Functions | List of all members
nav2_behavior_tree::PauseResumeController Class Reference

Controlled through service calls to pause and resume the execution of the tree It has one mandatory child for the RESUMED, and three optional for the PAUSED state, the ON_PAUSE event and the ON_RESUME event. It has two input ports: More...

#include <nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/pause_resume_controller.hpp>

Inheritance diagram for nav2_behavior_tree::PauseResumeController:
Inheritance graph
[legend]
Collaboration diagram for nav2_behavior_tree::PauseResumeController:
Collaboration graph
[legend]

Public Member Functions

 PauseResumeController (const std::string &xml_tag_name, const BT::NodeConfiguration &conf)
 Constructor.
 
void halt () override
 Reset state and go to Idle.
 
BT::NodeStatus tick () override
 Handle transitions if requested and tick child related to the actual state.
 
state_t getState () const
 

Static Public Member Functions

static BT::PortsList providedPorts ()
 Declare ports.
 

Detailed Description

Controlled through service calls to pause and resume the execution of the tree It has one mandatory child for the RESUMED, and three optional for the PAUSED state, the ON_PAUSE event and the ON_RESUME event. It has two input ports:

The controller starts in RESUMED state, and ticks it until it returns success. When the pause service is called, ON_PAUSE is ticked until completion, then the controller switches to PAUSED state. When the resume service is called, ON_RESUME is ticked until completion, then the controller switches back to RESUMED state.

The controller only returns success when the RESUMED child returns success. The controller returns failure if any child returns failure. In any other case, it returns running.

Usage in XML:

<PauseResumeController pause_service_name="/pause" resume_service_name="/resume">
<!-- RESUMED branch (mandatory) -->
<!-- PAUSED branch (optional) -->
<!-- ON_PAUSE branch (optional) -->
<!-- ON_RESUME branch (optional) -->
<!--
When the ON_PAUSE and ON_RESUME branches fail, the controller will return failure,
halt, and the state will be reset to RESUMED. It might be desirable to retry
the transition a few times before failing for real, which functionality is not built
in the controller node, but is easily achievable by adding a retry node in the BT:
-->
<PauseResumeController pause_service_name="/pause" resume_service_name="/resume">
<!-- RESUMED branch -->
<!-- PAUSED branch -->
<RetryUntilSuccessful num_attempts="3">
<!-- ON_PAUSE branch -->
</RetryUntilSuccessful>
<RetryUntilSuccessful num_attempts="3">
<!-- ON_RESUME branch -->
</RetryUntilSuccessful>
PauseResumeController(const std::string &xml_tag_name, const BT::NodeConfiguration &conf)
Constructor.
void halt() override
Reset state and go to Idle.

Definition at line 106 of file pause_resume_controller.hpp.


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