You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: behavior_trees/overview/nav2_specific_nodes.rst
+68Lines changed: 68 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -315,3 +315,71 @@ To explain this further, here is an example BT that uses NonblockingSequence.
315
315
Recall that if ``Action_A``, ``Action_B``, or ``Action_C`` returned ``FAILURE`` at any point of time, the parent would have returned ``FAILURE`` and halted any children as well.
316
316
317
317
For additional details regarding the ``NonblockingSequence`` please see the `NonblockingSequence configuration guide <../../configuration/packages/bt-plugins/controls/NonblockingSequence.html>`_.
318
+
319
+
Control: PersistentSequence
320
+
----------------------------
321
+
322
+
The ``PersistentSequence`` is similar to the ``Sequence`` node, but it stores the index of the last running child in the blackboard (key: "current_child_idx"), and it does not reset the index on halt.
323
+
324
+
For more information see the ``Sequence`` BT node in BT.CPP.
The ``PauseResumeController`` is a control node that adds pause and resume functionality to a behavior tree through service calls.
343
+
344
+
It has one mandatory child for the RESUMED, and three optional for the PAUSED state, the ON_PAUSE event and the ON_RESUME event.
345
+
It has two input ports:
346
+
347
+
- ``pause_service_name``: name of the service to pause
348
+
- ``resume_service_name``: name of the service to resume
349
+
350
+
1. The controller starts in RESUMED state, and ticks it until it returns success.
351
+
2. When the pause service is called, ON_PAUSE is ticked until completion, then the controller switches to PAUSED state.
352
+
3. In PAUSED state the PAUSED child is ticked until the state is changed, or until it returns failure.
353
+
4. When the resume service is called, ON_RESUME is ticked until completion, then the controller switches back to RESUMED state.
354
+
355
+
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.
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:
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:
The PersistentSequenceNode is similar to the SequenceNode, but it stores the index of the last running child in the blackboard (key: `current_child_idx`), and it does not reset the index when it got halted. It used to tick children in an ordered sequence. If any child returns RUNNING, previous children will NOT be ticked again.
7
+
This can be helpful paired with the ``PauseResumeController``.
8
+
9
+
- If all the children return SUCCESS, this node returns SUCCESS.
10
+
- If a child returns RUNNING, this node returns RUNNING. Loop is NOT restarted, the same running child will be ticked again.
11
+
- If a child returns FAILURE, stop the loop and return FAILURE. Restart the loop only if (reset_on_failure == true)
In `PR #5247 <https://github.com/ros-navigation/navigation2/pull/5247>`_ two new Nav2 specific behavior tree control nodes have been added.
233
+
234
+
The ``PauseResumeController`` (`docs <../configuration/packages/bt-plugins/controls/PauseResumeController.html>`_) adds services to pause and resume execution of the tree. Related to this, the ``PersistentSequence`` (`docs <../configuration/packages/bt-plugins/controls/PersistentSequence.html>`_) control node allows the child index to be exposed to the behavior tree through a bidirectional port. This allows the sequence to be continued on resume where it was paused.
0 commit comments