Skip to content

Commit

Permalink
routing/planning: reduce min_length_for_lane_change to 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
ycool authored and startcode committed Dec 7, 2017
1 parent b215a71 commit 44f4a8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions modules/planning/conf/planning.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
--noenable_spiral_reference_line
--noprioritize_change_lane
--enable_reference_line_stitching
--min_length_for_lane_change=5.0
2 changes: 1 addition & 1 deletion modules/routing/conf/routing.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 10 additions & 8 deletions modules/routing/strategy/a_star_strategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <queue>

#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"
Expand All @@ -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<double>::max();
Expand Down Expand Up @@ -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;
Expand All @@ -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 =
Expand All @@ -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
Expand Down

0 comments on commit 44f4a8f

Please sign in to comment.