From 1f336428f4f969ac58b0f63b0c2c73b6b952f6e1 Mon Sep 17 00:00:00 2001 From: Tomohito ANDO Date: Sun, 22 Oct 2023 11:28:24 +0900 Subject: [PATCH] chore: add workaround for tf2 update (#5127) (#970) Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> --- common/autoware_auto_geometry/CMakeLists.txt | 6 ++++++ common/autoware_auto_tf2/CMakeLists.txt | 5 +++++ .../include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp | 3 ++- planning/behavior_path_planner/CMakeLists.txt | 6 ++++++ planning/surround_obstacle_checker/CMakeLists.txt | 6 ++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/common/autoware_auto_geometry/CMakeLists.txt b/common/autoware_auto_geometry/CMakeLists.txt index 454e0e7ef044f..bf48e8fcaca3f 100644 --- a/common/autoware_auto_geometry/CMakeLists.txt +++ b/common/autoware_auto_geometry/CMakeLists.txt @@ -12,6 +12,12 @@ ament_auto_add_library(${PROJECT_NAME} SHARED src/bounding_box.cpp ) +if(tf2_geometry_msgs_VERSION VERSION_LESS 0.25.4) + target_compile_definitions(${PROJECT_NAME} PRIVATE + DEFINE_LEGACY_FUNCTION + ) +endif() + if(BUILD_TESTING) set(GEOMETRY_GTEST geometry_gtest) set(GEOMETRY_SRC test/src/test_geometry.cpp diff --git a/common/autoware_auto_tf2/CMakeLists.txt b/common/autoware_auto_tf2/CMakeLists.txt index a8ae9ec2d962e..fe4cec1c0fc89 100755 --- a/common/autoware_auto_tf2/CMakeLists.txt +++ b/common/autoware_auto_tf2/CMakeLists.txt @@ -17,6 +17,11 @@ if(BUILD_TESTING) "tf2_geometry_msgs" "tf2_ros" ) + if(tf2_geometry_msgs_VERSION VERSION_LESS 0.25.4) + target_compile_definitions(test_tf2_autoware_auto_msgs PRIVATE + DEFINE_LEGACY_FUNCTION + ) + endif() endif() ament_auto_package() diff --git a/common/autoware_auto_tf2/include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp b/common/autoware_auto_tf2/include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp index 9b20953a7b3c5..ee8d52fa402c0 100644 --- a/common/autoware_auto_tf2/include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp +++ b/common/autoware_auto_tf2/include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp @@ -45,7 +45,7 @@ using BoundingBox = autoware_auto_perception_msgs::msg::BoundingBox; namespace tf2 { - +#ifdef DEFINE_LEGACY_FUNCTION /*************/ /** Point32 **/ /*************/ @@ -94,6 +94,7 @@ inline void doTransform( t_out.points[i].z = static_cast(v_out[2]); } } +#endif /******************/ /** Quaternion32 **/ diff --git a/planning/behavior_path_planner/CMakeLists.txt b/planning/behavior_path_planner/CMakeLists.txt index e00f7ade345b5..197e962a2a5fa 100644 --- a/planning/behavior_path_planner/CMakeLists.txt +++ b/planning/behavior_path_planner/CMakeLists.txt @@ -39,6 +39,12 @@ ament_auto_add_library(behavior_path_planner_node SHARED src/scene_module/scene_module_visitor.cpp ) +if(tf2_geometry_msgs_VERSION VERSION_LESS 0.25.4) + target_compile_definitions(behavior_path_planner_node PRIVATE + DEFINE_LEGACY_FUNCTION + ) +endif() + target_include_directories(behavior_path_planner_node SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR} ) diff --git a/planning/surround_obstacle_checker/CMakeLists.txt b/planning/surround_obstacle_checker/CMakeLists.txt index 0d7b636646783..694bddf421486 100644 --- a/planning/surround_obstacle_checker/CMakeLists.txt +++ b/planning/surround_obstacle_checker/CMakeLists.txt @@ -18,6 +18,12 @@ ament_auto_add_library(${PROJECT_NAME} SHARED src/node.cpp ) +if(tf2_geometry_msgs_VERSION VERSION_LESS 0.25.4) + target_compile_definitions(${PROJECT_NAME} PRIVATE + DEFINE_LEGACY_FUNCTION + ) +endif() + target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES} )