Take stop signs into account during routing
This commit is contained in:
parent
eb72ca4941
commit
a7142ee737
@ -77,8 +77,8 @@ struct ExtractionTurn
|
||||
const std::vector<ExtractionTurnLeg> &roads_on_the_right,
|
||||
const std::vector<ExtractionTurnLeg> &roads_on_the_left)
|
||||
: angle(180. - angle), number_of_roads(number_of_roads), is_u_turn(is_u_turn),
|
||||
has_traffic_light(has_traffic_light), has_stop_sign(has_stop_sign), has_give_way_sign(has_give_way_sign),
|
||||
is_left_hand_driving(is_left_hand_driving),
|
||||
has_traffic_light(has_traffic_light), has_stop_sign(has_stop_sign),
|
||||
has_give_way_sign(has_give_way_sign), is_left_hand_driving(is_left_hand_driving),
|
||||
|
||||
source_restricted(source_restricted), source_mode(source_mode),
|
||||
source_is_motorway(source_is_motorway), source_is_link(source_is_link),
|
||||
|
@ -55,9 +55,10 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(
|
||||
: m_edge_based_node_container(node_data_container), m_connectivity_checksum(0),
|
||||
m_number_of_edge_based_nodes(0), m_coordinates(coordinates),
|
||||
m_node_based_graph(node_based_graph), m_barrier_nodes(barrier_nodes),
|
||||
m_traffic_signals(traffic_signals), m_stop_signs(stop_signs), m_give_way_signs(give_way_signs),
|
||||
m_compressed_edge_container(compressed_edge_container), name_table(name_table),
|
||||
segregated_edges(segregated_edges), lane_description_map(lane_description_map)
|
||||
m_traffic_signals(traffic_signals), m_stop_signs(stop_signs),
|
||||
m_give_way_signs(give_way_signs), m_compressed_edge_container(compressed_edge_container),
|
||||
name_table(name_table), segregated_edges(segregated_edges),
|
||||
lane_description_map(lane_description_map)
|
||||
{
|
||||
}
|
||||
|
||||
@ -634,7 +635,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
const auto is_traffic_light = m_traffic_signals.Has(from_node, intersection_node);
|
||||
const auto is_stop_sign = m_stop_signs.Has(from_node, intersection_node);
|
||||
const auto is_give_way_sign = m_give_way_signs.Has(from_node, intersection_node);
|
||||
|
||||
|
||||
const auto is_uturn =
|
||||
guidance::getTurnDirection(turn_angle) == guidance::DirectionModifier::UTurn;
|
||||
|
||||
|
@ -220,8 +220,6 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
const bool has_forward_give_way_sign = give_way_signs.Has(node_u, node_v);
|
||||
const bool has_reverse_give_way_sign = give_way_signs.Has(node_w, node_v);
|
||||
|
||||
|
||||
|
||||
EdgeDuration forward_node_duration_penalty = MAXIMAL_EDGE_DURATION;
|
||||
EdgeWeight forward_node_weight_penalty = INVALID_EDGE_WEIGHT;
|
||||
EdgeDuration reverse_node_duration_penalty = MAXIMAL_EDGE_DURATION;
|
||||
@ -241,7 +239,8 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
false,
|
||||
has_forward_signal || has_reverse_signal,
|
||||
has_forward_stop_sign || has_reverse_stop_sign,
|
||||
has_forward_give_way_sign || has_reverse_give_way_sign,
|
||||
has_forward_give_way_sign ||
|
||||
has_reverse_give_way_sign,
|
||||
false,
|
||||
false,
|
||||
TRAVEL_MODE_DRIVING,
|
||||
@ -265,21 +264,25 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
roads_on_the_left);
|
||||
scripting_environment.ProcessTurn(extraction_turn);
|
||||
|
||||
auto update_direction_penalty =
|
||||
[&extraction_turn, weight_multiplier](bool has_traffic_control_node,
|
||||
EdgeDuration &duration_penalty,
|
||||
EdgeWeight &weight_penalty) {
|
||||
if (has_traffic_control_node)
|
||||
{
|
||||
duration_penalty = to_alias<EdgeDuration>(extraction_turn.duration * SECOND_TO_DECISECOND);
|
||||
weight_penalty = to_alias<EdgeWeight>(extraction_turn.weight * weight_multiplier);
|
||||
}
|
||||
};
|
||||
auto update_direction_penalty = [&extraction_turn, weight_multiplier](
|
||||
bool has_traffic_control_node,
|
||||
EdgeDuration &duration_penalty,
|
||||
EdgeWeight &weight_penalty) {
|
||||
if (has_traffic_control_node)
|
||||
{
|
||||
duration_penalty = to_alias<EdgeDuration>(extraction_turn.duration *
|
||||
SECOND_TO_DECISECOND);
|
||||
weight_penalty =
|
||||
to_alias<EdgeWeight>(extraction_turn.weight * weight_multiplier);
|
||||
}
|
||||
};
|
||||
|
||||
update_direction_penalty(has_forward_signal || has_forward_stop_sign || has_forward_give_way_sign,
|
||||
update_direction_penalty(has_forward_signal || has_forward_stop_sign ||
|
||||
has_forward_give_way_sign,
|
||||
forward_node_duration_penalty,
|
||||
forward_node_weight_penalty);
|
||||
update_direction_penalty(has_reverse_signal || has_reverse_stop_sign || has_reverse_give_way_sign,
|
||||
update_direction_penalty(has_reverse_signal || has_reverse_stop_sign ||
|
||||
has_reverse_give_way_sign,
|
||||
reverse_node_duration_penalty,
|
||||
reverse_node_weight_penalty);
|
||||
}
|
||||
|
@ -32,8 +32,12 @@ NodeBasedGraphFactory::NodeBasedGraphFactory(
|
||||
coordinates(std::move(coordinates)), osm_node_ids(std::move(osm_node_ids))
|
||||
{
|
||||
BuildCompressedOutputGraph(edge_list);
|
||||
Compress(
|
||||
scripting_environment, turn_restrictions, maneuver_overrides, traffic_signals, stop_signs, give_way_signs);
|
||||
Compress(scripting_environment,
|
||||
turn_restrictions,
|
||||
maneuver_overrides,
|
||||
traffic_signals,
|
||||
stop_signs,
|
||||
give_way_signs);
|
||||
CompressGeometry();
|
||||
CompressAnnotationData();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user