Skip to content

Commit 4ac00e1

Browse files
committed
add groot intro for BT editing and monitoring
1 parent b44a3f3 commit 4ac00e1

File tree

7 files changed

+97
-1
lines changed

7 files changed

+97
-1
lines changed

configuration/packages/configuring-bt-navigator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Parameters
6464
Description
6565
Enable live Groot monitoring of the current BT status.
6666
This is possible due to attaching a ZMQ server and publisher to the active behavior tree.
67-
Consider checking out the `Use BT Groot Monitoring<>`_ tutorial for using this feature.
67+
Consider checking out the :ref:`groot_introduction` tutorial for using this feature.
6868

6969
**Attention:** Groot will only work after the behavior tree is running, which means that the nav2 stack has to receive a goal first.
7070

tutorials/docs/groot.rst

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
.. _groot_introduction:
2+
3+
Groot - The fancy BehaviorTree Editor
4+
*************************************
5+
- `Overview`_
6+
- `Edit Custom Behavior Trees`_
7+
- `Live Monitoring Behavior Trees`_
8+
9+
Overview
10+
========
11+
12+
.. image:: images/Groot/groot_start_menu.png
13+
14+
`Groot <https://github.com/BehaviorTree/Groot>`_ is the companion application of
15+
`BehaviorTree.CPP <https://github.com/BehaviorTree/BehaviorTree.CPP>`_ to create, edit, and monitor behavior trees.
16+
With Groot one can visualize, edit and create new behavior trees. Also, complete new custom nodes except control flow nodes can be created using Groot.
17+
`Recently added <https://github.com/ros-planning/navigation2/pull/1958>`_ to the ROS2 and nav2 implementation of BT.cpp V3 is live monitoring of the current status of the behavior tree.
18+
19+
Edit Custom Behavior Trees
20+
==========================
21+
22+
.. .. image:: images/Groot/codecov.io_show_covered_code.png
23+
:width: 80%
24+
25+
A few steps are necessary to view and edit existing behavior trees:
26+
27+
1. Open Groot in editor mode
28+
2. Select the `Load palette from file` option (import button) near the top left corner.
29+
30+
31+
.. image:: images/Groot/groot_bt_editor.png
32+
:width: 49%
33+
34+
.. image:: images/Groot/groot_with_nav2_custom_nodes.png
35+
:width: 49%
36+
37+
3. Open the file `/path/to/navigation2/nav2_behavior_tree/nav2_tree_nodes.xml` to import all the behavior tree nodes used for navigation.
38+
4. Select `Load tree` option near the top left corner
39+
5. Browse the tree you want to visualize the select ok.
40+
41+
.. image:: images/Groot/bt_w_replanning_and_recovery.png
42+
43+
.. note::
44+
If a tree cannot be visualized because some nodes are missing in the pallet, you might need to visit :ref:`plugins` and search for the plugin that is missing.
45+
If you got all the optional blackboard fields from the code of the plugin, you are free to go to add the description to ``/path/to/navigation2/nav2_behavior_tree/nav2_tree_nodes.xml``.
46+
Now you can reload the pallet from this updated file and should be able to work with the tree.
47+
48+
Monitoring mode is unaffected from this, as the whole factory with sufficient meta data gets transferred upon connection.
49+
This is a known issue to reduce the overhead of creating additional xml-node-description files, when the data is also available in the shared object.
50+
Feel free to support adding this feature to the open source project Groot. The `feature request <https://github.com/BehaviorTree/Groot/issues/10>`_ already exists for this.
51+
52+
Also, the Groot editor allows for creating new custom nodes via its graphical user interface. This also works with nav2 except custom control nodes.
53+
54+
Live Monitoring Behavior Trees
55+
==============================
56+
57+
.. raw:: html
58+
59+
<a href="https://gifyu.com/image/cFdR"><img src="https://s7.gifyu.com/images/Groot-Test-5FPS.gif" alt="Groot-Test-5FPS.gif" border="0" /></a>
60+
61+
In order to live monitor a running behavior tree, a few easy steps are necessary.
62+
63+
Behavior trees of the BT.cpp V3 kind do not automatically include monitoring.
64+
This is and always should be an optional feature as it involves opening an additional communication layer: ``ZMQ``.
65+
66+
Adding the monitoring feature to nav2 therefore involves activating a special parameter listed in :ref:`configuring_bt_navigator`.
67+
After activating ``enable_groot_monitoring``, the zmq network ports for a ``zmq-server`` and ``zmq-publisher`` can be set optionally.
68+
69+
Given the launch-parameters are set correctly, the navigation2 stack has to be started normally first.
70+
Regardless of simulation or real hardware, **monitoring only works if the behavior tree is currently running!**
71+
72+
A step-by-step guide for simulation can look like this:
73+
74+
1. complete :ref:`getting_started` and be able to run the tb3 simulation
75+
2. set ``enable_groot_monitoring`` to ``True`` in the ``params.yaml`` file
76+
3. (re-)start the tb3 simulation (optionally with ``headless:=True`` for only RVIZ as GUI)
77+
4. set the initial pose of the robot -> this will activate the whole navigation2 stack (check if they are active)
78+
5. start Groot and choose the monitor mode
79+
6. press connect in the upper left corner (``Server IP``, ``Publisher Port``, and ``Server Port`` can all be left to the default for the simulation)
80+
7. the behavior tree should now be visible in Groot
81+
8. send a new goal to your robot (can also include a new behaviorTree.xml, which gets loaded automatically)
82+
9. watch your robot drive in simulation and see how the behavior tree changes it nodes
83+
84+
Real world robots can easily be adapted to this. Just change the ``Server IP``
85+
and zmq network ports accordingly to your local environment.
86+
87+
Reloading of the behavior tree in Groot is done on multiple occasions,
88+
but only when a new behavior tree is loaded by nav2 or Groot is restarted.
89+
90+
.. note::
91+
Until the current PR gets accepted, for fixing additional corner cases where Groot must reload the behavior tree in order to match the the status information to the right behavior tree with the right ``uid``,
92+
it is necessary to use this `fork:branch <https://github.com/gramss/Groot/tree/fix-groot-reloading>`_ until the `respective PR <https://github.com/BehaviorTree/Groot/pull/96>`_ gets accepted.
93+
94+
99.9 KB
Loading
96.5 KB
Loading
78.8 KB
Loading
87.5 KB
Loading

tutorials/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Navigation2 Tutorials
1010

1111
docs/camera_calibration.rst
1212
docs/get_backtrace.rst
13+
docs/groot.rst
14+
docs/intro_testing.rst
1315
docs/navigation2_on_real_turtlebot3.rst
1416
docs/navigation2_with_slam.rst
1517
docs/navigation2_with_stvl.rst

0 commit comments

Comments
 (0)