Skip to content

Commit

Permalink
fix: build on jazzy
Browse files Browse the repository at this point in the history
  • Loading branch information
russkel committed Aug 12, 2024
1 parent 4ef0f32 commit 94b0767
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 660 deletions.
6 changes: 5 additions & 1 deletion ros2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,18 @@ if(BUILD_LIBRARY)
add_library(${PROJECT_NAME}
SHARED
src/Factory.cpp
$<IF:$<STREQUAL:"${IS_ROS2_DISTRO}","foxy">,src/SystemHandle__foxy.cpp,src/SystemHandle.cpp>
src/SystemHandle.cpp
src/MetaPublisher.cpp
)

if (Sanitizers_FOUND)
add_sanitizers(${PROJECT_NAME})
endif()

if($ENV{ROS_DISTRO} STREQUAL "iron")
add_definitions(-DROS_IRON)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION
${PROJECT_VERSION}
Expand Down
16 changes: 13 additions & 3 deletions ros2/src/MetaPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,26 @@ class MetaSubscriber

_subscription = node.create_generic_subscription(
_topic_name, _message_type.name(), qos_profile,
[=](const std::shared_ptr<rclcpp::SerializedMessage>& msg) {
this->subscription_callback(msg);
#ifdef ROS_IRON
[=](const std::shared_ptr<rclcpp::SerializedMessage> msg) {
this->subscription_callback(msg, message_info);
},
#else
[=](const std::shared_ptr<rclcpp::SerializedMessage> msg, const rclcpp::MessageInfo& message_info) {
this->subscription_callback(msg, message_info);
},
#endif
subscription_options);
}

private:

void subscription_callback(
const std::shared_ptr<rclcpp::SerializedMessage>& msg)
#ifdef ROS_IRON
const std::shared_ptr<rclcpp::SerializedMessage> msg)
#else
const std::shared_ptr<rclcpp::SerializedMessage> msg, [[maybe_unused]] const rclcpp::MessageInfo & message_info)
#endif
{
logger_ << utils::Logger::Level::DEBUG
<< "Receiving message from ROS 2 for topic '"
Expand Down
Loading

0 comments on commit 94b0767

Please sign in to comment.