ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

Introducing BehaviorTrees.CPP (who needs Finite State Machines anymore?)


#1

Dear roboticists,

I would like to share with you our new libraries that can help you greate robot Behaviors.
Behavior Trees are similar to Hierarchical Finite State Machines, but they are more intuitive and maintainable.

BehaviorTree.CPP is a C++ library to develop reactive Behavior Trees.
It is embeddable in your own node and the creation of a Bt Executer requires only few lines of codes.
Trees can be loaded at run-time without recompiling your application, since their definition is stored in a user friendly and easy to read XML format.

Read introduction and tutorials here.

Additionally, you can start playing around with the preliminary release of Groot the graphical user-interface that allows you to create. edit, monitor and replay the execution of BehaviorTrees.

Both these tools are middleware independent by design, i.e. they do not depend on ROS.

On the other hand, it is trivial to use them together with ROS using Topic, Services and Actions.

We will soon release a ROS specific example.

Cheers

Davide Faconti

Acknowledgment

This software was created as part of the project MOOD2Be, and it is developed at Eurecat.

MOOD2Be is one of the six Integrated Technical Projects (ITPs) selected from the RobMoSys first open call . It received funding from the European Union’s Horizon 2020 Research and Innovation Programme under the RobMoSys project.


#2

I’ll add my endorsement, our team has integrated this into the Navigation2 mission executor and BT Navigator nodes, which will be part of the ROS2 Crystal release next month.


#3

Awesome! I am looking forward to it


#4

To add to what Matt has said: We’re using the BehaviorTree.CPP library for the new ROS2 Navigation2 package and are taking advantage of the new blackboard feature as well as the XML-to-BT capability that allows one to define the Behavior Tree in XML and automatically create the corresponding BT at run-time. These are the features I was looking for in a BT library for our mission execution and navigation code. I’m just starting to experiment with the Groot editor, but plan to interactively create and test BTs with our system.


#5

This is beautiful work, thanks for doing it. Is it capable of supporting circular routes like a graph (state machine)? I’m hoping circles can be supported.


#6

Thanks for the libraries Behavior! Just looking for such an implementation


#7

Great work! It looks very interesting.

I have some questions after going through the tutorials:

  1. Are there ways to include other XML files. It would be useful to define a subtree in a file, and make it reusable for multiple BT.

  2. If they can be included, you may have problems of name clashing. For instance multiple independent subtrees use the same identifiers, such as <MoveBase goal="${TargetPose}"/> and <LookAt pose="${TargetPose}"/>, is there any way of address this problem?

We have faced this issue with our HFSM system, and we’ve had to implement remapping of identifiers and namespaces to avoid clashing.


#8

Hi @v-lopez,

  1. It surely makes sense to include this feature in a near future. In general, when you or anybody else want a new future, the best way is to bother me on Github opening an issue :wink:

  2. Name clashing is surely a problem that needs to be addressed. On the other hand… don’t we have the same problem with the name of ROS topic too? Namespace seems the most sensible thing to do.

In your example, TargetPose is an entry in the Blackboard. If you just use the same best practices that you would use for ROS topics, i.e. adding a namespace, you should be fine:

  <MoveBase goal="${move_base::target_pose}"/>
  <LookAt pose="${look_at::target_pose}"/>`

Note that using “::” as a separator is totally arbitrary since the entire string is evaluated. You may use “/” instead.

I will probably propose a solution to both these problem in version 2.3, the next month.