Skip to content

Commit 2c948eb

Browse files
committed
fix(avoidance): check both side lane if need
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent a722599 commit 2c948eb

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/utils.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ AvoidLineArray combineRawShiftLinesWithUniqueCheck(
148148

149149
std::vector<ExtendedPredictedObject> getSafetyCheckTargetObjects(
150150
const AvoidancePlanningData & data, const std::shared_ptr<const PlannerData> & planner_data,
151-
const std::shared_ptr<AvoidanceParameters> & parameters, const bool is_right_shift,
152-
DebugData & debug);
151+
const std::shared_ptr<AvoidanceParameters> & parameters, const bool has_left_shift,
152+
const bool has_right_shift, DebugData & debug);
153153

154154
std::pair<PredictedObjects, PredictedObjects> separateObjectsByPath(
155155
const PathWithLaneId & reference_path, const PathWithLaneId & spline_path,

planning/behavior_path_avoidance_module/src/scene.cpp

+14-5
Original file line numberDiff line numberDiff line change
@@ -694,30 +694,39 @@ bool AvoidanceModule::isSafePath(
694694
}
695695

696696
const auto ego_idx = planner_data_->findEgoIndex(shifted_path.path.points);
697-
const auto is_right_shift = [&]() -> std::optional<bool> {
697+
698+
const auto has_left_shift = [&]() {
698699
for (size_t i = ego_idx; i < shifted_path.shift_length.size(); i++) {
699700
const auto length = shifted_path.shift_length.at(i);
700701

701702
if (parameters_->lateral_avoid_check_threshold < length) {
702-
return false;
703+
return true;
703704
}
705+
}
706+
707+
return false;
708+
}();
709+
710+
const auto has_right_shift = [&]() {
711+
for (size_t i = ego_idx; i < shifted_path.shift_length.size(); i++) {
712+
const auto length = shifted_path.shift_length.at(i);
704713

705714
if (parameters_->lateral_avoid_check_threshold < -1.0 * length) {
706715
return true;
707716
}
708717
}
709718

710-
return std::nullopt;
719+
return false;
711720
}();
712721

713-
if (!is_right_shift.has_value()) {
722+
if (!has_left_shift && !has_right_shift) {
714723
return true;
715724
}
716725

717726
const auto hysteresis_factor = safe_ ? 1.0 : parameters_->hysteresis_factor_expand_rate;
718727

719728
const auto safety_check_target_objects = utils::avoidance::getSafetyCheckTargetObjects(
720-
avoid_data_, planner_data_, parameters_, is_right_shift.value(), debug);
729+
avoid_data_, planner_data_, parameters_, has_left_shift, has_right_shift, debug);
721730

722731
if (safety_check_target_objects.empty()) {
723732
return true;

planning/behavior_path_avoidance_module/src/utils.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1852,14 +1852,14 @@ lanelet::ConstLanelets getAdjacentLane(
18521852

18531853
std::vector<ExtendedPredictedObject> getSafetyCheckTargetObjects(
18541854
const AvoidancePlanningData & data, const std::shared_ptr<const PlannerData> & planner_data,
1855-
const std::shared_ptr<AvoidanceParameters> & parameters, const bool is_right_shift,
1856-
DebugData & debug)
1855+
const std::shared_ptr<AvoidanceParameters> & parameters, const bool has_left_shift,
1856+
const bool has_right_shift, DebugData & debug)
18571857
{
18581858
const auto & p = parameters;
18591859
const auto check_right_lanes =
1860-
(is_right_shift && p->check_shift_side_lane) || (!is_right_shift && p->check_other_side_lane);
1860+
(has_right_shift && p->check_shift_side_lane) || (has_left_shift && p->check_other_side_lane);
18611861
const auto check_left_lanes =
1862-
(!is_right_shift && p->check_shift_side_lane) || (is_right_shift && p->check_other_side_lane);
1862+
(has_left_shift && p->check_shift_side_lane) || (has_right_shift && p->check_other_side_lane);
18631863

18641864
std::vector<ExtendedPredictedObject> target_objects;
18651865

0 commit comments

Comments
 (0)