robokudo.tree_components.better_parallel¶
Enhanced parallel behavior tree components.
This module provides enhanced parallel behavior tree components that improve upon the standard py_trees parallel implementation. It supports:
Configurable success policies
Synchronization options
Child status management
Improved interrupt handling
The module is primarily used for:
Complex parallel task execution
Synchronized behavior coordination
Robust failure handling
Classes¶
Configurable policies for parallel behavior execution. |
|
Enhanced parallel behavior tree node. |
Module Contents¶
- class robokudo.tree_components.better_parallel.ParallelPolicy¶
-
Bases:
objectConfigurable policies for parallel behavior execution.
This class provides policy configurations that determine how parallel behaviors complete based on their children’s status.
- Variables:
-
synchronise – Whether to synchronize child execution
- class Base(synchronise=False)¶
-
Bases:
objectBase class for parallel policies.
Warning
Should never be used directly. Use derived policy classes instead.
- Variables:
-
synchronise – Whether to stop ticking successful children
- synchronise = False¶
- class SuccessOnAll(synchronise=True)¶
-
Bases:
BasePolicy requiring all children to succeed.
Returns SUCCESS only when each child returns SUCCESS. With synchronization, successful children are skipped until all succeed or one fails.
- Variables:
-
synchronise – Whether to stop ticking successful children
- class SuccessOnOne¶
-
Bases:
BasePolicy requiring only one child to succeed.
Returns SUCCESS when at least one child succeeds and others are RUNNING.
- Variables:
-
synchronise – Always False for this policy
- class SuccessOnSelected(children, synchronise=True)¶
-
Bases:
BasePolicy requiring specific children to succeed.
Returns SUCCESS when all specified children succeed. With synchronization, successful children are skipped until all specified succeed or one fails.
- Variables:
-
synchronise – Whether to stop ticking successful children
children – List of children that must succeed
- children¶
- class robokudo.tree_components.better_parallel.Parallel¶
-
Bases:
py_trees.composites.ParallelEnhanced parallel behavior tree node.
This class extends py_trees.composites.Parallel with:
Improved policy handling
Better child status management
Proper interrupt propagation
Note
Children are ticked in sequence but may run concurrently.
- tick()¶
-
Tick all children according to policy.
This method: * Initializes if not running * Ticks each child according to policy * Updates status based on children and policy * Handles interrupts for running children
- Yield:
-
Reference to self or children during traversal
- Return type:
-
Behaviour