Features

Behaviours

py_trees_ros.actions.ActionClient(…[, …]) A generic action client interface.
py_trees_ros.battery.ToBlackboard(…[, …]) Subscribes to the battery message and writes battery data to the blackboard.
py_trees_ros.subscribers.CheckData(…[, …]) Check a subscriber to see if it has received data.
py_trees_ros.subscribers.EventToBlackboard(…) Listen for events (std_msgs.msg.Empty) on a subscriber and writes the result to the blackboard.
py_trees_ros.subscribers.ToBlackboard(…[, …]) Saves the latest message to the blackboard and immediately returns success.
py_trees_ros.subscribers.WaitForData(…[, …]) Waits for a subscriber’s callback to be triggered.
py_trees_ros.transforms.FromBlackboard(…) Broadcast a transform from the blackboard using the transform broadcaster mechanisms.
py_trees_ros.transforms.ToBlackboard(…[, …]) Blocking behaviour that looks for a transform and writes it to a variable on the blackboard.

Blackboards

This module provides the py_trees_ros.blackboard.Exchange class, a ROS wrapper around a Blackboard that permits introspection of either the entire board or a window onto a smaller part of the board over a ROS API via the py-trees-blackboard-watcher command line utility.

Trees

The py_trees_ros.trees.BehaviourTree class extends the core py_trees.trees.BehaviourTree class with a ROS publisher that publishes the initial and updated snapshots of the tree whenever the tree changes.

‘Change’ is defined by deletion or insertion of behaviours into the tree or the status of any behaviour in the tree changing from tick to tick.

Programs

py-trees-blackboard-watcher

Open up a window onto the blackboard!

Introspect on the entire blackboard or a part thereof and receive a stream of updates whenever values change. Reach into individual keys or the nested attributes of keys. Use –visited to watch only the relevant sections of the board traversed by behaviours on the last tick. Use –activity to get a detailed breakdown of blackboard access (read/write/set/unset).

Examples:

$ py-trees-blackboard-watcher 
$ py-trees-blackboard-watcher --visited --activity
$ py-trees-blackboard-watcher --list-variables
$ py-trees-blackboard-watcher access_point odom/pose/pose/position

usage: py-trees-blackboard-watcher [-h] [-l] [-a] [-v] [-n [NAMESPACE]] ...

Positional Arguments

variables

space separated list of blackboard variable names (may be nested) to watch

Default: []

Named Arguments

-l, --list list the blackboard variable names
-a, --activity

include the logged activity stream for recent changes

Default: False

-v, --visited

filter selected keys from those associated with behaviours on the most recent tick’s visited path

Default: False

-n, --namespace
 namespace of blackboard services (if there should be more than one blackboard)

Example interaction with the services of an py_trees_ros.blackboard.Exchange:

_images/blackboard-watcher.gif

py-trees-tree-watcher

Open up a window onto the behaviour tree!

Print a single snapshot, or stream the tree state as unicode art on your console or render the tree as a dot graph (does not include behaviour’s status flags). Use the namespace argument to select from trees when there are multiple available.

Examples:

$ py-trees-tree-watcher 
$ py-trees-tree-watcher --stream
$ py-trees-tree-watcher --snapshot
$ py-trees-tree-watcher --dot-graph
$ py-trees-tree-watcher --namespace=foo --stream

usage: py-trees-tree-watcher [-h] [-n [NAMESPACE]] [-a] [-b] [-s]
                             [--stream | --snapshot | --dot-graph]

Named Arguments

-n, --namespace
 namespace of pytree communications (if there should be more than one tree active)
-a, --stream-blackboard-activity
 

show logged activity stream (streaming mode only)

Default: False

-b, --stream-blackboard-variables
 

show visited path variables (streaming mode only)

Default: False

-s, --stream-statistics
 

show tick timing statistics (streaming mode only)

Default: False

--stream stream the tree state as unicode art on your console
--snapshot print a single snapshot as unicode art on your console
--dot-graph render the tree as a dot graph

Command line utility to interact with a running BehaviourTree instance. Print the tree structure or a live snapshot of the tree state as unicode art on your console, view tick statistics as a stream or display the tree as a dot graph.

_images/tree-watcher.gif