PR 1/4 : Add python bindings to BehaviorTree.CPP#1143
Open
kmolan wants to merge 8 commits into
Open
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was originally going to do this all in one PR, before I realized no one wants to review a 10,000 line PR lol. So I'm splitting this work in four incremental PRs - this is the first one. It adds the minimal foundational elements that I will build upon later.
The goal: Create
pybt- python bindings for BehaviorTree.CPP. In the end, we should be able to replicate all 19 examples in theexamples/folder using python. The goal is to also create automated tests to keep track of regressions, performance benchmarking, and keep the bindings updated. This way we always have an "official" python binding, that stays in sync with the C++ source code.To run the tests: README.md
Check out the
python/examples/folder in this PR to see example scripts.What's included in this PR
BTCPP_PYTHON=OFFopt-in in CMakeLists.txt; python/CMakeLists.txt + python/pyproject.toml (scikit-build-core + nanobind ≥2.5, abi3/STABLE_ABI, Python ≥3.12)BehaviorTreeFactory,Tree(tick_*, halt, opaqueroot_blackboard, fork-safety),SyncActionNode+StatefulActionNode,NodeStatus/NodeType/PortDirectionenums,BTErrorhierarchy@pybt.ports,@pybt.simple_action,py.typedtest_smoke.py,test_lifecycle.py,test_examples.py(subprocess runner)t01_build_your_first_tree.py,t02_basic_ports.py,t03_passing_data.pytick_rate_100_node,port_get_set,python_node_overheadpair)python/README.md,python/CONTRIBUTING.md,python/docs/{index.md,conf.py},python/.readthedocs.yaml.github/workflows/python_test.yml— Ubuntu 22.04 × {cp312, cp313, cp313t-soft-fail}, lint + smoke + symbol-hygiene + hidden+LTO regression.pre-commit-config.yamlOpen questions for reviewers
pybt? I tried searching for a good name by searching on all repos available in PyPI, then landed on this one.What's coming (deferred to PR2 / 3 / 4)
PR2 — Core API ·
Blackboard— dict protocol, scope,@keyremapping,register_typefor custom typesConditionNode/DecoratorNode/ControlNodetick_child,node.bb,tree.subtreesPR3 — Observability ·
StdCoutLogger,FileLogger2TreeObserver+NodeStatisticstree.nodes/tree.manifestsNodeStatus/Timestamp/Position2Dtick_rate_100_node_hz < 0.5×baseline = hard fail)PR4+ — Optional + ergonomics + docs + release ·
_failureIf/_skipIf/_successIf)AsyncActionNode(generator facade),tree.tick_iter()python_wheels.ymlcibuildwheel matrix × {Linux, macOS, Windows}