Skip to content

Commit 8863433

Browse files
authored
fix(avoidance): take objects on same root lanelet into consideration of safety check (#5828)
fix(avoidance): use same root adjacent lane Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent dfc4da0 commit 8863433

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/data_structs.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,9 @@ struct DebugData
638638
// tmp for plot
639639
PathWithLaneId center_line;
640640

641+
// safety check area
642+
lanelet::ConstLanelets safety_check_lanes;
643+
641644
// collision check debug map
642645
utils::path_safety_checker::CollisionCheckDebugMap collision_check;
643646

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/utils.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ AvoidLineArray combineRawShiftLinesWithUniqueCheck(
153153

154154
std::vector<ExtendedPredictedObject> getSafetyCheckTargetObjects(
155155
const AvoidancePlanningData & data, const std::shared_ptr<const PlannerData> & planner_data,
156-
const std::shared_ptr<AvoidanceParameters> & parameters, const bool is_right_shift);
156+
const std::shared_ptr<AvoidanceParameters> & parameters, const bool is_right_shift,
157+
DebugData & debug);
157158

158159
std::pair<PredictedObjects, PredictedObjects> separateObjectsByPath(
159160
const PathWithLaneId & path, const std::shared_ptr<const PlannerData> & planner_data,

planning/behavior_path_avoidance_module/src/debug.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,8 @@ MarkerArray createDebugMarkerArray(
618618
createMarkerColor(0.16, 1.0, 0.69, 0.2)));
619619
add(laneletsAsTriangleMarkerArray(
620620
"current_lanes", data.current_lanelets, createMarkerColor(1.0, 1.0, 1.0, 0.2)));
621+
add(laneletsAsTriangleMarkerArray(
622+
"safety_check_lanes", debug.safety_check_lanes, createMarkerColor(1.0, 0.0, 0.42, 0.2)));
621623
}
622624

623625
return msg;

planning/behavior_path_avoidance_module/src/scene.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ bool AvoidanceModule::isSafePath(
738738
const auto hysteresis_factor = safe_ ? 1.0 : parameters_->hysteresis_factor_expand_rate;
739739

740740
const auto safety_check_target_objects = utils::avoidance::getSafetyCheckTargetObjects(
741-
avoid_data_, planner_data_, parameters_, is_right_shift.value());
741+
avoid_data_, planner_data_, parameters_, is_right_shift.value(), debug);
742742

743743
for (const auto & object : safety_check_target_objects) {
744744
auto current_debug_data = utils::path_safety_checker::createObjectDebug(object);

planning/behavior_path_avoidance_module/src/utils.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -1654,12 +1654,12 @@ lanelet::ConstLanelets getAdjacentLane(
16541654

16551655
lanelet::ConstLanelets lanes{};
16561656
for (const auto & lane : ego_succeeding_lanes) {
1657-
const auto opt_left_lane = rh->getLeftLanelet(lane);
1657+
const auto opt_left_lane = rh->getLeftLanelet(lane, true, false);
16581658
if (!is_right_shift && opt_left_lane) {
16591659
lanes.push_back(opt_left_lane.value());
16601660
}
16611661

1662-
const auto opt_right_lane = rh->getRightLanelet(lane);
1662+
const auto opt_right_lane = rh->getRightLanelet(lane, true, false);
16631663
if (is_right_shift && opt_right_lane) {
16641664
lanes.push_back(opt_right_lane.value());
16651665
}
@@ -1675,7 +1675,8 @@ lanelet::ConstLanelets getAdjacentLane(
16751675

16761676
std::vector<ExtendedPredictedObject> getSafetyCheckTargetObjects(
16771677
const AvoidancePlanningData & data, const std::shared_ptr<const PlannerData> & planner_data,
1678-
const std::shared_ptr<AvoidanceParameters> & parameters, const bool is_right_shift)
1678+
const std::shared_ptr<AvoidanceParameters> & parameters, const bool is_right_shift,
1679+
DebugData & debug)
16791680
{
16801681
const auto & p = parameters;
16811682
const auto check_right_lanes =
@@ -1733,6 +1734,9 @@ std::vector<ExtendedPredictedObject> getSafetyCheckTargetObjects(
17331734
utils::path_safety_checker::isCentroidWithinLanelet);
17341735
append(targets);
17351736
}
1737+
1738+
debug.safety_check_lanes.insert(
1739+
debug.safety_check_lanes.end(), check_lanes.begin(), check_lanes.end());
17361740
}
17371741

17381742
// check left lanes
@@ -1752,6 +1756,9 @@ std::vector<ExtendedPredictedObject> getSafetyCheckTargetObjects(
17521756
utils::path_safety_checker::isCentroidWithinLanelet);
17531757
append(targets);
17541758
}
1759+
1760+
debug.safety_check_lanes.insert(
1761+
debug.safety_check_lanes.end(), check_lanes.begin(), check_lanes.end());
17551762
}
17561763

17571764
// check current lanes
@@ -1771,6 +1778,9 @@ std::vector<ExtendedPredictedObject> getSafetyCheckTargetObjects(
17711778
utils::path_safety_checker::isCentroidWithinLanelet);
17721779
append(targets);
17731780
}
1781+
1782+
debug.safety_check_lanes.insert(
1783+
debug.safety_check_lanes.end(), check_lanes.begin(), check_lanes.end());
17741784
}
17751785

17761786
return target_objects;

0 commit comments

Comments
 (0)