From 96f2bab52c3474505fc576557512942b7d41debd Mon Sep 17 00:00:00 2001 From: kechxu Date: Thu, 7 Nov 2019 15:08:59 -0800 Subject: [PATCH] Prediction: move a gflag to a constant in prioritization --- modules/prediction/common/prediction_gflags.cc | 2 -- modules/prediction/common/prediction_gflags.h | 1 - .../prioritization/obstacles_prioritizer.cc | 16 +++++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/modules/prediction/common/prediction_gflags.cc b/modules/prediction/common/prediction_gflags.cc index 1a83ccf430a..ce33fc0c083 100644 --- a/modules/prediction/common/prediction_gflags.cc +++ b/modules/prediction/common/prediction_gflags.cc @@ -76,8 +76,6 @@ DEFINE_double(caution_search_distance_backward_for_overlap, 30.0, "in the case of overlap"); DEFINE_double(caution_pedestrian_approach_time, 3.0, "The time for a pedestrian to approach adc trajectory"); -DEFINE_double(caution_distance_threshold, 60.0, - "The distance threshold for obstacles to be caution"); // Obstacle features DEFINE_int32(ego_vehicle_id, -1, "The obstacle ID of the ego vehicle."); diff --git a/modules/prediction/common/prediction_gflags.h b/modules/prediction/common/prediction_gflags.h index 63deb686c09..0830df11e24 100644 --- a/modules/prediction/common/prediction_gflags.h +++ b/modules/prediction/common/prediction_gflags.h @@ -54,7 +54,6 @@ DECLARE_double(caution_search_distance_backward); DECLARE_double(caution_search_distance_backward_for_merge); DECLARE_double(caution_search_distance_backward_for_overlap); DECLARE_double(caution_pedestrian_approach_time); -DECLARE_double(caution_distance_threshold); // Obstacle features DECLARE_int32(ego_vehicle_id); diff --git a/modules/prediction/scenario/prioritization/obstacles_prioritizer.cc b/modules/prediction/scenario/prioritization/obstacles_prioritizer.cc index c1ca86bf3aa..eb54c941fb4 100644 --- a/modules/prediction/scenario/prioritization/obstacles_prioritizer.cc +++ b/modules/prediction/scenario/prioritization/obstacles_prioritizer.cc @@ -42,6 +42,8 @@ using hdmap::LaneInfo; using hdmap::OverlapInfo; using ConstLaneInfoPtr = std::shared_ptr; +constexpr double kCautionDistanceThreshold = 60.0; + namespace { bool IsLaneSequenceInReferenceLine( @@ -214,7 +216,7 @@ void ObstaclesPrioritizer::AssignCautionLevelInJunction( continue; } if (obstacle_ptr->IsInJunction(curr_junction_id)) { - SetCautionIfCloseToEgo(ego_vehicle, FLAGS_caution_distance_threshold, + SetCautionIfCloseToEgo(ego_vehicle, kCautionDistanceThreshold, obstacle_ptr); } } @@ -236,7 +238,7 @@ void ObstaclesPrioritizer::AssignCautionLevelCruiseKeepLane( AERROR << "Obstacle [" << nearest_front_obstacle_id << "] Not found"; continue; } - SetCautionIfCloseToEgo(ego_vehicle, FLAGS_caution_distance_threshold, + SetCautionIfCloseToEgo(ego_vehicle, kCautionDistanceThreshold, obstacle_ptr); } } @@ -261,7 +263,7 @@ void ObstaclesPrioritizer::AssignCautionLevelCruiseChangeLane( AERROR << "Obstacle [" << nearest_front_obstacle_id << "] Not found"; continue; } - SetCautionIfCloseToEgo(ego_vehicle, FLAGS_caution_distance_threshold, + SetCautionIfCloseToEgo(ego_vehicle, kCautionDistanceThreshold, obstacle_ptr); } else if (IsLaneSequenceInReferenceLine(lane_sequence, ego_trajectory_container)) { @@ -273,7 +275,7 @@ void ObstaclesPrioritizer::AssignCautionLevelCruiseChangeLane( Obstacle* front_obstacle_ptr = obstacles_container->GetObstacle(nearest_front_obstacle_id); if (front_obstacle_ptr != nullptr) { - SetCautionIfCloseToEgo(ego_vehicle, FLAGS_caution_distance_threshold, + SetCautionIfCloseToEgo(ego_vehicle, kCautionDistanceThreshold, front_obstacle_ptr); } } @@ -281,7 +283,7 @@ void ObstaclesPrioritizer::AssignCautionLevelCruiseChangeLane( Obstacle* backward_obstacle_ptr = obstacles_container->GetObstacle(nearest_backward_obstacle_id); if (backward_obstacle_ptr != nullptr) { - SetCautionIfCloseToEgo(ego_vehicle, FLAGS_caution_distance_threshold, + SetCautionIfCloseToEgo(ego_vehicle, kCautionDistanceThreshold, backward_obstacle_ptr); } } @@ -414,7 +416,7 @@ void ObstaclesPrioritizer::AssignCautionLevelByEgoReferenceLine( if (std::fabs(start_l) < FLAGS_pedestrian_nearby_lane_search_radius || std::fabs(end_l) < FLAGS_pedestrian_nearby_lane_search_radius || start_l * end_l < 0.0) { - SetCautionIfCloseToEgo(ego_vehicle, FLAGS_caution_distance_threshold, + SetCautionIfCloseToEgo(ego_vehicle, kCautionDistanceThreshold, obstacle_ptr); } } @@ -509,7 +511,7 @@ void ObstaclesPrioritizer::SetCautionBackward( AERROR << "Obstacle [" << obstacle_id << "] Not found"; continue; } - SetCautionIfCloseToEgo(ego_vehicle, FLAGS_caution_distance_threshold, + SetCautionIfCloseToEgo(ego_vehicle, kCautionDistanceThreshold, obstacle_ptr); continue; }