Skip to content

Commit

Permalink
planning: remove a redundant status from pull_over_status PlanningCon…
Browse files Browse the repository at this point in the history
…text
  • Loading branch information
jmtao authored and xiaoxq committed Nov 8, 2019
1 parent 22a5150 commit 4487e14
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
13 changes: 6 additions & 7 deletions modules/planning/proto/planning_status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion modules/planning/scenarios/scenario_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
15 changes: 9 additions & 6 deletions modules/planning/scenarios/util/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -440,8 +439,6 @@ Status PathBoundsDecider::GeneratePullOverPathBound(
std::tuple<double, double, double, int> 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);
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion modules/planning/traffic_rules/destination.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4487e14

Please sign in to comment.