-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Python bindings #634
base: master
Are you sure you want to change the base?
Conversation
8dbcc42
to
21d450e
Compare
That might be possible, but with the current implementation of C++/Python type interop there are some required additions to the For now, I've at least tried to put everything behind a
In my latest commits, I've added generalized conversions between C++/Python types via the See an example here of passing objects between C++ and Python: https://github.com/BehaviorTree/BehaviorTree.CPP/blob/21d450e880e772c4e3e8a11d865a19d07ce5270d/python_examples/ex05_type_interop.py |
6681c81
to
b425c91
Compare
@facontidavide I'm marking this as ready for review, but I've left some "open questions" in the original PR description. The Python bindings are in a pretty usable state at this point. The main missing item is some README-like documentation. |
Hi @kylc, this is really amazing. Thanks a lot for the effort. I'm trying to run the examples. Build work fine, but I always get this error when running any example:
I checked that
|
Hi, can we have any estimation on when this PR will be accepted or are there any other plans for the Python support? |
That's odd. I just tried installing in a fresh |
Odd indeed... |
Any update on this? |
This PR implements Python bindings to the core BehaviorTree.CPP APIs enabling:
pip install BehaviorTree
from PyPI, use NumPy and SciPy, etc.)Progress
Core API
BehaviorTreeFactory
Tree
(minimal API)Node Types
StatefulActionNode
SyncActionNode
CoroActionNode
(implemented asAsyncActionNode
using Python generators)ConditionNode
(needed?)ControlNode
(needed?)DecoratorNode
(needed?)ThreadedAction
(won't do, tricky, maybe not the most useful in Python)Interop
py::object
-> C++ types (viaJsonExporter::fromJson
)BT::Any
) ->py::object
(viaJsonExporter::toJson
)Examples
To run the examples:
python3 -m venv venv && source venv/bin/activate
pip install -v .
python3 python_examples/ex01_sample.py
See all of the examples under the python_examples/ directory.
Next Steps
pip install BehaviorTree
Open Questions
TreeNode::getInput
method.btpy
because that's easy to type.