Skip to content

Commit 3a716e4

Browse files
Merge pull request #2 from uml-robotics/pr_humble
merge upstream changes
2 parents acb016b + 8143027 commit 3a716e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2319
-472
lines changed

.clang-format

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
BasedOnStyle: Google
3+
AccessModifierOffset: -2
4+
ConstructorInitializerIndentWidth: 2
5+
AlignEscapedNewlinesLeft: false
6+
AlignTrailingComments: true
7+
AllowAllParametersOfDeclarationOnNextLine: false
8+
AllowShortIfStatementsOnASingleLine: false
9+
AllowShortLoopsOnASingleLine: false
10+
AllowShortFunctionsOnASingleLine: None
11+
AlwaysBreakTemplateDeclarations: true
12+
AlwaysBreakBeforeMultilineStrings: false
13+
BreakBeforeBinaryOperators: false
14+
BreakBeforeTernaryOperators: false
15+
BreakConstructorInitializers: BeforeComma
16+
BinPackParameters: true
17+
ColumnLimit: 90
18+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
19+
DerivePointerBinding: false
20+
PointerBindsToType: true
21+
ExperimentalAutoDetectBinPacking: false
22+
IndentCaseLabels: true
23+
MaxEmptyLinesToKeep: 1
24+
NamespaceIndentation: None
25+
ObjCSpaceBeforeProtocolList: true
26+
PenaltyBreakBeforeFirstCallParameter: 19
27+
PenaltyBreakComment: 60
28+
PenaltyBreakString: 1
29+
PenaltyBreakFirstLessLess: 1000
30+
PenaltyExcessCharacter: 1000
31+
PenaltyReturnTypeOnItsOwnLine: 90
32+
SpacesBeforeTrailingComments: 2
33+
Cpp11BracedListStyle: false
34+
Standard: Auto
35+
IndentWidth: 2
36+
TabWidth: 2
37+
UseTab: Never
38+
IndentFunctionDeclarationAfterType: false
39+
SpacesInParentheses: false
40+
SpacesInAngles: false
41+
SpaceInEmptyParentheses: false
42+
SpacesInCStyleCastParentheses: false
43+
SpaceAfterControlStatementKeyword: true
44+
SpaceBeforeAssignmentOperators: true
45+
SpaceBeforeParens: Never
46+
ContinuationIndentWidth: 4
47+
SortIncludes: false
48+
SpaceAfterCStyleCast: false
49+
ReflowComments: false
50+
51+
# Configure each individual brace in BraceWrapping
52+
BreakBeforeBraces: Custom
53+
54+
# Control of individual brace wrapping cases
55+
BraceWrapping: {
56+
AfterClass: 'true',
57+
AfterControlStatement: 'true',
58+
AfterEnum : 'true',
59+
AfterFunction : 'true',
60+
AfterNamespace : 'true',
61+
AfterStruct : 'true',
62+
AfterUnion : 'true',
63+
BeforeCatch : 'true',
64+
BeforeElse : 'true',
65+
IndentBraces : 'false',
66+
SplitEmptyFunction: 'false'
67+
}
68+
...

.github/workflows/pre-commit.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v3
14+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
# To use:
3+
#
4+
# pre-commit run -a
5+
#
6+
# Or:
7+
#
8+
# pre-commit install # (runs every time you commit in git)
9+
#
10+
# To update this file:
11+
#
12+
# pre-commit autoupdate
13+
#
14+
# See https://github.com/pre-commit/pre-commit
15+
16+
exclude: ^3rdparty/|3rdparty|^include/behaviortree_cpp/contrib/
17+
repos:
18+
19+
# Standard hooks
20+
- repo: https://github.com/pre-commit/pre-commit-hooks
21+
rev: v4.5.0
22+
hooks:
23+
- id: check-added-large-files
24+
- id: check-ast
25+
- id: check-case-conflict
26+
- id: check-docstring-first
27+
- id: check-merge-conflict
28+
- id: check-symlinks
29+
- id: check-xml
30+
- id: check-yaml
31+
- id: debug-statements
32+
- id: end-of-file-fixer
33+
exclude_types: [svg]
34+
- id: mixed-line-ending
35+
- id: trailing-whitespace
36+
exclude_types: [svg]
37+
- id: fix-byte-order-marker
38+
39+
# CPP hooks
40+
- repo: https://github.com/pre-commit/mirrors-clang-format
41+
rev: v17.0.6
42+
hooks:
43+
- id: clang-format
44+
args: ['-fallback-style=none', '-i']

LICENSE

-1
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
202202
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203203
See the License for the specific language governing permissions and
204204
limitations under the License.
205-

README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This repository contains useful wrappers to use ROS2 and BehaviorTree.CPP togeth
55

66
In particular, it provides a standard way to implement:
77

8+
- Behavior Tree Executor with ROS Action interface.
89
- Action clients.
910
- Service Clients.
1011
- Topic Subscribers.
@@ -15,9 +16,15 @@ Our main goals are:
1516
- to minimize the amount of boilerplate.
1617
- to make asynchronous Actions non-blocking.
1718

19+
# Documentation
20+
21+
- [ROS Behavior Wrappers](behaviortree_ros2/ros_behavior_wrappers.md)
22+
- [TreeExecutionServer](behaviortree_ros2/tree_execution_server.md)
23+
- [Sample Behaviors](btcpp_ros2_samples/README.md)
24+
1825
Note that this library is compatible **only** with:
1926

20-
- **BT.CPP** 4.1 or newer.
27+
- **BT.CPP** 4.6 or newer.
2128
- **ROS2** Humble or newer.
2229

2330
Additionally, check **plugins.hpp** to see how to learn how to
@@ -26,8 +33,6 @@ wrap your Nodes into plugins that can be loaded at run-time.
2633

2734
## Acknowledgements
2835

29-
A lot of code is either inspired or copied from [Nav2](https://navigation.ros.org/).
36+
A lot of code is either inspired or copied from [Nav2](https://docs.nav2.org/).
3037

3138
For this reason, we retain the same license and copyright.
32-
33-

behaviortree_ros2/CMakeLists.txt

+39-14
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,57 @@ project(behaviortree_ros2)
33

44
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6-
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
76

87
set(THIS_PACKAGE_DEPS
98
rclcpp
109
rclcpp_action
1110
ament_index_cpp
12-
behaviortree_cpp)
11+
behaviortree_cpp
12+
btcpp_ros2_interfaces
13+
generate_parameter_library
14+
)
1315

1416
find_package(ament_cmake REQUIRED)
15-
find_package(rclcpp REQUIRED )
16-
find_package(rclcpp_action REQUIRED )
17-
find_package(behaviortree_cpp REQUIRED )
18-
find_package(ament_index_cpp REQUIRED)
19-
20-
# This is compiled only to check if there are errors in the header file
21-
# library will not be exported
22-
include_directories(include)
23-
add_library(${PROJECT_NAME} src/bt_ros2.cpp)
17+
18+
foreach(PACKAGE ${THIS_PACKAGE_DEPS})
19+
find_package(${PACKAGE} REQUIRED )
20+
endforeach()
21+
22+
23+
generate_parameter_library(
24+
bt_executor_parameters
25+
src/bt_executor_parameters.yaml)
26+
27+
add_library(${PROJECT_NAME}
28+
src/bt_ros2.cpp
29+
src/bt_utils.cpp
30+
src/tree_execution_server.cpp )
31+
2432
ament_target_dependencies(${PROJECT_NAME} ${THIS_PACKAGE_DEPS})
2533

34+
target_include_directories(${PROJECT_NAME} PUBLIC
35+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
36+
$<INSTALL_INTERFACE:include>)
37+
38+
target_link_libraries(${PROJECT_NAME} bt_executor_parameters)
39+
40+
2641
######################################################
2742
# INSTALL
2843

29-
install(DIRECTORY include/ DESTINATION include/)
30-
31-
ament_export_include_directories(include)
44+
install(DIRECTORY include/ DESTINATION include/)
45+
46+
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
3247
ament_export_dependencies(${THIS_PACKAGE_DEPS})
3348

49+
install(
50+
TARGETS ${PROJECT_NAME} bt_executor_parameters
51+
EXPORT ${PROJECT_NAME}Targets
52+
ARCHIVE DESTINATION lib
53+
LIBRARY DESTINATION lib
54+
RUNTIME DESTINATION lib/${PROJECT_NAME})
55+
56+
ament_export_include_directories(include)
57+
ament_export_libraries(${PROJECT_NAME})
58+
3459
ament_package()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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

0 commit comments

Comments
 (0)