Skip to content

Commit 91b8c62

Browse files
zulfaqar-azmi-t4shmpwk
authored andcommitted
fix(lane_change): orientation check when constructing path (autowarefoundation#6339)
Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
1 parent 7bb9128 commit 91b8c62

File tree

1 file changed

+16
-0
lines changed
  • planning/behavior_path_lane_change_module/src/utils

1 file changed

+16
-0
lines changed

planning/behavior_path_lane_change_module/src/utils/utils.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "behavior_path_planner_common/utils/path_utils.hpp"
2424
#include "behavior_path_planner_common/utils/utils.hpp"
2525
#include "object_recognition_utils/predicted_path_utils.hpp"
26+
#include "tier4_autoware_utils/math/unit_conversion.hpp"
2627

2728
#include <lanelet2_extension/utility/query.hpp>
2829
#include <lanelet2_extension/utility/utilities.hpp>
@@ -40,7 +41,9 @@
4041
#include <tf2_ros/transform_listener.h>
4142

4243
#include <algorithm>
44+
#include <iterator>
4345
#include <limits>
46+
#include <optional>
4447
#include <string>
4548
#include <vector>
4649

@@ -385,6 +388,19 @@ std::optional<LaneChangePath> constructCandidatePath(
385388
return std::nullopt;
386389
}
387390

391+
if (prepare_segment.points.size() > 1 && shifted_path.path.points.size() > 1) {
392+
const auto & prepare_segment_second_last_point =
393+
std::prev(prepare_segment.points.end() - 1)->point.pose;
394+
const auto & lane_change_start_from_shifted =
395+
std::next(shifted_path.path.points.begin())->point.pose;
396+
const auto yaw_diff2 = std::abs(tier4_autoware_utils::normalizeRadian(
397+
tf2::getYaw(prepare_segment_second_last_point.orientation) -
398+
tf2::getYaw(lane_change_start_from_shifted.orientation)));
399+
if (yaw_diff2 > tier4_autoware_utils::deg2rad(5.0)) {
400+
return std::nullopt;
401+
}
402+
}
403+
388404
candidate_path.path = utils::combinePath(prepare_segment, shifted_path.path);
389405
candidate_path.shifted_path = shifted_path;
390406

0 commit comments

Comments
 (0)