From 4487e147ab2c195879c988f635fa1c6ee5eaebc6 Mon Sep 17 00:00:00 2001 From: jmtao Date: Thu, 7 Nov 2019 15:56:17 -0800 Subject: [PATCH] planning: remove a redundant status from pull_over_status PlanningContext --- modules/planning/proto/planning_status.proto | 13 ++++++------- modules/planning/scenarios/scenario_manager.cc | 2 +- modules/planning/scenarios/util/util.cc | 15 +++++++++------ .../path_bounds_decider/path_bounds_decider.cc | 6 +----- modules/planning/traffic_rules/destination.cc | 2 +- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/modules/planning/proto/planning_status.proto b/modules/planning/proto/planning_status.proto index 19f04ade28a..38e3b2f9a9d 100644 --- a/modules/planning/proto/planning_status.proto +++ b/modules/planning/proto/planning_status.proto @@ -96,13 +96,12 @@ message PullOverStatus { } optional PullOverType pull_over_type = 1; optional bool plan_pull_over_path = 2 [default = false]; - optional bool is_feasible = 3 [default = false]; // default must be false - optional apollo.common.PointENU position = 4; - optional double theta = 5; - optional double length_front = 6; - optional double length_back = 7; - optional double width_left = 8; - optional double width_right = 9; + optional apollo.common.PointENU position = 3; + optional double theta = 4; + optional double length_front = 5; + optional double length_back = 6; + optional double width_left = 7; + optional double width_right = 8; } message ReroutingStatus { diff --git a/modules/planning/scenarios/scenario_manager.cc b/modules/planning/scenarios/scenario_manager.cc index a8ecd4f29b4..0918e00bb40 100644 --- a/modules/planning/scenarios/scenario_manager.cc +++ b/modules/planning/scenarios/scenario_manager.cc @@ -209,7 +209,7 @@ ScenarioConfig::ScenarioType ScenarioManager::SelectPullOverScenario( const auto& pull_over_status = PlanningContext::Instance()->planning_status().pull_over(); if (adc_distance_to_dest < scenario_config.max_distance_stop_search() && - !pull_over_status.is_feasible()) { + !pull_over_status.has_position()) { pull_over_scenario = false; } } diff --git a/modules/planning/scenarios/util/util.cc b/modules/planning/scenarios/util/util.cc index 53dfef9df45..545a91c1472 100644 --- a/modules/planning/scenarios/util/util.cc +++ b/modules/planning/scenarios/util/util.cc @@ -84,9 +84,10 @@ PullOverStatus CheckADCPullOver(const ReferenceLineInfo& reference_line_info, const ScenarioPullOverConfig& scenario_config) { const auto& pull_over_status = PlanningContext::Instance()->planning_status().pull_over(); - if (!pull_over_status.is_feasible() || !pull_over_status.has_position() || + if (!pull_over_status.has_position() || !pull_over_status.position().has_x() || - !pull_over_status.position().has_y() || !pull_over_status.has_theta()) { + !pull_over_status.position().has_y() || + !pull_over_status.has_theta()) { ADEBUG << "pull_over status not set properly: " << pull_over_status.DebugString(); return UNKNOWN; @@ -145,9 +146,10 @@ PullOverStatus CheckADCPullOverPathPoint( const common::PathPoint& path_point) { const auto& pull_over_status = PlanningContext::Instance()->planning_status().pull_over(); - if (!pull_over_status.is_feasible() || !pull_over_status.has_position() || + if (!pull_over_status.has_position() || !pull_over_status.position().has_x() || - !pull_over_status.position().has_y() || !pull_over_status.has_theta()) { + !pull_over_status.position().has_y() || + !pull_over_status.has_theta()) { ADEBUG << "pull_over status not set properly: " << pull_over_status.DebugString(); return UNKNOWN; @@ -167,9 +169,10 @@ PullOverStatus CheckADCPullOverOpenSpace( const ScenarioPullOverConfig& scenario_config) { const auto& pull_over_status = PlanningContext::Instance()->planning_status().pull_over(); - if (!pull_over_status.is_feasible() || !pull_over_status.has_position() || + if (!pull_over_status.has_position() || !pull_over_status.position().has_x() || - !pull_over_status.position().has_y() || !pull_over_status.has_theta()) { + !pull_over_status.position().has_y() || + !pull_over_status.has_theta()) { ADEBUG << "pull_over status not set properly: " << pull_over_status.DebugString(); return UNKNOWN; diff --git a/modules/planning/tasks/deciders/path_bounds_decider/path_bounds_decider.cc b/modules/planning/tasks/deciders/path_bounds_decider/path_bounds_decider.cc index 0560e8386fb..2e393447e4f 100644 --- a/modules/planning/tasks/deciders/path_bounds_decider/path_bounds_decider.cc +++ b/modules/planning/tasks/deciders/path_bounds_decider/path_bounds_decider.cc @@ -423,8 +423,7 @@ Status PathBoundsDecider::GeneratePullOverPathBound( ->mutable_pull_over(); // If already found a pull-over position, simply check if it's valid. int curr_idx = -1; - if (pull_over_status->is_feasible() && - pull_over_status->has_position()) { + if (pull_over_status->has_position()) { curr_idx = IsPointWithinPathBound( reference_line_info, pull_over_status->position().x(), pull_over_status->position().y(), *path_bound); @@ -440,8 +439,6 @@ Status PathBoundsDecider::GeneratePullOverPathBound( std::tuple pull_over_configuration; if (!SearchPullOverPosition(frame, reference_line_info, *path_bound, &pull_over_configuration)) { - pull_over_status->set_is_feasible(false); - const std::string msg = "Failed to find a proper pull-over position."; AERROR << msg; return Status(ErrorCode::PLANNING_ERROR, msg); @@ -450,7 +447,6 @@ Status PathBoundsDecider::GeneratePullOverPathBound( curr_idx = std::get<3>(pull_over_configuration); // If have found a pull-over position, update planning-context - pull_over_status->set_is_feasible(true); pull_over_status->mutable_position()->set_x( std::get<0>(pull_over_configuration)); pull_over_status->mutable_position()->set_y( diff --git a/modules/planning/traffic_rules/destination.cc b/modules/planning/traffic_rules/destination.cc index 6348e78c616..9af9dc0fd87 100644 --- a/modules/planning/traffic_rules/destination.cc +++ b/modules/planning/traffic_rules/destination.cc @@ -84,7 +84,7 @@ int Destination::MakeDecisions(Frame* frame, if (FLAGS_enable_scenario_pull_over) { const auto& pull_over_status = PlanningContext::Instance()->planning_status().pull_over(); - if (pull_over_status.is_feasible() && pull_over_status.has_position() && + if (pull_over_status.has_position() && pull_over_status.position().has_x() && pull_over_status.position().has_y()) { // build stop decision based on pull-over position