@@ -94,12 +94,6 @@ int NearestBackwardObstacleIdOnLaneSequence(const LaneSequence& lane_sequence) {
9494
9595ObstaclesPrioritizer::ObstaclesPrioritizer () {}
9696
97- void ObstaclesPrioritizer::PrioritizeObstacles () {
98- ego_back_lane_id_set_.clear ();
99- AssignIgnoreLevel ();
100- AssignCautionLevel ();
101- }
102-
10397void ObstaclesPrioritizer::AssignIgnoreLevel () {
10498 auto obstacles_container =
10599 ContainerManager::Instance ()->GetContainer <ObstaclesContainer>(
@@ -177,7 +171,7 @@ void ObstaclesPrioritizer::AssignIgnoreLevel() {
177171 obstacles_container->SetConsideredObstacleIds ();
178172}
179173
180- void ObstaclesPrioritizer::AssignCautionLevel () {
174+ void ObstaclesPrioritizer::AssignCautionLevel (const Scenario& scenario ) {
181175 auto obstacles_container =
182176 ContainerManager::Instance ()->GetContainer <ObstaclesContainer>(
183177 AdapterConfig::PERCEPTION_OBSTACLES);
@@ -196,16 +190,19 @@ void ObstaclesPrioritizer::AssignCautionLevel() {
196190 return ;
197191 }
198192
199- // AssignCautionLevelInJunction(*ego_vehicle, obstacles_container);
193+ if (scenario.type () == Scenario::JUNCTION && scenario.has_junction_id ()) {
194+ AssignCautionLevelInJunction (*ego_vehicle, obstacles_container,
195+ scenario.junction_id ());
196+ }
200197 AssignCautionLevelCruiseKeepLane (*ego_vehicle, obstacles_container);
201198 AssignCautionLevelCruiseChangeLane (*ego_vehicle, obstacles_container);
202199 AssignCautionLevelByEgoReferenceLine (*ego_vehicle, obstacles_container);
203200}
204201
205202void ObstaclesPrioritizer::AssignCautionLevelInJunction (
206- const Obstacle& ego_vehicle, ObstaclesContainer* obstacles_container) {
203+ const Obstacle& ego_vehicle, ObstaclesContainer* obstacles_container,
204+ const std::string& junction_id) {
207205 // TODO(Hongyi): get current junction_id from Storytelling
208- std::string curr_junction_id;
209206 const auto & obstacle_ids =
210207 obstacles_container->curr_frame_movable_obstacle_ids ();
211208 for (const int obstacle_id : obstacle_ids) {
@@ -214,7 +211,7 @@ void ObstaclesPrioritizer::AssignCautionLevelInJunction(
214211 AERROR << " Null obstacle pointer found." ;
215212 continue ;
216213 }
217- if (obstacle_ptr->IsInJunction (curr_junction_id )) {
214+ if (obstacle_ptr->IsInJunction (junction_id )) {
218215 SetCautionIfCloseToEgo (ego_vehicle, kCautionDistanceThreshold ,
219216 obstacle_ptr);
220217 }
@@ -385,10 +382,12 @@ void ObstaclesPrioritizer::AssignCautionLevelByEgoReferenceLine(
385382 }
386383 double start_x = latest_feature_ptr->position ().x ();
387384 double start_y = latest_feature_ptr->position ().y ();
388- double end_x = start_x + FLAGS_caution_pedestrian_approach_time *
389- latest_feature_ptr->raw_velocity ().x ();
390- double end_y = start_y + FLAGS_caution_pedestrian_approach_time *
391- latest_feature_ptr->raw_velocity ().y ();
385+ double end_x = start_x +
386+ FLAGS_caution_pedestrian_approach_time *
387+ latest_feature_ptr->raw_velocity ().x ();
388+ double end_y = start_y +
389+ FLAGS_caution_pedestrian_approach_time *
390+ latest_feature_ptr->raw_velocity ().y ();
392391 std::vector<std::string> nearby_lane_ids = PredictionMap::NearbyLaneIds (
393392 {start_x, start_y}, FLAGS_pedestrian_nearby_lane_search_radius);
394393 if (nearby_lane_ids.empty ()) {
0 commit comments