Features

Behaviours

py_trees_ros.action_clients.FromBlackboard(...)

An action client interface that draws goals from the blackboard.

py_trees_ros.action_clients.FromConstant(...)

Convenience version of the action client that only ever sends the same goal.

py_trees_ros.battery.ToBlackboard(name, ...)

Subscribes to the battery message and writes battery data to the blackboard.

py_trees_ros.publishers.FromBlackboard(name, ...)

This behaviour looks up the blackboard for content to publish .

py_trees_ros.subscribers.CheckData(name, ...)

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(name, ...)

Saves the latest message to the blackboard and immediately returns success.

py_trees_ros.subscribers.WaitForData(name, ...)

Waits for a subscriber's callback to be triggered.

py_trees_ros.transforms.FromBlackboard(name, ...)

Broadcast a transform from the blackboard using the transform broadcaster mechanisms.

py_trees_ros.transforms.ToBlackboard(name, ...)

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 both blackboard and (tree) snapshot streaming services. Interact with these services via the py-trees-blackboard-watcher and py-trees-tree-watcher command line utilities.

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.

Examples:

# list all keys on the blackboard
$ py-trees-blackboard-watcher --list
# stream all variables
$ py-trees-blackboard-watcher 
# stream only visited variables and access details
$ py-trees-blackboard-watcher --visited --activity
# stream a single variable
$ py-trees-blackboard-watcher odometry
# stream only a single field within a variable
$ py-trees-blackboard-watcher odometry.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!

Render a oneshot snapshot of the tree as a dot graph, or stream it and it’s state continuously as unicode art on your console. This utility automatically discovers the running tree and opens interfaces to that, but if there is more than one tree executing use the namespace argument to differentiate between trees.

Examples:

# render the tree as a dot graph (does not include runtime information)
$ py-trees-tree-watcher --dot-graph
# connect to an existing snapshot stream (e.g. the default, if it is enabled)
$ py-trees-tree-watcher /tree/snapshots
# open and connect to a snapshot stream, visualise the tree graph and it's changes only
$ py-trees-tree-watcher 
# open a snapshot stream and include visited blackboard variables
$ py-trees-tree-watcher -b
# open a snapshot stream and include blackboard access details (activity)
$ py-trees-tree-watcher -a
# open a snapshot stream and include timing statistics
$ py-trees-tree-watcher -s

usage: py-trees-tree-watcher [-h] [-n [NAMESPACE_HINT]] [-a] [-b] [-s]
                             [--snapshots | --dot-graph]
                             [topic_name]

Positional Arguments

topic_name

snapshot stream to connect to, will create a temporary stream if none specified

Named Arguments

-n, --namespace-hint

namespace hint snapshot stream services (if there should be more than one tree)

-a, --blackboard-activity

show logged activity stream (streaming mode only)

Default: False

-b, --blackboard-data

show visited path variables (streaming mode only)

Default: False

-s, --statistics

show tick timing statistics (streaming mode only)

Default: False

--snapshots

render ascii/unicode snapshots from a snapshot stream

--dot-graph

render the tree as a dot graph

Command line utility that introspects on a running BehaviourTree instance over it’s snapshot stream interfaces. Use to visualise the tree as a dot graph or track tree changes, timing statistics and blackboard variables visited by the tree on each tick.

_images/tree-watcher.gif