From ea715b75edab8a869ce61a7ba8f8d8de6cc26cbc Mon Sep 17 00:00:00 2001 From: kechxu Date: Wed, 12 Jun 2019 15:03:34 -0700 Subject: [PATCH] Prediction: use free move predictor for slow obstacles --- modules/prediction/common/prediction_gflags.cc | 2 ++ modules/prediction/common/prediction_gflags.h | 1 + modules/prediction/container/obstacles/obstacle.cc | 5 +++++ modules/prediction/container/obstacles/obstacle.h | 6 ++++++ modules/prediction/predictor/predictor_manager.cc | 5 ++++- 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/prediction/common/prediction_gflags.cc b/modules/prediction/common/prediction_gflags.cc index b6454b57b0..7ff4cb45c1 100644 --- a/modules/prediction/common/prediction_gflags.cc +++ b/modules/prediction/common/prediction_gflags.cc @@ -108,6 +108,8 @@ DEFINE_double(still_pedestrian_position_std, 0.5, "Position standard deviation for still pedestrians"); DEFINE_double(still_unknown_position_std, 0.5, "Position standard deviation for still unknown obstacles"); +DEFINE_double(slow_obstacle_speed_threshold, 2.0, + "Speed threshold for slow obstacles"); DEFINE_double(max_history_time, 7.0, "Obstacles' maximal historical time."); DEFINE_double(target_lane_gap, 2.0, "Gap between two lane points."); DEFINE_double(dense_lane_gap, 0.2, diff --git a/modules/prediction/common/prediction_gflags.h b/modules/prediction/common/prediction_gflags.h index 76582aaff8..e4ea013404 100644 --- a/modules/prediction/common/prediction_gflags.h +++ b/modules/prediction/common/prediction_gflags.h @@ -72,6 +72,7 @@ DECLARE_double(still_unknown_speed_threshold); DECLARE_double(still_obstacle_position_std); DECLARE_double(still_pedestrian_position_std); DECLARE_double(still_unknown_position_std); +DECLARE_double(slow_obstacle_speed_threshold); DECLARE_double(max_history_time); DECLARE_double(target_lane_gap); DECLARE_double(dense_lane_gap); diff --git a/modules/prediction/container/obstacles/obstacle.cc b/modules/prediction/container/obstacles/obstacle.cc index 7725cbee94..abe36542d3 100644 --- a/modules/prediction/container/obstacles/obstacle.cc +++ b/modules/prediction/container/obstacles/obstacle.cc @@ -100,6 +100,11 @@ bool Obstacle::IsStill() { return true; } +bool Obstacle::IsSlow() { + const Feature& feature = latest_feature(); + return feature.speed() < FLAGS_slow_obstacle_speed_threshold; +} + bool Obstacle::IsOnLane() const { if (feature_history_.size() > 0) { if (feature_history_.front().has_lane() && diff --git a/modules/prediction/container/obstacles/obstacle.h b/modules/prediction/container/obstacles/obstacle.h index 8828016871..a45a8ba274 100644 --- a/modules/prediction/container/obstacles/obstacle.h +++ b/modules/prediction/container/obstacles/obstacle.h @@ -151,6 +151,12 @@ class Obstacle { */ bool IsStill(); + /** + * @brief Check if the obstacle is slow. + * @return If the obstacle is slow. + */ + bool IsSlow(); + /** * @brief Check if the obstacle is on any lane. * @return If the obstacle is on any lane. diff --git a/modules/prediction/predictor/predictor_manager.cc b/modules/prediction/predictor/predictor_manager.cc index 9f238e9930..e0295c320d 100644 --- a/modules/prediction/predictor/predictor_manager.cc +++ b/modules/prediction/predictor/predictor_manager.cc @@ -270,7 +270,10 @@ void PredictorManager::PredictObstacle( } else { switch (obstacle->type()) { case PerceptionObstacle::VEHICLE: { - if (obstacle->HasJunctionFeatureWithExits() && + if (obstacle->IsSlow()) { + predictor = GetPredictor(ObstacleConf::FREE_MOVE_PREDICTOR); + CHECK_NOTNULL(predictor); + } else if (obstacle->HasJunctionFeatureWithExits() && !obstacle->IsCloseToJunctionExit()) { predictor = GetPredictor(vehicle_in_junction_predictor_); CHECK_NOTNULL(predictor); -- GitLab