Skip to content

Commit 70c775f

Browse files
committed
Fix build for Foxy
1 parent bd85dc1 commit 70c775f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ target_include_directories(${PROJECT_NAME} PUBLIC
4343
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
4444
target_compile_definitions(${PROJECT_NAME} PRIVATE "OCTOMAP_RVIZ_PLUGINS_BUILDING_LIBRARY")
4545

46+
# Check version of rclcpp to switch between features (message_lost_callback):
47+
# - Foxy is on rclcpp 2.x
48+
# - Galactic is on rclcpp 9.x
49+
# - Rolling (currently) is on rclcpp 14.x
50+
if(${rclcpp_VERSION_MAJOR} VERSION_LESS "3.0.0")
51+
target_compile_definitions(${PROJECT_NAME} PRIVATE "FOXY")
52+
endif()
53+
4654
pluginlib_export_plugin_description_file(rviz_common plugins_description.xml)
4755

4856
if(BUILD_TESTING)

src/occupancy_map_display.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ void OccupancyMapDisplay::subscribeToUpdateTopic()
235235
{
236236
try {
237237
rclcpp::SubscriptionOptions sub_opts;
238+
#ifndef FOXY
238239
sub_opts.event_callbacks.message_lost_callback =
239240
[&](rclcpp::QOSMessageLostInfo & info)
240241
{
@@ -246,6 +247,7 @@ void OccupancyMapDisplay::subscribeToUpdateTopic()
246247
rviz_common::properties::StatusProperty::Warn, "Update Topic",
247248
QString(sstm.str().c_str()));
248249
};
250+
#endif
249251

250252
update_subscription_ =
251253
rviz_ros_node_.lock()->get_raw_node()->

0 commit comments

Comments
 (0)