|
28 | 28 | #include <range/v3/numeric/accumulate.hpp>
|
29 | 29 | #include <range/v3/view.hpp>
|
30 | 30 |
|
| 31 | +#include <fmt/format.h> |
| 32 | + |
31 | 33 | #include <algorithm>
|
32 | 34 | #include <limits>
|
33 | 35 | #include <vector>
|
@@ -302,12 +304,12 @@ LaneChangePath get_candidate_path(
|
302 | 304 | }
|
303 | 305 |
|
304 | 306 | return utils::lane_change::construct_candidate_path(
|
305 |
| - lane_change_info, prep_segment, target_lane_reference_path, sorted_lane_ids); |
| 307 | + lane_change_info, common_data_ptr, prep_segment, target_lane_reference_path, sorted_lane_ids); |
306 | 308 | }
|
307 | 309 |
|
308 | 310 | LaneChangePath construct_candidate_path(
|
309 |
| - const LaneChangeInfo & lane_change_info, const PathWithLaneId & prepare_segment, |
310 |
| - const PathWithLaneId & target_lane_reference_path, |
| 311 | + const LaneChangeInfo & lane_change_info, const CommonDataPtr & common_data_ptr, |
| 312 | + const PathWithLaneId & prepare_segment, const PathWithLaneId & target_lane_reference_path, |
311 | 313 | const std::vector<std::vector<int64_t>> & sorted_lane_ids)
|
312 | 314 | {
|
313 | 315 | const auto & shift_line = lane_change_info.shift_line;
|
@@ -343,14 +345,15 @@ LaneChangePath construct_candidate_path(
|
343 | 345 | point.lane_ids = target_lane_reference_path.points.at(*nearest_idx).lane_ids;
|
344 | 346 | }
|
345 | 347 |
|
346 |
| - constexpr auto yaw_diff_th = autoware::universe_utils::deg2rad(5.0); |
| 348 | + const auto th_yaw_diff_deg = common_data_ptr->lc_param_ptr->frenet.th_yaw_diff_deg; |
347 | 349 | if (
|
348 |
| - const auto yaw_diff_opt = |
349 |
| - exceed_yaw_threshold(prepare_segment, shifted_path.path, yaw_diff_th)) { |
350 |
| - std::stringstream err_msg; |
351 |
| - err_msg << "Excessive yaw difference " << yaw_diff_opt.value() << " which exceeds the " |
352 |
| - << yaw_diff_th << " radian threshold."; |
353 |
| - throw std::logic_error(err_msg.str()); |
| 350 | + const auto yaw_diff_opt = exceed_yaw_threshold( |
| 351 | + prepare_segment, shifted_path.path, autoware::universe_utils::deg2rad(th_yaw_diff_deg))) { |
| 352 | + const auto yaw_diff_deg = autoware::universe_utils::rad2deg(yaw_diff_opt.value()); |
| 353 | + const auto err_msg = fmt::format( |
| 354 | + "Excessive yaw difference {yaw_diff:2.2f}[deg]. The threshold is {th_yaw_diff:2.2f}[deg].", |
| 355 | + fmt::arg("yaw_diff", yaw_diff_deg), fmt::arg("th_yaw_diff", th_yaw_diff_deg)); |
| 356 | + throw std::logic_error(err_msg); |
354 | 357 | }
|
355 | 358 |
|
356 | 359 | LaneChangePath candidate_path;
|
|
0 commit comments