robokudo.tree_components.render_dot¶
Behavior tree visualization using DOT format.
This module provides functionality to render behavior trees in DOT format for visualization. It supports both one-time rendering and decorator-based automatic rendering on status changes.
The module provides:
Directory management for output
Threaded rendering for performance
Customizable rendering triggers
Tree traversal utilities
Classes¶
Behavior that renders tree to DOT format when ticked. |
|
Decorator that renders tree when child returns specific status. |
Functions¶
|
Create directory if it doesn't exist. |
|
Generate behavior tree snapshot and save to disk. |
Module Contents¶
- robokudo.tree_components.render_dot.create_dir_if_not_exists(path: str) None¶
-
Create directory if it doesn’t exist.
- Parameters:
-
path – Directory path to create
- robokudo.tree_components.render_dot.render_now(behaviour: typing_extensions.Union[RenderTreeToDot, RenderTreeToDotDecorator]) None¶
-
Generate behavior tree snapshot and save to disk.
This method: * Creates output directory if needed * Finds root of tree * Renders tree to DOT format * Updates rendering statistics
- Parameters:
-
behaviour – Behavior node requesting the render
- class robokudo.tree_components.render_dot.RenderTreeToDot(path: typing_extensions.Optional[str] = None, suffix: str = '')¶
-
Bases:
py_trees.behaviour.BehaviourBehavior that renders tree to DOT format when ticked.
This behavior renders the entire tree to DOT format each time it is ticked, saving the output to the specified directory.
- path: typing_extensions.Optional[str] = None¶
-
Output directory path
- counter: int = 0¶
-
Number of renders performed
- create_dir_for_path: bool = True¶
-
Whether to create output directory
- executor: concurrent.futures.ThreadPoolExecutor¶
-
Thread pool for rendering
- suffix: str = ''¶
-
Suffix to append to output filenames
- update() py_trees.common.Status¶
-
Render tree on each tick.
- Returns:
-
Always returns SUCCESS
- class robokudo.tree_components.render_dot.RenderTreeToDotDecorator(child: typing_extensions.Optional[py_trees.behaviour.Behaviour] = None, path: typing_extensions.Optional[str] = None, suffix: str = '', trigger_when_status_is: typing_extensions.Optional[typing_extensions.List[py_trees.common.Status]] = None)¶
-
Bases:
py_trees.decorators.DecoratorDecorator that renders tree when child returns specific status.
This decorator monitors its child’s status and triggers a tree render when the status matches configured triggers.
- trigger_when_status_is: typing_extensions.List[py_trees.common.Status] = None¶
-
List of status values that trigger rendering
- path: str = None¶
-
Output directory path
- counter: int = 0¶
-
Number of renders performed
- create_dir_for_path: bool = True¶
-
Whether to create output directory
- executor: concurrent.futures.ThreadPoolExecutor¶
-
Thread pool for rendering
- suffix: str = ''¶
-
Suffix to append to output filenames
- update() py_trees.common.Status¶
-
Check child status and render if triggered.
- Returns:
-
Status of decorated child