py_trees and py_trees_ros were developed and used on robots at field tests around the world over the course of the last couple of years for Yujin Robot. I’m happy to announce that they’re now document complete with a great list of tutorials and ready to be consumed! A brief list of features:
- All the bells and whistles’ you’d expect from a comprehensive behaviour tree library
- Assemble trees in relatively simple and short python scripts
- Additional ROS behaviours for common ROS operations (subscriber, move_base, …)
- A ROS behaviour tree manager with status publisher for connection to an rqt monitoring plugin
- Automatic bagging of the tree status when it changes
- Replay bags in the rqt monitoring program to identify problems
- Simple to mock with a robot layer for debugging, testing on CI and as a rapid simulation for use with web application development.
As you can probably infer, there was a focus on making sure we could easily debug problems, especially when they occurred at a remote test site without an engineer (the replay tool especially was very useful). On the other hand, a graphical designer frontend was not prioritised and never eventuated - scripting a python tree remained simple and flexible enough to suit our needs. We also had the trees pass a litmus test of being able to pass the work of building robot-specific behaviours and trees off to interns. It took three iterations of the core libraries to pass that point, but since then there has been negligible change in the core libraries.
Additionally, the trees started being used beyond the scenarios they were originally designed for. The control engineers started shifting all non-reactive control logic to the trees - it was just easier to follow patterns already implemented and to make use of the bagging/visualisation/replay tools, e.g. implementing an entire subtree for initialisation from a composition of context switches (small dyn. reconfigure changes), enabling/disabling of sensors and simple motions instead of having a separate c++ or python node that would handle the entire process as a custom state machine inside an action. Also, as the logic accumulated in the trees, the data to support it also centralised there, and it eventually became the natural portal point between robot and server/web applications.
All the py_trees packages (py_trees, py_trees_ros, py_trees_msgs, rqt_py_trees) are on the ros build farm and repository details on the ros wiki. You can also use the py_trees package itself directly from pip as a pure python module.