You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: configuration/packages/configuring-bt-navigator.rst
+58-2Lines changed: 58 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -249,7 +249,8 @@ Parameters
249
249
Description
250
250
Use time provided by simulation.
251
251
252
-
:error_code_name_prefixes
252
+
:error_code_name_prefixes:
253
+
253
254
============== ===========================
254
255
Type Default
255
256
-------------- ---------------------------
@@ -270,7 +271,7 @@ Parameters
270
271
Description
271
272
For Kilted and newer: List of of error code name prefixes to be appended with '_error_code' and '_error_msg' and searched for during aborted navigator error processing.
272
273
273
-
:error_code_names
274
+
:error_code_names:
274
275
275
276
============== ===========================
276
277
Type Default
@@ -293,6 +294,57 @@ Parameters
293
294
Description
294
295
The lifecycle node bond mechanism publishing period (on the /bond topic). Disabled if inferior or equal to 0.0.
Whether to enable Groot2 monitoring for this navigator.
311
+
312
+
:``<navigate_to_pose_name>``.groot_server_port:
313
+
314
+
==== =======
315
+
Type Default
316
+
---- -------
317
+
int 1667
318
+
==== =======
319
+
320
+
Description
321
+
The port number for the Groot2 server. Note: In Groot2, you only need to specify the server port value, not the publisher port, as it is always the server port +1. Therefore, in this case, to use another navigator, the next available port would be 1669.
Whether to enable Groot2 monitoring for this navigator.
336
+
337
+
:``<navigate_through_poses>``.groot_server_port:
338
+
339
+
==== =======
340
+
Type Default
341
+
---- -------
342
+
int 1669
343
+
==== =======
344
+
345
+
Description
346
+
The port number for the Groot2 server. Note: In Groot2, you only need to specify the server port value, not the publisher port, as it is always the server port +1. Therefore, in this case, to use another navigator, the next available port would be 1671.
Copy file name to clipboardExpand all lines: migration/Jazzy.rst
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -429,3 +429,8 @@ Modified statuses should then be propagated through output ports for downstream
429
429
430
430
The ``NavigateThroughPoses`` navigator retrieves the ``waypoint_statuses`` instance from the blackboard in its ``onLoop`` callback and writes it into the feedback message.
431
431
During the ``goalCompleted`` callback, it fetches the ``waypoint_statuses`` instance and, based on the BT's final execution status (``final_bt_status``), updates any waypoints still in the ``PENDING`` state to either ``COMPLETED`` (if ``final_bt_status`` is ``SUCCEEDED``) or ``FAILED`` (otherwise).
432
+
433
+
Groot 2 Support
434
+
***************
435
+
436
+
BT navigators: ``navigate_to_pose`` and ``navigate_through_poses`` now support live monitoring and visualization of the behavior tree using Groot 2. JSON conversions are also available to see the content of the Blackboard, allowing the introspection of the BT nodes. Switching bt-xmls on the fly through a new goal request is also included. Because live monitoring of Behavior Tree with more than 20 nodes and visualizing the content of the blackboard is a PRO (paid) feature of Groot 2. This feature is disabled by default.
Copy file name to clipboardExpand all lines: plugin_tutorials/docs/writing_new_bt_plugin.rst
+82Lines changed: 82 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ Writing a New Behavior Tree Plugin
6
6
- `Overview`_
7
7
- `Requirements`_
8
8
- `Tutorial Steps`_
9
+
- `Using custom types for Input/Output ports`_
10
+
- `Visualize the content of the blackboard in Groot 2 (PRO)`_
9
11
10
12
Overview
11
13
========
@@ -235,3 +237,83 @@ Select this BT XML file in your specific navigation request in ``NavigateToPose`
235
237
</RecoveryNode>
236
238
</BehaviorTree>
237
239
</root>
240
+
241
+
Using custom types for Input/Output ports
242
+
=========================================
243
+
244
+
In addition to standard types, custom types such as those from `nav2_msgs` or `geometry_msgs` can also be used for input/output ports.
245
+
246
+
For example, you can define custom types for ports in the `providedPorts` function as follows:
247
+
248
+
.. code-block:: cpp
249
+
250
+
static PortsList providedPorts()
251
+
{
252
+
return providedBasicPorts(
253
+
BT::OutputPort<geometry_msgs::msg::Point>("position", "Position of the robot")
254
+
});
255
+
}
256
+
257
+
To use custom types for input/output ports in the behavior tree XML, it is necessary to convert them from a string. This is because ports in the XML are represented as strings and must be transformed into the corresponding data type in the code.
258
+
259
+
For example, if you have a custom type `geometry_msgs::msg::Point`, you can perform the conversion as follows:
For more information on custom type conversion, you can refer to the `bt_utils.hpp <https://github.com/ros-navigation/navigation2/blob/main/nav2_behavior_tree/include/nav2_behavior_tree/bt_utils.hpp>`_ or the BT.CPP documentation : `Parsing a string <https://www.behaviortree.dev/docs/tutorial-basics/tutorial_03_generic_ports#parsing-a-string>`_
283
+
284
+
Visualize the content of the blackboard in Groot 2 (PRO)
If you are using the paid version of Groot 2 Pro, you can view the content of the blackboard of the BT nodes. To achieve this, you need to perform a conversion of the custom input/output type to JSON format. Below is an example of such a conversion:
287
+
288
+
.. code-block:: cpp
289
+
290
+
namespace geometry_msgs::msg
291
+
{
292
+
BT_JSON_CONVERTER(geometry_msgs::msg::Point, msg)
293
+
{
294
+
add_field("x", &msg.x);
295
+
add_field("y", &msg.y);
296
+
add_field("z", &msg.z);
297
+
}
298
+
} // namespace geometry_msgs::msg
299
+
300
+
The macro ``BT_JSON_CONVERTER`` must be placed within the namespace of the custom type to be converted. Additionally, if the custom type is composed of other custom types, those types must be converted first before converting the parent type.
301
+
302
+
After defining the conversion, you need to register the custom type in the `providedPorts` function. Below is an example of how to register it:
303
+
304
+
.. code-block:: cpp
305
+
306
+
static PortsList providedPorts()
307
+
{
308
+
// Register JSON definitions for the types used in the ports
BT::OutputPort<geometry_msgs::msg::Point>("position", "Position of the robot")
312
+
});
313
+
}
314
+
315
+
For more information on custom type conversion, you can refer to the `json_utils.hpp <https://github.com/ros-navigation/navigation2/blob/main/nav2_behavior_tree/include/nav2_behavior_tree/json_utils.hpp>`_ or the BT.CPP documentation : `Visualize custom types in the Blackboard <https://www.behaviortree.dev/docs/tutorial-basics/tutorial_11_groot2/#visualize-custom-types-in-the-blackboard>`_
316
+
317
+
.. note::
318
+
319
+
All custom types used in Nav2 are already registered in the `json_utils.hpp` file. You can use them directly without the need to register them again.
0 commit comments