robokudo.display ================ .. py:module:: robokudo.display .. autoapi-nested-parse:: ORIGINAL BY PY_TREES. ADAPTED FOR ROBOKUDO. Behaviour trees are significantly easier to design, monitor and debug with visualisations. Py Trees does provide minimal assistance to render trees to various simple output formats. Currently this includes dot graphs, strings or stdout. Functions --------- .. autoapisummary:: robokudo.display.generate_pydot_graph robokudo.display.stringify_dot_tree robokudo.display.render_dot_tree robokudo.display.write_timing_info_to_csv Module Contents --------------- .. py:function:: generate_pydot_graph(root, visibility_level, collapse_decorators=False) Generate the pydot graph - this is usually the first step in rendering the tree to file. See also :py:func:`render_dot_tree`. Args: root (:class:`~py_trees.behaviour.Behaviour`): the root of a tree, or subtree visibility_level (:class`~py_trees.common.VisibilityLevel`): collapse subtrees at or under this level collapse_decorators (:obj:`bool`): only show the decorator (not the child) Returns: pydot.Dot: graph and dict with timing information .. py:function:: stringify_dot_tree(root) Generate dot tree graphs and return a string representation of the dot graph. Args: root (:class:`~py_trees.behaviour.Behaviour`): the root of a tree, or subtree Returns: :obj:`str`: dot graph as a string .. py:function:: render_dot_tree(root, visibility_level=common.VisibilityLevel.DETAIL, collapse_decorators=False, name=None, threadpool_executor: concurrent.futures.ThreadPoolExecutor = None, path_prefix=None) Render the dot tree to .dot, .svg, .png. files in the current working directory. These will be named with the root behaviour name. Args: root (:class:`~py_trees.behaviour.Behaviour`): the root of a tree, or subtree visibility_level (:class`~py_trees.common.VisibilityLevel`): collapse subtrees at or under this level collapse_decorators (:obj:`bool`): only show the decorator (not the child) name (:obj:`str`): name to use for the created files (defaults to the root behaviour name) threadpool_executor: You can pass a ThreadPoolExecutor for file writing path_prefix: Pass a string that shall be put before the filename Example: Render a simple tree to dot/svg/png file: .. graphviz:: dot/sequence.dot .. code-block:: python root = py_trees.composites.Sequence("Sequence") for job in ["Action 1", "Action 2", "Action 3"]: success_after_two = py_trees.behaviours.Count(name=job, fail_until=0, running_until=1, success_until=10) root.add_child(success_after_two) py_trees.display.render_dot_tree(root) .. tip:: A good practice is to provide a command line argument for optional rendering of a program so users can quickly visualise what tree the program will execute. .. py:function:: write_timing_info_to_csv(filename_wo_extension, timing_info_dict)