robokudo.tree_components.render_dot =================================== .. py:module:: robokudo.tree_components.render_dot .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: robokudo.tree_components.render_dot.RenderTreeToDot robokudo.tree_components.render_dot.RenderTreeToDotDecorator Functions --------- .. autoapisummary:: robokudo.tree_components.render_dot.create_dir_if_not_exists robokudo.tree_components.render_dot.render_now Module Contents --------------- .. py:function:: create_dir_if_not_exists(path) Create directory if it doesn't exist. :param path: Directory path to create :type path: str .. py:function:: 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 :param behaviour: Behavior node requesting the render :type behaviour: py_trees.Behaviour .. py:class:: RenderTreeToDot(path=None, suffix='') Bases: :py:obj:`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. :ivar path: Output directory path :type path: str :ivar counter: Number of renders performed :type counter: int :ivar create_dir_for_path: Whether to create output directory :type create_dir_for_path: bool :ivar executor: Thread pool for rendering :type executor: ThreadPoolExecutor :ivar suffix: Suffix to append to output filenames :type suffix: str .. py:attribute:: path :value: None .. py:attribute:: counter :value: 0 .. py:attribute:: create_dir_for_path :value: True .. py:attribute:: executor .. py:attribute:: suffix :value: '' .. py:method:: update() Render tree on each tick. :return: Always returns SUCCESS :rtype: :class:`py_trees.common.Status` .. py:class:: RenderTreeToDotDecorator(child=None, path=None, suffix='', trigger_when_status_is=None) Bases: :py:obj:`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. :ivar path: Output directory path :type path: str :ivar counter: Number of renders performed :type counter: int :ivar create_dir_for_path: Whether to create output directory :type create_dir_for_path: bool :ivar executor: Thread pool for rendering :type executor: ThreadPoolExecutor :ivar suffix: Suffix to append to output filenames :type suffix: str :ivar trigger_when_status_is: List of status values that trigger rendering :type trigger_when_status_is: list .. py:attribute:: trigger_when_status_is :value: None .. py:attribute:: path :value: None .. py:attribute:: counter :value: 0 .. py:attribute:: create_dir_for_path :value: True .. py:attribute:: executor .. py:attribute:: suffix :value: '' .. py:method:: update() Check child status and render if triggered. :return: Status of decorated child :rtype: :class:`py_trees.common.Status`