Skip to content

Commit

Permalink
fix: porting to new rclcpp service template API
Browse files Browse the repository at this point in the history
Signed-off-by: homalozoa <[email protected]>
  • Loading branch information
homalozoa committed Oct 24, 2024
1 parent ea1f4e5 commit 761a8cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ch4/service/ch4_service_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)

set(ROS_DISTRO $ENV{ROS_DISTRO})
if(${ROS_DISTRO} STREQUAL "rolling")
add_compile_definitions(NEW_SERVICE_TEMPLATE)
endif()

set(executable_selfservice self_exec)
set(executable_selfnode self_node)

Expand Down
4 changes: 4 additions & 0 deletions ch4/service/ch4_service_cpp/src/single_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ class SingleNode : public rclcpp::Node
server_ = this->create_service<rcl_interfaces::srv::GetParameters>(
"get_para",
std::bind(&SingleNode::service_callback, this, std::placeholders::_1, std::placeholders::_2),
#ifdef NEW_SERVICE_TEMPLATE
rclcpp::ServiceQoS(),
#else
rmw_qos_profile_services_default,
#endif
cb_group_);
}

Expand Down

0 comments on commit 761a8cb

Please sign in to comment.