Skip to main content

Fallback node

Fallback node representation

The fallback node implements trying a number of actions until one succeeds, or all will fail. When the node is selected, it immediately enters the running state. While running, it will select the child node for which all predecessors have failed. Once a child node succeeds, the fallback node will also transition to succeeded. If no child succeeds, the fallback node will fail.

Properties

PropertyDescription
Child semanticsexecuted in-order until one child succeeds or all have failed
Parametersname: name of the node
children: ordered list of sub-trees to try
Success criterionone child has succeeded
Failure criterionall children have failed (it does not matter in which stage).

Python API

The node can be constructed by parameterizing it either on creation or by using the builder pattern. Combining the fallback node with the Retry and the Fail node allows for cleanup actions before re-trying.

# reset sequence to cleanup before next retry
# the fail node in the end gets added such that the retry node triggers
backoff_and_retry = BT.Sequence(children=[backoff, estimate_and_update_pose, fail])
simple_fallback = BT.Fallback(children=[assemble, backoff_and_retry])

retry = BT.Retry(child=simple_fallback, num_tries=4)