Skip to content

Commit 1ab924d

Browse files
Deprecated rmw_qos_profile_t and ament_target_dependencies (#119)
* Deprecated ament_target_dependencies Signed-off-by: ElSayed ElSheikh <[email protected]> * Deprecate rmw_qos_profile_t Signed-off-by: ElSayed ElSheikh <[email protected]> * Keep rmw_qos_profile_t for humble Signed-off-by: ElSayed ElSheikh <[email protected]> --------- Signed-off-by: ElSayed ElSheikh <[email protected]>
1 parent 38f8e92 commit 1ab924d

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

behaviortree_ros2/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ add_library(${PROJECT_NAME}
2929
src/bt_utils.cpp
3030
src/tree_execution_server.cpp )
3131

32-
ament_target_dependencies(${PROJECT_NAME} ${THIS_PACKAGE_DEPS})
33-
3432
target_include_directories(${PROJECT_NAME} PUBLIC
3533
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
3634
$<INSTALL_INTERFACE:include>)
3735

38-
target_link_libraries(${PROJECT_NAME} bt_executor_parameters)
36+
target_link_libraries(${PROJECT_NAME} PUBLIC
37+
rclcpp::rclcpp
38+
rclcpp_action::rclcpp_action
39+
ament_index_cpp::ament_index_cpp
40+
behaviortree_cpp::behaviortree_cpp
41+
${btcpp_ros2_interfaces_TARGETS}
42+
bt_executor_parameters
43+
)
3944

4045

4146
######################################################

behaviortree_ros2/include/behaviortree_ros2/bt_service_node.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <string>
2020
#include <rclcpp/executors.hpp>
2121
#include <rclcpp/allocator/allocator_common.hpp>
22+
#include <rclcpp/version.h>
23+
#include <rclcpp/qos.hpp>
2224
#include "behaviortree_cpp/bt_factory.h"
2325

2426
#include "behaviortree_ros2/ros_node_params.hpp"
@@ -216,8 +218,14 @@ inline RosServiceNode<T>::ServiceClientInstance::ServiceClientInstance(
216218
node->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive, false);
217219
callback_executor.add_callback_group(callback_group, node->get_node_base_interface());
218220

221+
// For Jazzy and Later Support
222+
#if RCLCPP_VERSION_GTE(28, 0, 0)
223+
service_client = node->create_client<T>(service_name, rclcpp::ServicesQoS(),
224+
callback_group);
225+
#else
219226
service_client = node->create_client<T>(service_name, rmw_qos_profile_services_default,
220227
callback_group);
228+
#endif
221229
}
222230

223231
template <class T>

btcpp_ros2_samples/CMakeLists.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@ find_package(std_msgs REQUIRED)
1212
find_package(std_srvs REQUIRED)
1313

1414
set(THIS_PACKAGE_DEPS
15-
behaviortree_ros2
16-
std_msgs
17-
std_srvs
18-
btcpp_ros2_interfaces )
15+
behaviortree_ros2::behaviortree_ros2
16+
${std_msgs_TARGETS}
17+
${std_srvs_TARGETS}
18+
${btcpp_ros2_interfaces_TARGETS} )
1919

2020
######################################################
2121
# Simple example showing how to use and customize the BtExecutionServer
2222
add_executable(sample_bt_executor src/sample_bt_executor.cpp)
23-
ament_target_dependencies(sample_bt_executor ${THIS_PACKAGE_DEPS})
23+
target_link_libraries(sample_bt_executor ${THIS_PACKAGE_DEPS})
2424

2525
######################################################
2626
# Build an Action Client that calls the sleep action (STATIC version)
2727

2828
add_executable(sleep_client
2929
src/sleep_action.cpp
3030
src/sleep_client.cpp)
31-
ament_target_dependencies(sleep_client ${THIS_PACKAGE_DEPS})
31+
target_link_libraries(sleep_client ${THIS_PACKAGE_DEPS})
3232

3333
######################################################
3434
# Build a client that call the sleep action (Plugin version)
3535

3636
add_library(sleep_plugin SHARED src/sleep_action.cpp)
3737
target_compile_definitions(sleep_plugin PRIVATE BT_PLUGIN_EXPORT )
38-
ament_target_dependencies(sleep_plugin ${THIS_PACKAGE_DEPS})
38+
target_link_libraries(sleep_plugin ${THIS_PACKAGE_DEPS})
3939

4040
add_executable(sleep_client_dyn src/sleep_client.cpp)
4141
target_compile_definitions(sleep_client_dyn PRIVATE USE_SLEEP_PLUGIN )
4242
target_link_libraries(sleep_client_dyn sleep_plugin )
43-
ament_target_dependencies(sleep_client_dyn ${THIS_PACKAGE_DEPS})
43+
target_link_libraries(sleep_client_dyn ${THIS_PACKAGE_DEPS})
4444

4545
######################################################
4646
# Build Server
4747
add_executable(sleep_server src/sleep_server.cpp)
48-
ament_target_dependencies(sleep_server ${THIS_PACKAGE_DEPS})
48+
target_link_libraries(sleep_server ${THIS_PACKAGE_DEPS})
4949

5050
######################################################
5151
# Build subscriber_test
5252
add_executable(subscriber_test src/subscriber_test.cpp)
53-
ament_target_dependencies(subscriber_test ${THIS_PACKAGE_DEPS})
53+
target_link_libraries(subscriber_test ${THIS_PACKAGE_DEPS})
5454

5555
######################################################
5656
# the SetBool test
5757
add_executable(bool_client src/bool_client.cpp src/set_bool_node.cpp)
58-
ament_target_dependencies(bool_client ${THIS_PACKAGE_DEPS})
58+
target_link_libraries(bool_client ${THIS_PACKAGE_DEPS})
5959

6060
add_executable(bool_server src/bool_server.cpp )
61-
ament_target_dependencies(bool_server ${THIS_PACKAGE_DEPS})
61+
target_link_libraries(bool_server ${THIS_PACKAGE_DEPS})
6262

6363
######################################################
6464
# INSTALL

0 commit comments

Comments
 (0)