Skip to content

Commit 7919b56

Browse files
authored
fix(trajectory_follower): modify build error in rolling (#803)
Signed-off-by: wep21 <[email protected]>
1 parent d1e290e commit 7919b56

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

control/trajectory_follower/CMakeLists.txt

+16-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ target_compile_options(${LATERAL_CONTROLLER_LIB} PRIVATE -Wno-error=old-style-ca
6565

6666
# workaround to allow deprecated header to build on both galactic and rolling
6767
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
68-
target_compile_definitions(${LATERAL_CONTROLLER_LIB} PUBLIC
68+
target_compile_definitions(${LATERAL_CONTROLLER_LIB} PRIVATE
6969
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
7070
)
7171
endif()
@@ -95,7 +95,7 @@ target_compile_options(${LONGITUDINAL_CONTROLLER_LIB} PRIVATE -Wno-error=old-sty
9595

9696
# workaround to allow deprecated header to build on both galactic and rolling
9797
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
98-
target_compile_definitions(${LONGITUDINAL_CONTROLLER_LIB} PUBLIC
98+
target_compile_definitions(${LONGITUDINAL_CONTROLLER_LIB} PRIVATE
9999
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
100100
)
101101
endif()
@@ -118,6 +118,13 @@ if(BUILD_TESTING)
118118
autoware_set_compile_options(${TEST_LATERAL_CONTROLLER_EXE})
119119
target_link_libraries(${TEST_LATERAL_CONTROLLER_EXE} ${LATERAL_CONTROLLER_LIB})
120120

121+
# workaround to allow deprecated header to build on both galactic and rolling
122+
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
123+
target_compile_definitions(${TEST_LATERAL_CONTROLLER_EXE} PRIVATE
124+
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
125+
)
126+
endif()
127+
121128
set(TEST_LON_SOURCES
122129
test/test_debug_values.cpp
123130
test/test_pid.cpp
@@ -128,6 +135,13 @@ if(BUILD_TESTING)
128135
ament_add_gtest(${TEST_LONGITUDINAL_CONTROLLER_EXE} ${TEST_LON_SOURCES})
129136
autoware_set_compile_options(${TEST_LONGITUDINAL_CONTROLLER_EXE})
130137
target_link_libraries(${TEST_LONGITUDINAL_CONTROLLER_EXE} ${LONGITUDINAL_CONTROLLER_LIB})
138+
139+
# workaround to allow deprecated header to build on both galactic and rolling
140+
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
141+
target_compile_definitions(${TEST_LONGITUDINAL_CONTROLLER_EXE} PRIVATE
142+
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
143+
)
144+
endif()
131145
endif()
132146

133147
# ament package generation and installing

control/trajectory_follower/include/trajectory_follower/mpc_utils.hpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
#include "motion_common/motion_common.hpp"
2525
#include "rclcpp/rclcpp.hpp"
2626
#include "tf2/utils.h"
27+
28+
#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
29+
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
30+
#else
31+
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
32+
#endif
33+
2734
#include "trajectory_follower/interpolate.hpp"
2835
#include "trajectory_follower/mpc_trajectory.hpp"
2936
#include "trajectory_follower/visibility_control.hpp"
@@ -32,7 +39,6 @@
3239
#include "autoware_auto_planning_msgs/msg/trajectory_point.hpp"
3340
#include "geometry_msgs/msg/pose_stamped.hpp"
3441
#include "geometry_msgs/msg/twist_stamped.hpp"
35-
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
3642

3743
#include <cmath>
3844
#include <string>

control/trajectory_follower/src/longitudinal_controller_utils.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020

2121
#include <experimental/optional> // NOLINT
2222

23+
#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
2324
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
25+
#else
26+
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
27+
#endif
2428

2529
#include <algorithm>
2630
#include <limits>

control/trajectory_follower/src/pid.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <algorithm>
1818
#include <memory>
19+
#include <stdexcept>
1920
#include <utility>
2021
#include <vector>
2122

control/trajectory_follower/test/test_longitudinal_controller_utils.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
#include "geometry_msgs/msg/point.hpp"
2222
#include "geometry_msgs/msg/pose.hpp"
2323
#include "geometry_msgs/msg/quaternion.hpp"
24+
25+
#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
2426
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
27+
#else
28+
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
29+
#endif
2530

2631
#include <limits>
2732

control/trajectory_follower/test/test_mpc.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
#include "autoware_auto_system_msgs/msg/float32_multi_array_diagnostic.hpp"
2626
#include "autoware_auto_vehicle_msgs/msg/steering_report.hpp"
2727
#include "geometry_msgs/msg/pose.hpp"
28+
29+
#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
2830
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
31+
#else
32+
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
33+
#endif
2934

3035
#include <memory>
3136
#include <string>

0 commit comments

Comments
 (0)