Implementing your first BT
The first step to create and execute a BT is to create a ROS 2 package to store all the necessary files to load and run the tree. Even if in this first example we will not use any ROS 2 API, its executor and package structure simplify the developer work.
The first step is to install the library. It can be installed directly from the APT repository:
sudo apt-get install ros-jazzy-behaviortree-cpp
Now, moving into the src
directory of the ROS 2 workspace, let’s create the first_bts
package:
ros2 pkg create first_bts --dependencies rclcpp std_msgs behaviortree_cpp
Now that the library is installed and the package storing the tree and the source code has been created, let’s see the necessary steps needed to create our first BT.
Step 1 – Defining the tree model
The first step is to define the model of the tree to execute, and we are going to directly write the .xml
file representing the tree model. The goal...