diff --git a/control/trajectory_follower/CMakeLists.txt b/control/trajectory_follower/CMakeLists.txt index cc0065a86dc20..64331e65a5e68 100644 --- a/control/trajectory_follower/CMakeLists.txt +++ b/control/trajectory_follower/CMakeLists.txt @@ -65,7 +65,7 @@ target_compile_options(${LATERAL_CONTROLLER_LIB} PRIVATE -Wno-error=old-style-ca # workaround to allow deprecated header to build on both galactic and rolling if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0) - target_compile_definitions(${LATERAL_CONTROLLER_LIB} PUBLIC + target_compile_definitions(${LATERAL_CONTROLLER_LIB} PRIVATE USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER ) endif() @@ -95,7 +95,7 @@ target_compile_options(${LONGITUDINAL_CONTROLLER_LIB} PRIVATE -Wno-error=old-sty # workaround to allow deprecated header to build on both galactic and rolling if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0) - target_compile_definitions(${LONGITUDINAL_CONTROLLER_LIB} PUBLIC + target_compile_definitions(${LONGITUDINAL_CONTROLLER_LIB} PRIVATE USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER ) endif() @@ -118,6 +118,13 @@ if(BUILD_TESTING) autoware_set_compile_options(${TEST_LATERAL_CONTROLLER_EXE}) target_link_libraries(${TEST_LATERAL_CONTROLLER_EXE} ${LATERAL_CONTROLLER_LIB}) + # workaround to allow deprecated header to build on both galactic and rolling + if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0) + target_compile_definitions(${TEST_LATERAL_CONTROLLER_EXE} PRIVATE + USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER + ) + endif() + set(TEST_LON_SOURCES test/test_debug_values.cpp test/test_pid.cpp @@ -128,6 +135,13 @@ if(BUILD_TESTING) ament_add_gtest(${TEST_LONGITUDINAL_CONTROLLER_EXE} ${TEST_LON_SOURCES}) autoware_set_compile_options(${TEST_LONGITUDINAL_CONTROLLER_EXE}) target_link_libraries(${TEST_LONGITUDINAL_CONTROLLER_EXE} ${LONGITUDINAL_CONTROLLER_LIB}) + + # workaround to allow deprecated header to build on both galactic and rolling + if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0) + target_compile_definitions(${TEST_LONGITUDINAL_CONTROLLER_EXE} PRIVATE + USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER + ) + endif() endif() # ament package generation and installing diff --git a/control/trajectory_follower/include/trajectory_follower/mpc_utils.hpp b/control/trajectory_follower/include/trajectory_follower/mpc_utils.hpp index 37e7a56d7cee2..64efa6dfaf451 100644 --- a/control/trajectory_follower/include/trajectory_follower/mpc_utils.hpp +++ b/control/trajectory_follower/include/trajectory_follower/mpc_utils.hpp @@ -24,6 +24,13 @@ #include "motion_common/motion_common.hpp" #include "rclcpp/rclcpp.hpp" #include "tf2/utils.h" + +#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER +#include "tf2_geometry_msgs/tf2_geometry_msgs.h" +#else +#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" +#endif + #include "trajectory_follower/interpolate.hpp" #include "trajectory_follower/mpc_trajectory.hpp" #include "trajectory_follower/visibility_control.hpp" @@ -32,7 +39,6 @@ #include "autoware_auto_planning_msgs/msg/trajectory_point.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" #include "geometry_msgs/msg/twist_stamped.hpp" -#include "tf2_geometry_msgs/tf2_geometry_msgs.h" #include #include diff --git a/control/trajectory_follower/src/longitudinal_controller_utils.cpp b/control/trajectory_follower/src/longitudinal_controller_utils.cpp index 7e82740017cd3..4a376eb0920de 100644 --- a/control/trajectory_follower/src/longitudinal_controller_utils.cpp +++ b/control/trajectory_follower/src/longitudinal_controller_utils.cpp @@ -20,7 +20,11 @@ #include // NOLINT +#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER #include "tf2_geometry_msgs/tf2_geometry_msgs.h" +#else +#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" +#endif #include #include diff --git a/control/trajectory_follower/src/pid.cpp b/control/trajectory_follower/src/pid.cpp index d79f5f5e4f47c..badb3fb51a1a0 100644 --- a/control/trajectory_follower/src/pid.cpp +++ b/control/trajectory_follower/src/pid.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include diff --git a/control/trajectory_follower/test/test_longitudinal_controller_utils.cpp b/control/trajectory_follower/test/test_longitudinal_controller_utils.cpp index 35957855a74fa..102c56bacbac6 100644 --- a/control/trajectory_follower/test/test_longitudinal_controller_utils.cpp +++ b/control/trajectory_follower/test/test_longitudinal_controller_utils.cpp @@ -21,7 +21,12 @@ #include "geometry_msgs/msg/point.hpp" #include "geometry_msgs/msg/pose.hpp" #include "geometry_msgs/msg/quaternion.hpp" + +#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER #include "tf2_geometry_msgs/tf2_geometry_msgs.h" +#else +#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" +#endif #include diff --git a/control/trajectory_follower/test/test_mpc.cpp b/control/trajectory_follower/test/test_mpc.cpp index a9cfde53073f2..47a0e1204ccba 100644 --- a/control/trajectory_follower/test/test_mpc.cpp +++ b/control/trajectory_follower/test/test_mpc.cpp @@ -25,7 +25,12 @@ #include "autoware_auto_system_msgs/msg/float32_multi_array_diagnostic.hpp" #include "autoware_auto_vehicle_msgs/msg/steering_report.hpp" #include "geometry_msgs/msg/pose.hpp" + +#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER #include "tf2_geometry_msgs/tf2_geometry_msgs.h" +#else +#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" +#endif #include #include