robokudo.display¶
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¶
|
Generate the pydot graph - this is usually the first step in |
|
Generate dot tree graphs and return a string representation |
|
Render the dot tree to .dot, .svg, .png. files in the current |
|
Module Contents¶
- robokudo.display.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
render_dot_tree()
.- Args:
-
root (
Behaviour
): the root of a tree, or subtree visibility_level (:class`~py_trees.common.VisibilityLevel`): collapse subtrees at or under this level collapse_decorators (bool
): only show the decorator (not the child) - Returns:
-
pydot.Dot: graph and dict with timing information
- robokudo.display.stringify_dot_tree(root)¶
-
Generate dot tree graphs and return a string representation of the dot graph.
- Args:
-
root (
Behaviour
): the root of a tree, or subtree - Returns:
-
str
: dot graph as a string
- robokudo.display.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 (
Behaviour
): the root of a tree, or subtree visibility_level (:class`~py_trees.common.VisibilityLevel`): collapse subtrees at or under this level collapse_decorators (bool
): only show the decorator (not the child) name (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:
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.
- robokudo.display.write_timing_info_to_csv(filename_wo_extension, timing_info_dict)¶