IRI BehaviorTree
Description
This library is intendend to expand the behaviortree library to provide the following new features:
-
It provides a way to implement an Asynchronous Action throught a callback function instead of having to create an inherited class.
This is acomplished with the definition of the new class IriAsyncActionNode. This class is exactly the same that SimpleActionNode provided by the original library but with the possibility of returning the RUNNING state. Another difference with the original Asynchronous action is that no halt function can be implemented.
-
It provides a way to register this new Asynchronous actions.
This is acomplished with the definition of the new class IriBehaviorTreeFactory. This class just implements the registerIriAsyncAction function to register any IriAsyncActionNode in the same way a SimpleActionNode would be registered using registerSimpleAction.
On the following image a general overview of the inheritance is shown:

These new features allow us to adapt the use of BehaviorTrees to the IRI framework and to add a BehaviorTree layer for the IRI modules. This module BT layer is just a shared library that wraps the C++ Module API providing a set of BehaviorTree actions and conditions to allow the user to use the module inside a behavior tree. On the following image, a sketch of this wrapper is shown:

ROS dependencies
Installation
- Move to workspace:
roscd && cd ../src
- Clone the repository:
git clone https://gitlab.iri.upc.edu/labrobotica/ros/iri_core/iri_behaviortree.git
- Compile:
roscd && cd .. && catkin_make -DCMAKE_BUILD_TYPE=Release
How to use it
Add the iri_behaviortree ROS dependency to your node and create (or substitute the BehaviorTreeFactory object with) an IriBehaviorTreeFactory object. To add an IriAsyncActionNode just call registerIriAsyncAction on the same way that a registerSimpleAction would be called.
To register the basic BT nodes just create an object of IriBehaviorTreeBasicNodes and call its init function.