diff --git a/translation_node/CMakeLists.txt b/translation_node/CMakeLists.txt index c382c18..c33a85a 100644 --- a/translation_node/CMakeLists.txt +++ b/translation_node/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8) project(translation_node) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) + add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter -Werror) endif() # find dependencies diff --git a/translation_node/src/pub_sub_graph.cpp b/translation_node/src/pub_sub_graph.cpp index e978469..82cc658 100644 --- a/translation_node/src/pub_sub_graph.cpp +++ b/translation_node/src/pub_sub_graph.cpp @@ -140,10 +140,14 @@ void PubSubGraph::updateCurrentTopics(const std::vector &topics) { void PubSubGraph::onSubscriptionUpdate(const Graph::MessageNodePtr& node) { _pub_sub_graph.translate( node, - [](const Graph::MessageNodePtr& node) { + [this](const Graph::MessageNodePtr& node) { if (node->data().publication != nullptr) { - rcl_publish(node->data().publication->get_publisher_handle().get(), + const auto ret = rcl_publish(node->data().publication->get_publisher_handle().get(), node->buffer().get(), nullptr); + if (ret != RCL_RET_OK) { + RCLCPP_WARN_ONCE(_node.get_logger(), "Failed to publish on topic '%s', version: %i", + node->data().topic_name.c_str(), node->data().version); + } } }); diff --git a/translation_node/src/vehicle_attitude_v2.h b/translation_node/src/vehicle_attitude_v2.h index 6dc859c..0f80253 100644 --- a/translation_node/src/vehicle_attitude_v2.h +++ b/translation_node/src/vehicle_attitude_v2.h @@ -24,11 +24,17 @@ class VehicleAttitudeV2Translation { static void fromOlder(const MessageOlder &msg_older, MessageNewer &msg_newer) { // No change in message definition static_assert(sizeof(msg_newer) == sizeof(msg_older)); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclass-memaccess" memcpy(&msg_newer, &msg_older, sizeof(msg_newer)); +#pragma GCC diagnostic pop } static void toOlder(const MessageNewer &msg_newer, MessageOlder &msg_older) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclass-memaccess" memcpy(&msg_older, &msg_newer, sizeof(msg_newer)); +#pragma GCC diagnostic pop } private: