-
Notifications
You must be signed in to change notification settings - Fork 2
4. How to execute BTs in ROS
This section explains how to run an XML tree file in ROS. And once it is running, how to monitor its execution state using Groot.
Once the BT tree file is created, we need to run an instance of the BT Manager. It will load and execute the tree continuously.
Once the XML tree file is ready, we can execute it in ROS using the node behavior_tree_manager_node
from the package behavior_tree_manager_fkie
as follows:
<node name="bt_manager" pkg="behavior_tree_manager_fkie" type="behavior_tree_manager_node" >
<param name="tree/static_file" value="path/to/tree.xml"/>
<rosparam command="load" file="path/to/config_file.yaml" />
</node>
It assumes that we have an XML file tree/static_file
, and optionally, ROS parameter given using a YAML file.
Different debugging options are available when working with behavior trees. One of them is using Groot
as execution monitoring tool.
Groot assumes that the Behavior Tree Manager uses ZeroMQ as a debugging option, which can be enabled by passing the parameter logging/PublisherZMQ
:
logging:
PublisherZMQ:
enabled: true
max_msg_per_second: 25
publisher_port: 1666
server_port: 1667
The Behavior Tree Manager will broadcast the current state of the tree using ZeroMQ protocol to a default server/port localhost:1666
.
In Groot
, we can choose the option Monitor, and then select the proper server:port.
Then, the GUI will show the state of the execution tree, using green for nodes that runs successfully, red for nodes that return failure and orange for nodes that are currently running.
There is a tutorial (How-to-create-a-new-Action-or-Condition-node) that shows how to code BT actions. We can use the fkie_bt_tutorials
package to try a simple Behavior Tree.
If you want to compile the fkie_bt_tutorials
package:
catkin build fkie_bt_tutorials
And run the corresponding launch file:
roslaunch fkie_bt_tutorials 1_hello_world_tutorial.launch
You should get something like:
Node border colors in Groot
show its execution state: Green means that the node returned SUCCESS, Red for FAILURE and Orange for RUNNING.