Week 3 - ROS 2 package
Summary
In the previous weeks, I achieved a working parser and a translator, but it still lacked ROS integration and complete node compatibility. From this week and intermittently throughout August, I created a ROS package that can be used exactly in the same way as BT.cpp and implemented all the nodes, except Delay and RunOnce
Development
I wrote a custom fallback as both libraries have different behaviors, in a very similar manner to my implementation of the ReactiveSequence and SequenceWithMemory. All these nodes were written inheriting from the py_trees.composites.Composite
class. Then, I moved to the development of the decorators, which generally proved to be straightforward due to a very similar API between libraries. RunOnce
has almost the same API as OneShot
, except that the first has the option that the block is ignored after execution, and the latter simply will return SUCESS thereafter.
I left the development of these nodes for the moment, and started working in py_garnener
, a ROS 2 package that could be imported from other packages, and used to build trees directly, with a very similar API to BT.cpp. The users write custom actions in Python using the py_trees
actions structure, an XML file using these actions, and whatever nodes they need for the desired behavior. and then, from the entry point of their package, generate an executable tree calling create_tree_from_xml(xml_path, actions_path)
. This tree can be ticked at a desired frequency, and the parser and the translator have taken care of instantiating all the user dependencies.