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

RenderTreeToDot

Behavior that renders tree to DOT format when ticked.

RenderTreeToDotDecorator

Decorator that renders tree when child returns specific status.

Functions

create_dir_if_not_exists(path)

Create directory if it doesn't exist.

render_now(behaviour)

Generate behavior tree snapshot and save to disk.

Module Contents

robokudo.tree_components.render_dot.create_dir_if_not_exists(path)

Create directory if it doesn’t exist.

Parameters:

path (str) – Directory path to create

robokudo.tree_components.render_dot.render_now(behaviour: py_trees.Behaviour)

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 (py_trees.Behaviour) – Behavior node requesting the render

class robokudo.tree_components.render_dot.RenderTreeToDot(path=None, suffix='')

Bases: py_trees.Behaviour

Behavior 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.

Variables:
  • path – Output directory path

  • counter – Number of renders performed

  • create_dir_for_path – Whether to create output directory

  • executor – Thread pool for rendering

  • suffix – Suffix to append to output filenames

path = None
counter = 0
create_dir_for_path = True
executor
suffix = ''
update()

Render tree on each tick.

Returns:

Always returns SUCCESS

Return type:

py_trees.common.Status

class robokudo.tree_components.render_dot.RenderTreeToDotDecorator(child=None, path=None, suffix='', trigger_when_status_is=None)

Bases: py_trees.decorators.Decorator

Decorator 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.

Variables:
  • path – Output directory path

  • counter – Number of renders performed

  • create_dir_for_path – Whether to create output directory

  • executor – Thread pool for rendering

  • suffix – Suffix to append to output filenames

  • trigger_when_status_is – List of status values that trigger rendering

trigger_when_status_is = None
path = None
counter = 0
create_dir_for_path = True
executor
suffix = ''
update()

Check child status and render if triggered.

Returns:

Status of decorated child

Return type:

py_trees.common.Status