File tree 1 file changed +10
-1
lines changed
planning/behavior_path_avoidance_module/src
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -321,10 +321,19 @@ void AvoidanceModule::fillAvoidanceTargetObjects(
321
321
using utils::avoidance::getTargetLanelets;
322
322
using utils::avoidance::separateObjectsByPath;
323
323
using utils::avoidance::updateRoadShoulderDistance;
324
+ using utils::traffic_light::calcDistanceToRedTrafficLight;
324
325
325
326
// Separate dynamic objects based on whether they are inside or outside of the expanded lanelets.
326
327
constexpr double MARGIN = 10.0 ;
327
- const auto forward_detection_range = helper_->getForwardDetectionRange ();
328
+ const auto forward_detection_range = [&]() {
329
+ const auto to_traffic_light = calcDistanceToRedTrafficLight (
330
+ data.current_lanelets , helper_->getPreviousReferencePath (), planner_data_);
331
+ if (!to_traffic_light.has_value ()) {
332
+ return helper_->getForwardDetectionRange ();
333
+ }
334
+ return std::min (helper_->getForwardDetectionRange (), to_traffic_light.value ());
335
+ }();
336
+
328
337
const auto [object_within_target_lane, object_outside_target_lane] = separateObjectsByPath (
329
338
helper_->getPreviousReferencePath (), helper_->getPreviousSplineShiftPath ().path , planner_data_,
330
339
data, parameters_, forward_detection_range + MARGIN, debug);
You can’t perform that action at this time.
0 commit comments