From 44f4a8f12ce0ae24c3fa3eb5a09cd9b264318662 Mon Sep 17 00:00:00 2001 From: Jiangtao Hu Date: Wed, 6 Dec 2017 16:28:31 -0800 Subject: [PATCH] routing/planning: reduce min_length_for_lane_change to 5. --- modules/planning/conf/planning.conf | 1 + modules/routing/conf/routing.conf | 2 +- modules/routing/strategy/a_star_strategy.cc | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/planning/conf/planning.conf b/modules/planning/conf/planning.conf index d2b20a22d01..88a2ff8a11b 100644 --- a/modules/planning/conf/planning.conf +++ b/modules/planning/conf/planning.conf @@ -4,3 +4,4 @@ --noenable_spiral_reference_line --noprioritize_change_lane --enable_reference_line_stitching +--min_length_for_lane_change=5.0 \ No newline at end of file diff --git a/modules/routing/conf/routing.conf b/modules/routing/conf/routing.conf index 4b1269cb7cd..0cda2f518cc 100644 --- a/modules/routing/conf/routing.conf +++ b/modules/routing/conf/routing.conf @@ -2,5 +2,5 @@ --routing_conf_file=modules/routing/conf/routing_config.pb.txt --use_road_id=false ---min_length_for_lane_change=30.48 +--min_length_for_lane_change=5.0 --enable_change_lane_in_result diff --git a/modules/routing/strategy/a_star_strategy.cc b/modules/routing/strategy/a_star_strategy.cc index b3d04bc871c..12a9170695f 100644 --- a/modules/routing/strategy/a_star_strategy.cc +++ b/modules/routing/strategy/a_star_strategy.cc @@ -21,6 +21,7 @@ #include #include "modules/common/log.h" +#include "modules/routing/common/routing_gflags.h" #include "modules/routing/graph/sub_topo_graph.h" #include "modules/routing/graph/topo_graph.h" #include "modules/routing/graph/topo_node.h" @@ -30,8 +31,6 @@ namespace apollo { namespace routing { namespace { -constexpr double LANE_CHANGE_SKIP_S = 10.0; - struct SearchNode { const TopoNode* topo_node = nullptr; double f = std::numeric_limits::max(); @@ -264,9 +263,11 @@ bool AStarStrategy::Search(const TopoGraph* graph, } closed_set_.emplace(from_node); - // if residual_s is less than LANE_CHANGE_SKIP_S, only move forward + // if residual_s is less than FLAGS_min_length_for_lane_change, only move + // forward const auto& neighbor_edges = - (GetResidualS(from_node) > LANE_CHANGE_SKIP_S && change_lane_enabled_) + (GetResidualS(from_node) > FLAGS_min_length_for_lane_change && + change_lane_enabled_) ? from_node->OutToAllEdge() : from_node->OutToSucEdge(); double tentative_g_score = 0.0; @@ -282,7 +283,7 @@ bool AStarStrategy::Search(const TopoGraph* graph, if (closed_set_.count(to_node) == 1) { continue; } - if (GetResidualS(edge, to_node) < LANE_CHANGE_SKIP_S) { + if (GetResidualS(edge, to_node) < FLAGS_min_length_for_lane_change) { continue; } tentative_g_score = @@ -299,9 +300,10 @@ bool AStarStrategy::Search(const TopoGraph* graph, if (edge->Type() == TopoEdgeType::TET_FORWARD) { enter_s_[to_node] = to_node->StartS(); } else { - // else, add enter_s with LANE_CHANGE_SKIP_S - double to_node_enter_s = (enter_s_[from_node] + LANE_CHANGE_SKIP_S) / - from_node->Length() * to_node->Length(); + // else, add enter_s with FLAGS_min_length_for_lane_change + double to_node_enter_s = + (enter_s_[from_node] + FLAGS_min_length_for_lane_change) / + from_node->Length() * to_node->Length(); // enter s could be larger than end_s but should be less than length to_node_enter_s = std::min(to_node_enter_s, to_node->Length()); // if enter_s is larger than end_s and to_node is dest_node