From 5c0a7809f9834a25d777bb7bf1bf63e2ea3e92c9 Mon Sep 17 00:00:00 2001 From: Michel Hidalgo Date: Mon, 30 Sep 2024 13:04:01 -0300 Subject: [PATCH] Fix Rolling builds (#439) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Proposed changes Precisely what the title says. This patch: - copes with `message_filters` header deprecations - copes with `rclcpp::Node::create_service` API removals #### Type of change - [x] 🐛 Bugfix (change which fixes an issue) - [ ] 🚀 Feature (change which adds functionality) - [ ] 📚 Documentation (change which fixes or extends documentation) ### Checklist - [x] Lint and unit tests (if any) pass locally with my changes - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added necessary documentation (if appropriate) - [x] All commits have been signed for [DCO](https://developercertificate.org/) Signed-off-by: Michel Hidalgo --- beluga_amcl/include/beluga_amcl/amcl_node.hpp | 4 ++ .../include/beluga_amcl/ndt_amcl_node.hpp | 3 ++ .../include/beluga_amcl/ndt_amcl_node_3d.hpp | 3 ++ beluga_amcl/src/amcl_node.cpp | 51 ++++++++++--------- beluga_amcl/src/ndt_amcl_node.cpp | 4 ++ beluga_amcl/src/ndt_amcl_node_3d.cpp | 4 ++ 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/beluga_amcl/include/beluga_amcl/amcl_node.hpp b/beluga_amcl/include/beluga_amcl/amcl_node.hpp index 08d3ec7d1..c9d44c692 100644 --- a/beluga_amcl/include/beluga_amcl/amcl_node.hpp +++ b/beluga_amcl/include/beluga_amcl/amcl_node.hpp @@ -19,7 +19,11 @@ #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcpp" #include +#pragma GCC diagnostic pop + #include #include #include diff --git a/beluga_amcl/include/beluga_amcl/ndt_amcl_node.hpp b/beluga_amcl/include/beluga_amcl/ndt_amcl_node.hpp index 573b33aa2..5e7deae4b 100644 --- a/beluga_amcl/include/beluga_amcl/ndt_amcl_node.hpp +++ b/beluga_amcl/include/beluga_amcl/ndt_amcl_node.hpp @@ -52,7 +52,10 @@ #include #include "beluga_amcl/ros2_common.hpp" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcpp" #include +#pragma GCC diagnostic pop /** * \file diff --git a/beluga_amcl/include/beluga_amcl/ndt_amcl_node_3d.hpp b/beluga_amcl/include/beluga_amcl/ndt_amcl_node_3d.hpp index 4e61301a9..f5edb2ad3 100644 --- a/beluga_amcl/include/beluga_amcl/ndt_amcl_node_3d.hpp +++ b/beluga_amcl/include/beluga_amcl/ndt_amcl_node_3d.hpp @@ -40,7 +40,10 @@ #include #include "beluga_amcl/ros2_common.hpp" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcpp" #include +#pragma GCC diagnostic pop /** * \file diff --git a/beluga_amcl/src/amcl_node.cpp b/beluga_amcl/src/amcl_node.cpp index 911a3bed5..9e7ad3754 100644 --- a/beluga_amcl/src/amcl_node.cpp +++ b/beluga_amcl/src/amcl_node.cpp @@ -40,7 +40,12 @@ #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcpp" #include +#pragma GCC diagnostic pop + +#include #include #include #include @@ -201,29 +206,29 @@ void AmclNode::do_activate(const rclcpp_lifecycle::State&) { RCLCPP_INFO(get_logger(), "Subscribed to scan_topic: %s", laser_scan_sub_->getTopic().c_str()); } - { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - // Ignore deprecated declaration warning to support Humble. - // Message: use rclcpp::QoS instead of rmw_qos_profile_t - global_localization_server_ = create_service( - "reinitialize_global_localization", - std::bind( - &AmclNode::global_localization_callback, this, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3), - rmw_qos_profile_services_default, common_callback_group_); - RCLCPP_INFO(get_logger(), "Created reinitialize_global_localization service"); - - nomotion_update_server_ = create_service( - "request_nomotion_update", - std::bind( - &AmclNode::nomotion_update_callback, this, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3), - rmw_qos_profile_services_default, common_callback_group_); - RCLCPP_INFO(get_logger(), "Created request_nomotion_update service"); - -#pragma GCC diagnostic pop - } + const auto common_service_qos = [] { + if constexpr (RCLCPP_VERSION_GTE(17, 0, 0)) { + return rclcpp::ServicesQoS(); + } else { + return rmw_qos_profile_services_default; + } + }(); + + global_localization_server_ = create_service( + "reinitialize_global_localization", + std::bind( + &AmclNode::global_localization_callback, this, std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3), + common_service_qos, common_callback_group_); + RCLCPP_INFO(get_logger(), "Created reinitialize_global_localization service"); + + nomotion_update_server_ = create_service( + "request_nomotion_update", + std::bind( + &AmclNode::nomotion_update_callback, this, std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3), + common_service_qos, common_callback_group_); + RCLCPP_INFO(get_logger(), "Created request_nomotion_update service"); } void AmclNode::do_deactivate(const rclcpp_lifecycle::State&) { diff --git a/beluga_amcl/src/ndt_amcl_node.cpp b/beluga_amcl/src/ndt_amcl_node.cpp index 8b5a6ef91..85e7a2c89 100644 --- a/beluga_amcl/src/ndt_amcl_node.cpp +++ b/beluga_amcl/src/ndt_amcl_node.cpp @@ -43,7 +43,11 @@ #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcpp" #include +#pragma GCC diagnostic pop + #include #include #include diff --git a/beluga_amcl/src/ndt_amcl_node_3d.cpp b/beluga_amcl/src/ndt_amcl_node_3d.cpp index 4eda5cdb9..7b8ac2b3c 100644 --- a/beluga_amcl/src/ndt_amcl_node_3d.cpp +++ b/beluga_amcl/src/ndt_amcl_node_3d.cpp @@ -49,7 +49,11 @@ #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcpp" #include +#pragma GCC diagnostic pop + #include #include #include