Skip to main content

pythonic implementation of behaviour trees

Project description

PyTrees

[About] [What's New?] [Documentation] [Getting Started] [Next Steps] [Releases]


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:

  • Behaviours, Decorators, Sequences, Selectors, Parallels and BehaviourTree.
  • Blackboards for data sharing.
  • A useful library of behaviours, decorators, and idioms.
  • Serialise to a dot graph or render to ascii/unicode in a terminal.
  • Tested on Linux and Mac (YMMV with Windows).

What's New?

  • [2025-01-11] Support for Python 3.12 was added, and Python 3.8 was dropped.

Documentation

devel 2.3.x 2.2.x 2.1.x

Getting Started

You can get started on Codespaces (with no mismatched environment issues and in under 5 minutes) [1]:

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

# Explore the demos
(docker) zen@py_trees:/workspaces/py_trees$ poetry shell
(py-trees-py3.10) (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.10) (docker) zen@py_trees:/workspaces/py_trees$ py-trees-demo-blackboard
...
(py-trees-py3.10) (docker) zen@py_trees:/workspaces/py_trees$ exit

# Hack some Code

# Run the Formatter, Tests, Linters and Mypy
(docker) zen@py_trees:/workspaces/py_trees$ poetry run tox -l
py310 py312 format check mypy310 mypy312
(docker) zen@py_trees:/workspaces/py_trees$ poetry run tox -e format
...
(docker) zen@py_trees:/workspaces/py_trees$ poetry run tox -e py310
...
(docker) zen@py_trees:/workspaces/py_trees$ poetry run tox -e check
...

# Contribute a PR!
# https://github.com/splintered-reality/py_trees/blob/devel/CONTRIBUTING.md

[1] All of the above will, of course, work in a local environment if you have poetry installed. If you're using VSCode you don't even need that, just reopen the project in the devcontainer and be froody.

Next Steps

On PyPi:

Examples:

  • ReadTheDocs - PyTrees ROS Tutorials - significantly more edifying than the demos, these incrementally walk through the process of building a decision making layer for a robot. These use ROS2 (sparsely), but merely browsing should be enlightening regardless.

Visualisation:

  • py_trees_js - a javascript library for building your own runtime visualisation tool

Robotics:

Releases

  • 2.3.x - Support for Python 3.12 was added, and Python 3.8 was dropped.
  • 2.2.x - Selectors, Sequences with and without memory. Improved testing and style/type checking.
  • 2.1.x - Chooser deprecated. API housekeeping.
  • 2.0.x - Blackboards V2!
  • 1.2.x - Trees can now shutdown cleanly. StatusToBlackboard and EternalGuard, Visitors get finalise().
  • 1.1.x - Fixes for setup, tick-tock, viz.
  • 1.0.x - Behaviours, Decorators, Composites, Blackboards, Tree Management and Viz tools.
  • 0.y.x - First open source pre-releases.
Devel 2.3.x 2.2.x 2.1.x 2.0.x 1.2.x
Sources devel 2.3.x 2.2.x 2.1.x 2.0.x 1.2.x
Compatibility Python 3.12
Python 3.10
Python 3.12
Python 3.10
Python 3.10
Python 3.8
Python 3.6 Python 3.6 Python 3.6
CI devel-Status 2.3.x-Status 2.2.x-Status - - -
Documentation devel-Docs 2.3.x-Docs 2.2.x-Docs 2.1.x-Docs 2.0.x-Docs 1.2.x-Docs

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.3.0.tar.gz (84.1 kB view details)

Uploaded Source

Built Distribution

py_trees-2.3.0-py3-none-any.whl (112.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_trees-2.3.0.tar.gz
  • Upload date:
  • Size: 84.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for py_trees-2.3.0.tar.gz
Algorithm Hash digest
SHA256 ff36cf3f228589d2efaaaa26eaebb08e1f9f7baa2b06398bc721e953aa45531f
MD5 61ae74bf4b8e8d3243ec25547de919b1
BLAKE2b-256 4fb61ab21ed427e2508135186de187bba5bba674b77746f0b130b33cbe68e621

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_trees-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 112.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for py_trees-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02831face639b15edd5830df76dd59f358358177384543cf17a5e019370bffc2
MD5 4eb1614c0880488b150a1d4fd7701c09
BLAKE2b-256 391c9f32299572bce7c1d46ca98425d82f3fe6723a526f05a01b39d491cbfdf6

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