Skip to content

Commit

Permalink
Prediction: move a gflag to a constant in prioritization
Browse files Browse the repository at this point in the history
  • Loading branch information
kechxu authored and xiaoxq committed Nov 8, 2019
1 parent a1cda72 commit 96f2bab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 0 additions & 2 deletions modules/prediction/common/prediction_gflags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
1 change: 0 additions & 1 deletion modules/prediction/common/prediction_gflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ using hdmap::LaneInfo;
using hdmap::OverlapInfo;
using ConstLaneInfoPtr = std::shared_ptr<const LaneInfo>;

constexpr double kCautionDistanceThreshold = 60.0;

namespace {

bool IsLaneSequenceInReferenceLine(
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand All @@ -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)) {
Expand All @@ -273,15 +275,15 @@ 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);
}
}
if (nearest_backward_obstacle_id >= 0) {
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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 96f2bab

Please sign in to comment.