Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge upstream changes #2

Merged
merged 52 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
3c5bb9b
feat: allows message clearing behaviour to be customised by the imple…
tony-p Jan 31, 2024
ac2e0ac
style: match camel case function name
tony-p Feb 2, 2024
d31eb1f
fix: Get last message on late subscription and ensure connection to c…
tony-p Apr 2, 2024
06a508e
fix: pointer references
tony-p Apr 2, 2024
421e5c0
fix: create subscriber with new topic name
tony-p Apr 2, 2024
e85eb03
Apply suggestions from code review
tony-p Apr 5, 2024
bd15f2f
Fix cancel goal with emopty goal handle
vicmassy Apr 10, 2024
b82d850
Merge pull request #53 from umdlife/main_umd
facontidavide Apr 10, 2024
47d60b9
refactor: change name of retention method to latchLastMessage
tony-p Apr 11, 2024
57fbeee
Merge pull request #52 from tony-p/fix/delayed-subscription
facontidavide Apr 12, 2024
717ff61
Export plugins to share directory
MarqRazz Apr 12, 2024
13682b4
Merge pull request #54 from MarqRazz/plugin_export
facontidavide Apr 12, 2024
bdb778a
fix TopicSubscriber
facontidavide Apr 19, 2024
7ed2a34
Add pre-commit config and workflow
MarqRazz Apr 19, 2024
a5d0548
Remove run clang script
MarqRazz Apr 23, 2024
b732819
Merge pull request #56 from MarqRazz/pre-commit
facontidavide Apr 24, 2024
4d355bb
use weak_ptr to simplify SubscribersRegistry in RosTopicSubNode
facontidavide Apr 24, 2024
3b399da
cherry picking changes from PR #46: instance registry of Action Clients
facontidavide Apr 24, 2024
fa151bc
merging changes from PR #46: registry for service clients
facontidavide Apr 24, 2024
784d4e9
fix previous commit
facontidavide Apr 24, 2024
374edcf
Fix issue #58: use weak_ptr to avoid circular shared_ptr ownership
facontidavide Apr 30, 2024
3183c9d
WIP: added an ActionServerBT to execute trees
facontidavide May 2, 2024
64a7801
renaming
facontidavide May 2, 2024
9497662
more comments
facontidavide May 2, 2024
e6777b6
some refactoring of parameters and plugin loading
facontidavide May 3, 2024
dc1935c
added documentation
facontidavide May 3, 2024
3a45b46
cleanup and basic docs
MarqRazz May 3, 2024
bb435f4
pre-commit
MarqRazz May 3, 2024
dbf6bc0
docs cleanup
MarqRazz May 4, 2024
70b5d74
add exceptions
facontidavide May 5, 2024
4c5a65a
Merge branch 'bt_server' of github.com:BehaviorTree/BehaviorTree.ROS2…
facontidavide May 5, 2024
3ccd2e7
formatting
facontidavide May 5, 2024
16baeb5
fix
facontidavide May 5, 2024
d7890e0
Merge pull request #60 from BehaviorTree/bt_server
facontidavide May 5, 2024
a0de087
Update README.md
facontidavide May 5, 2024
8790909
make the sample_bt_executor more interesting
facontidavide May 6, 2024
d5d869e
fix issue #63 : expose factory and rclcppNode
facontidavide May 7, 2024
7e727ba
fix issue #61: postpone registerNodesIntoFactory
facontidavide May 7, 2024
b93dfb2
Merge pull request #65 from BehaviorTree/issues_61_63
facontidavide May 7, 2024
e81f588
add constructor and cleanups
facontidavide May 7, 2024
e7b2926
fix issue #57
facontidavide May 7, 2024
69cb36a
add payloads to Action (#66)
facontidavide May 8, 2024
6247e2e
Register multiple nodes with single plugin (#68)
MarqRazz May 12, 2024
3da7c29
Changing new URL (#72)
SteveMacenski May 14, 2024
bb5535e
Change the way default port is passed, to allow namespaces
facontidavide May 15, 2024
354f111
fix CI
facontidavide Jun 11, 2024
d962958
Rename msgs to msg (#81)
AdrianZw Jun 28, 2024
aa7fd83
fix: resolve MSVC build errors and warnings (#91)
tony-p Aug 20, 2024
adec04b
Fix link to global blackboard tutorial (#94)
sea-bass Sep 6, 2024
cc31ea7
Update bt_utils.cpp fix #97
facontidavide Sep 29, 2024
f56c578
Merge upstream into humble
GregoryLeMasurier Nov 20, 2024
8143027
fix compile issue
GregoryLeMasurier Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeComma
BinPackParameters: true
ColumnLimit: 90
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 90
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false
ReflowComments: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping: {
AfterClass: 'true',
AfterControlStatement: 'true',
AfterEnum : 'true',
AfterFunction : 'true',
AfterNamespace : 'true',
AfterStruct : 'true',
AfterUnion : 'true',
BeforeCatch : 'true',
BeforeElse : 'true',
IndentBraces : 'false',
SplitEmptyFunction: 'false'
}
...
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

exclude: ^3rdparty/|3rdparty|^include/behaviortree_cpp/contrib/
repos:

# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
exclude_types: [svg]
- id: mixed-line-ending
- id: trailing-whitespace
exclude_types: [svg]
- id: fix-byte-order-marker

# CPP hooks
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
hooks:
- id: clang-format
args: ['-fallback-style=none', '-i']
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This repository contains useful wrappers to use ROS2 and BehaviorTree.CPP togeth

In particular, it provides a standard way to implement:

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

# Documentation

- [ROS Behavior Wrappers](behaviortree_ros2/ros_behavior_wrappers.md)
- [TreeExecutionServer](behaviortree_ros2/tree_execution_server.md)
- [Sample Behaviors](btcpp_ros2_samples/README.md)

Note that this library is compatible **only** with:

- **BT.CPP** 4.1 or newer.
- **BT.CPP** 4.6 or newer.
- **ROS2** Humble or newer.

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

## Acknowledgements

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

For this reason, we retain the same license and copyright.


53 changes: 39 additions & 14 deletions behaviortree_ros2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,57 @@ project(behaviortree_ros2)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(THIS_PACKAGE_DEPS
rclcpp
rclcpp_action
ament_index_cpp
behaviortree_cpp)
behaviortree_cpp
btcpp_ros2_interfaces
generate_parameter_library
)

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED )
find_package(rclcpp_action REQUIRED )
find_package(behaviortree_cpp REQUIRED )
find_package(ament_index_cpp REQUIRED)

# This is compiled only to check if there are errors in the header file
# library will not be exported
include_directories(include)
add_library(${PROJECT_NAME} src/bt_ros2.cpp)

foreach(PACKAGE ${THIS_PACKAGE_DEPS})
find_package(${PACKAGE} REQUIRED )
endforeach()


generate_parameter_library(
bt_executor_parameters
src/bt_executor_parameters.yaml)

add_library(${PROJECT_NAME}
src/bt_ros2.cpp
src/bt_utils.cpp
src/tree_execution_server.cpp )

ament_target_dependencies(${PROJECT_NAME} ${THIS_PACKAGE_DEPS})

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

target_link_libraries(${PROJECT_NAME} bt_executor_parameters)


######################################################
# INSTALL

install(DIRECTORY include/ DESTINATION include/)
ament_export_include_directories(include)
install(DIRECTORY include/ DESTINATION include/)

ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
ament_export_dependencies(${THIS_PACKAGE_DEPS})

install(
TARGETS ${PROJECT_NAME} bt_executor_parameters
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME})

ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})

ament_package()
74 changes: 74 additions & 0 deletions behaviortree_ros2/bt_executor_parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Bt Server Parameters

Default Config
```yaml
bt_server:
ros__parameters:
action_name: bt_execution
behavior_trees: '{}'
groot2_port: 1667.0
plugins: '{}'
ros_plugins_timeout: 1000.0
tick_frequency: 100.0

```

## action_name

The name the Action Server takes requests from

* Type: `string`
* Default Value: "bt_execution"
* Read only: True

## tick_frequency

Frequency in Hz to tick() the Behavior tree at

* Type: `int`
* Default Value: 100
* Read only: True

*Constraints:*
- parameter must be within bounds 1

## groot2_port

Server port value to publish Groot2 messages on

* Type: `int`
* Default Value: 1667
* Read only: True

*Constraints:*
- parameter must be within bounds 1

## plugins

List of 'package_name/subfolder' containing BehaviorTree plugins to load into the factory

* Type: `string_array`
* Default Value: {}

*Constraints:*
- contains no duplicates

## ros_plugins_timeout

Timeout (ms) used in BT::RosNodeParams

* Type: `int`
* Default Value: 1000

*Constraints:*
- parameter must be within bounds 1

## behavior_trees

List of 'package_name/subfolder' containing SubTrees to load into the BehaviorTree factory

* Type: `string_array`
* Default Value: {}

*Constraints:*
- contains no duplicates
Loading
Loading