Skip to content

Commit 3a45b46

Browse files
committed
cleanup and basic docs
1 parent dc1935c commit 3a45b46

File tree

5 files changed

+126
-3
lines changed

5 files changed

+126
-3
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Bt Server Parameters
2+
3+
Default Config
4+
```yaml
5+
bt_server:
6+
ros__parameters:
7+
action_name: bt_execution
8+
behavior_trees: '{}'
9+
groot2_port: 1667.0
10+
plugins: '{}'
11+
ros_plugins_timeout: 1000.0
12+
tick_frequency: 100.0
13+
14+
```
15+
16+
## action_name
17+
18+
The name the Action Server takes requests from
19+
20+
* Type: `string`
21+
* Default Value: "bt_execution"
22+
* Read only: True
23+
24+
## tick_frequency
25+
26+
Frequency in Hz to tick() the Behavior tree at
27+
28+
* Type: `int`
29+
* Default Value: 100
30+
* Read only: True
31+
32+
*Constraints:*
33+
- parameter must be within bounds 1
34+
35+
## groot2_port
36+
37+
Server port value to publish Groot2 messages on
38+
39+
* Type: `int`
40+
* Default Value: 1667
41+
* Read only: True
42+
43+
*Constraints:*
44+
- parameter must be within bounds 1
45+
46+
## plugins
47+
48+
List of 'package_name/subfolder' containing BehaviorTree plugins to load into the factory
49+
50+
* Type: `string_array`
51+
* Default Value: {}
52+
53+
*Constraints:*
54+
- contains no duplicates
55+
56+
## ros_plugins_timeout
57+
58+
Timeout (ms) used in BT::RosNodeParams
59+
60+
* Type: `int`
61+
* Default Value: 1000
62+
63+
*Constraints:*
64+
- parameter must be within bounds 1
65+
66+
## behavior_trees
67+
68+
List of 'package_name/subfolder' containing SubTrees to load into the BehaviorTree factory
69+
70+
* Type: `string_array`
71+
* Default Value: {}
72+
73+
*Constraints:*
74+
- contains no duplicates
75+

btcpp_ros2_samples/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ install(TARGETS
7373
RUNTIME DESTINATION share/${PROJECT_NAME}/bt_plugins
7474
)
7575

76+
######################################################
77+
# INSTALL Behavior.xml's, ROS config and launch files
78+
79+
install(DIRECTORY
80+
behavior_trees
81+
config
82+
launch
83+
DESTINATION share/${PROJECT_NAME}/
84+
)
85+
7686

7787
ament_export_dependencies(behaviortree_ros2 btcpp_ros2_interfaces)
7888

btcpp_ros2_samples/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Sample Behaviors
2+
3+
For documentation on sample behaviors included in this package please see the BehaviorTree.CPP [ROS 2 Integration documentation](https://www.behaviortree.dev/docs/ros2_integration) .
4+
5+
# TreeExecutionServer Documentation and Example
6+
7+
This package also includes an example Behavior Tree Executor that is designed to make building, combining and executing [BehaviorTree.CPP](https://www.behaviortree.dev/docs/intro) based Behaviors easy and reusable.
8+
This Executor includes an Action Server that is able to register plugins or directly linked Behaviors and Trees/Subtrees so that a user can execute any known BehaviorTree by simply sending the name of it to the server.
9+
10+
The `TreeExecutionServer` class offers several overridable methods that that can be used to meet your specific needs. Please see [tree_execution_server.hpp](../behaviortree_ros2/include/behaviortree_ros2/tree_execution_server.hpp) for descriptions and requirements of each virtual method. You can also refer to [sample_bt_executor.cpp](src/sample_bt_executor.cpp) for a working example of the `TreeExecutionServer`.
11+
12+
A launch file is included that starts the Execution Server and loads a list of plugins and BehaviorTrees from `yaml` file:
13+
``` bash
14+
ros2 launch btcpp_ros2_samples sample_bt_executor.launch.xml
15+
```
16+
17+
> *NOTE:* For documentation on the `yaml` parameters please see [bt_executor_parameters.md](../behaviortree_ros2/bt_executor_parameters.md).
18+
19+
As the Server starts up it will print out the name of the ROS Action followed by the plugins and BehaviorTrees it was able to load.
20+
```
21+
[bt_action_server]: Starting Action Server: bt_action_server
22+
[bt_action_server]: Loaded Plugin: libdummy_nodes_dyn.so
23+
[bt_action_server]: Loaded Plugin: libmovebase_node_dyn.so
24+
[bt_action_server]: Loaded Plugin: libcrossdoor_nodes_dyn.so
25+
[bt_action_server]: Loaded ROS Plugin: libsleep_plugin.so
26+
[bt_action_server]: Loaded BehaviorTree: door_closed.xml
27+
[bt_action_server]: Loaded Beha viorTree: cross_door.xml
28+
```
29+
30+
To call the Action Server from the command line:
31+
``` bash
32+
ros2 action send_goal /bt_action_server btcpp_ros2_interfaces/action/ExecuteTree "{target_tree: CrossDoor}"
33+
```
34+
35+
You can also try a Behavior that is a ROS Action or Service client itself.
36+
```bash
37+
ros2 action send_goal /bt_action_server btcpp_ros2_interfaces/action/ExecuteTree "{target_tree: SleepActionSample}"
38+
```

btcpp_ros2_samples/launch/sample_bt_executor.launch.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<launch>
22
<arg name="sleep_server" default="true"/>
33

4-
<node pkg="btcpp_ros2_samples" exec="simple_bt_executor" output="screen">
5-
<param from="$(find-pkg-share btcpp_ros2_samples)/config/simple_bt_executor.yaml"/>
4+
<node pkg="btcpp_ros2_samples" exec="sample_bt_executor" output="screen">
5+
<param from="$(find-pkg-share btcpp_ros2_samples)/config/sample_bt_executor.yaml"/>
66
</node>
77

88
<group if="$(var sleep_server)">

btcpp_ros2_samples/src/sample_bt_executor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <behaviortree_ros2/tree_execution_server.hpp>
1515
#include <behaviortree_cpp/loggers/bt_cout_logger.h>
1616

17-
// Example that shows how to customize ActionServerBT.
17+
// Example that shows how to customize TreeExecutionServer.
1818
// Here, we simply add an extra logger
1919
class MyActionServer : public BT::TreeExecutionServer
2020
{

0 commit comments

Comments
 (0)