| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
This is insanely cool! Shall we create a BehaviorTree.PY repo specifically for this? |
Sorry, something went wrong.
That might be possible, but with the current implementation of C++/Python type interop there are some required additions to the TreeNode::getInput method to handle the additional type conversions. Maybe there is a way to move it external, but I'm not sure yet. For now, I've at least tried to put everything behind a #ifdef BTCPP_PYTHON gate.
In my latest commits, I've added generalized conversions between C++/Python types via the JSONExporter functionality. It would be possible to pass types statically if all of the possible generic type combinations were registered with pybind in the user's code, but that turns into a giant mess of if statements because of the runtime type logic in BT::Any. For now, requiring that the user implement the conversion to/from JSON in exchange for full Python interop seems OK to me. 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 |
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
|
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: $ python3 python_examples/ex01_sample.py
Traceback (most recent call last):
File "python_examples/ex01_sample.py", line 7, in <module>
from btpy import BehaviorTreeFactory, SyncActionNode, NodeStatus, ports
File "/home/jorge/.local/lib/python3.8/site-packages/btpy/__init__.py", line 8, in <module>
from btpy_cpp import (
ImportError: /home/jorge/.local/lib/python3.8/site-packages/btpy_cpp.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN2BT14toPythonObjectERKNS_3AnyERN8pybind116objectE
I checked that python/types.cpp gets compiled and linked to libbehaviortree_cpp.so, so no clue why this happens [40/56] Building CXX object CMakeFiles/behaviortree_cpp.dir/src/python/types.cpp.o |
Sorry, something went wrong.
|
Hi, can we have any estimation on when this PR will be accepted or are there any other plans for the Python support? |
Sorry, something went wrong.
That's odd. I just tried installing in a fresh ubuntu-22.04 container and get the same error, but only when compiling with GCC. If I use Clang then the examples work fine. Maybe something odd going on with the linker/LTO? |
Sorry, something went wrong.
Odd indeed... |
Sorry, something went wrong.
|
Any update on this? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR implements Python bindings to the core BehaviorTree.CPP APIs enabling:
Progress
Core API
Node Types
Interop
Examples
To run the examples:
See all of the examples under the python_examples/ directory.
Next Steps
Open Questions