How splintered-reality/py_trees works
PyTrees is a Python behavior-tree library for decision-making engines, including robotics. A developer assembles a tree from behaviors and control-flow nodes, then the tree manager sets it up and ticks its root; statuses and shared blackboard data represent runtime progress and state. Trees may also be declared in XML using ports and remappings, and inspected through terminal or graph displays. The graph reflects README capabilities and sampled wiring; unsampled modules are included only where their role is documented, with uncertain call links omitted.
Main entry points: behaviour.py Behaviour lifecycle · trees.py Tree manager · composites.py Control composites · blackboard.py Blackboard store
Components 17
Tree execution
- Tree manager
py_trees/trees.py - Behaviour lifecycle
py_trees/behaviour.py - Control composites
py_trees/composites.py - Decorators
py_trees/decorators.py - Built-in behaviours
py_trees/behaviours.py - Tree idioms
py_trees/idioms.py - Statuses and policies
py_trees/common.py
Shared data
- Blackboard store
py_trees/blackboard.py - Ports and remapping
py_trees/ports.py - Port utilities
py_trees/ports_utils.py
Tree authoring
- XML tree parser
py_trees/parsers/behaviour_tree_xml.py
Inspection tools
- Tree visitors
py_trees/visitors.py - Tree and state display
py_trees/display.py - Tree render command
py_trees/programs/render.py - Runtime logging
py_trees/logging.py
Other components
- Application developer
- Decision outcomes
Connections 23
- Application developer → Tree manager: assembles and ticks
- Tree manager → Behaviour lifecycle: sets up and ticks
- Behaviour lifecycle → Control composites: extended by
- Behaviour lifecycle → Decorators: wrapped by
- Control composites → Behaviour lifecycle: ticks children
- Decorators → Behaviour lifecycle: ticks child
- Built-in behaviours → Behaviour lifecycle: implements
- Tree idioms → Behaviour lifecycle: builds patterns
- Tree manager → Statuses and policies: uses statuses
- Control composites → Statuses and policies: uses policies
- Behaviour lifecycle → Blackboard store: attaches clients
- Built-in behaviours → Blackboard store: reads and writes
- Ports and remapping → Blackboard store: maps port data
- XML tree parser → Control composites: constructs nodes
- XML tree parser → Ports and remapping: configures ports
- XML tree parser → Built-in behaviours: constructs nodes
- Port utilities → Behaviour lifecycle: searches tree
- Tree manager → Tree visitors: dispatches visits
- Tree and state display → Blackboard store: reads state
- Tree render command → Tree and state display: renders tree
- Tree manager → Decision outcomes: produces statuses
- Tree and state display → Decision outcomes: presents progress
- Behaviour lifecycle → Runtime logging: records events