Week 1 - Starting translator
Summary
This week, I started the development of the first simple execution engine for behavior trees using py_trees. The idea was to achieve the implementation of a basic XML codification format with py_trees.
Development
The library py_trees doesn’t have built-in support for XML codification, unlike BT.cpp, a BT library by Davide Faconti, written in C++. By the specifications of the TFG (it must be integrated in a Python dockerized environment), the only possibility is to use py_trees.
For that reason, the main issue with this library is that the implementation and the control of the BT’s actions are combined together in the same files, making the development of apps incrementally messy. During this week, I studied how actions are created in the library and started creating a Python program that can create an executable tree from separate action files and trees in XML.
My goal was to create a parser that generates a self-contained tree. Although this isn’t common practice, I think it allows for greater portability and encapsulates a robotic app into a single file.
Later, this file should be read, and a py_trees.trees.BehaviourTree
object created, with the actions structured following the BehaviorTree section of the file.
Adapting Davide Faconti’s format, I created this self-contained XML format:
<root>
<BehaviorTree ID="MainTree">
<Sequence name="main_seq">
....
</Sequence>
</BehaviorTree>
<Code>
<Action1>Code</Action1>
<Action2>Code</Action2>
</Code>
</root>
Only the actions defined in the code section can be used in the BehaviorTree section.