Skip to main content

pythonic implementation of behaviour trees

Project description

Py Trees

[About][Documentation][Getting Started][Releases][Installation][PyTrees-Ros Ecosystem][Developers]


About

PyTrees is a python implementation of behaviour trees designed to facilitate the rapid development of medium sized decision making engines for use in fields like robotics. Brief feature list:

  • Sequence, Selector, Parallel composites
  • Blackboards for data sharing
  • Python generators for smarter ticking over the tree graph
  • Python decorators for enabling meta behaviours
  • Render trees to dot graphs or visualise with ascii graphs on stdout

Documentation

devel 2.1.x 0.7.x 0.6.x

Getting Started

VSCode and a py38 DevContainer on CodeSpaces will set you up with an environment for running demos, tests and/or creating PRs in less than five minutes. If you're just looking for releases, fetch them from PyPi.

  1. Fork the project to your personal account
  2. Click on Code -> Codespaces -> + Create a Codespace
  3. Be froody
(docker) zen@py_trees:/workspaces/py_trees$ poetry install
(docker) zen@py_trees:/workspaces/py_trees$ poetry shell

(py-trees-py3.8) (docker) zen@py_trees:/workspaces/py_trees$ py-trees-demo-<tab>-<tab>
py-trees-demo-action-behaviour            py-trees-demo-context-switching           py-trees-demo-logging
py-trees-demo-behaviour-lifecycle         py-trees-demo-display-modes               py-trees-demo-pick-up-where-you-left-off
py-trees-demo-blackboard                  py-trees-demo-dot-graphs                  py-trees-demo-selector
py-trees-demo-blackboard-namespaces       py-trees-demo-either-or                   py-trees-demo-sequence
py-trees-demo-blackboard-remappings       py-trees-demo-eternal-guard               py-trees-demo-tree-stewardship

(py-trees-py3.8) (docker) zen@py_trees:/workspaces/py_trees$ py-trees-demo-blackboard
*******************************************************************************
                                   Blackboard
*******************************************************************************

Demonstrates usage of the blackboard and related behaviours.

A sequence is populated with a few behaviours that exercise
reading and writing on the Blackboard in interesting ways.

*******************************************************************************

[DEBUG] Writer               : BlackboardWriter.__init__()
...
...

If you're really looking for something more edifying than hello world examples, walk through the ros tutorials which incrementally step through the process of building a scenario handling layer for a robot.

There are also runtime visualisation tools - refer to the py_trees_ros_viewer/README as an example implementation of the underlying py_trees_js library.

Releases

  • 0.y.x - first open source releases
  • 1.0.x - first stable release
  • 1.1.x - improvements
  • 1.2.x - improvements
  • 2.0.x - blackboards v2 with namespaces, access permissions and key tracking
  • 2.1.x - Chooser deprecated, api housekeeping
Devel 2.1.x 2.0.x 1.2.x 0.7.x 0.6.x
Sources devel 2.1.x 2.0.x 1.2.x 0.7.x 0.6.x
Compatibility Python 3.6 Python 3.6 Python 3.6 Python 3.6 Python 3.6 Python 2.7
CI devel-Status 2.1.x-Status 2.0.x-Status 1.2.x-Status 0.7.x-Status 0.6.x-Status
Documentation devel-Docs 2.1.x-Docs 2.0.x-Docs 1.2.x-Docs 0.7.x-Docs 0.6.x-Docs

Installation

From ppa on Ubuntu/Bionic:

$ sudo apt install python3-py-trees

From pypi:

$ pip3 install py_trees

In a Python Virtual Environment:

$ git clone https://github.com/splintered-reality/py_trees
$ cd py_trees
$ source ./venv.bash

Build your own python3 deb:

$ git clone https://github.com/splintered-reality/py_trees
$ cd py_trees
$ source ./venv.bash
$ make deb

From the ROS2 ecosystem:

$ sudo apt install ros-<rosdistro>-py-trees

PyTrees-ROS Ecosystem

See the py_trees_ros README for the latest information on pytrees packages in the ROS ecosystem and their status.

Developers

Documentation

# Build Locally
$ make -C docs html

# ReadTheDocs requirements
$ poetry export -f requirements.txt --with docs -o docs/requirements.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_trees-2.2.1.tar.gz (86.2 kB view details)

Uploaded Source

Built Distribution

py_trees-2.2.1-py3-none-any.whl (112.3 kB view details)

Uploaded Python 3

File details

Details for the file py_trees-2.2.1.tar.gz.

File metadata

  • Download URL: py_trees-2.2.1.tar.gz
  • Upload date:
  • Size: 86.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.8.16 Linux/5.15.0-56-generic

File hashes

Hashes for py_trees-2.2.1.tar.gz
Algorithm Hash digest
SHA256 1d8dbc17d3ead21fe2ad4df421928feab4b999b535814c16352dd9558668eadc
MD5 cd176058a8ec2c887f39065e76d8ed29
BLAKE2b-256 24ff56689b2984436dcb82d6183bd15a0c0666eb058ea799c219a2ea485da639

See more details on using hashes here.

File details

Details for the file py_trees-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: py_trees-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 112.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.8.16 Linux/5.15.0-56-generic

File hashes

Hashes for py_trees-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e1e518d7f70a48add0820d1ac623b245c846be1aedff126d52759e0481099eb1
MD5 b13946bafe32d0e52edcfcfeff5f4578
BLAKE2b-256 d7adae0e6e1271cb2aaa2f5a73d888c02dce3c2e151117021ac1e304c5744599

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page