Skip to content

Commit

Permalink
fix(accel_brake_map_calibrator): modify build error in rolling (#755)
Browse files Browse the repository at this point in the history
Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp>
  • Loading branch information
wep21 authored Apr 24, 2022
1 parent 9985aab commit 091031d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ ament_auto_add_executable(accel_brake_map_calibrator
)
ament_target_dependencies(accel_brake_map_calibrator)

# 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(accel_brake_map_calibrator PRIVATE
USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
)
endif()

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
#include "raw_vehicle_cmd_converter/brake_map.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 "tier4_autoware_utils/planning/planning_marker_helper.hpp"
#include "tier4_autoware_utils/ros/transform_listener.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<depend>rclcpp</depend>
<depend>std_msgs</depend>
<depend>std_srvs</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tf2_ros</depend>
<depend>tier4_autoware_utils</depend>
<depend>tier4_debug_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ T AccelBrakeMapCalibrator::getNearestTimeDataFromVec(
double nearest_time = std::numeric_limits<double>::max();
const double target_time = rclcpp::Time(base_data->header.stamp).seconds() - back_time;
T nearest_time_data;
for (const auto data : vec) {
for (const auto & data : vec) {
const double data_time = rclcpp::Time(data->header.stamp).seconds();
const auto delta_time = std::abs(target_time - data_time);
if (nearest_time > delta_time) {
Expand All @@ -1001,7 +1001,7 @@ DataStampedPtr AccelBrakeMapCalibrator::getNearestTimeDataFromVec(
double nearest_time = std::numeric_limits<double>::max();
const double target_time = base_data->data_time.seconds() - back_time;
DataStampedPtr nearest_time_data;
for (const auto data : vec) {
for (const auto & data : vec) {
const double data_time = data->data_time.seconds();
const auto delta_time = std::abs(target_time - data_time);
if (nearest_time > delta_time) {
Expand Down

0 comments on commit 091031d

Please sign in to comment.