fix obvious turn collapsing for straight turns
This commit is contained in:
parent
0e4061f858
commit
f4db79fe9b
@ -1,3 +1,8 @@
|
|||||||
|
# 5.3.0
|
||||||
|
Changes from 5.3.0-rc.2
|
||||||
|
- Guidance
|
||||||
|
- Improved detection of obvious turns
|
||||||
|
|
||||||
# 5.3.0 RC2
|
# 5.3.0 RC2
|
||||||
Changes from 5.3.0-rc.1
|
Changes from 5.3.0-rc.1
|
||||||
- Bugfixes
|
- Bugfixes
|
||||||
|
@ -606,13 +606,13 @@ Feature: Collapse
|
|||||||
| restriction | bc | fdcg | c | no_right_turn |
|
| restriction | bc | fdcg | c | no_right_turn |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,g | road,cross,cross | depart,turn left,arrive |
|
| a,g | road,cross,cross | depart,turn left,arrive |
|
||||||
| a,e | road,road,road | depart,continue slight right,arrive |
|
| a,e | road,road,road | depart,continue slight right,arrive |
|
||||||
# We should discuss whether the next item should be collapsed to depart,turn right,arrive.
|
# We should discuss whether the next item should be collapsed to depart,turn right,arrive.
|
||||||
| a,f | road,road,cross,cross | depart,continue slight right,turn right,arrive |
|
| a,f | road,road,cross,cross | depart,continue slight right,turn right,arrive |
|
||||||
|
|
||||||
Scenario: On-Off on Highway
|
Scenario: On-Off on Highway
|
||||||
Given the node map
|
Given the node map
|
||||||
| f | | | |
|
| f | | | |
|
||||||
| a | b | c | d |
|
| a | b | c | d |
|
||||||
|
@ -853,3 +853,29 @@ Feature: Simple Turns
|
|||||||
| a,c | depart,arrive | road,road |
|
| a,c | depart,arrive | road,road |
|
||||||
| d,a | depart,turn left,arrive | in,road,road |
|
| d,a | depart,turn left,arrive | in,road,road |
|
||||||
| d,c | depart,new name straight,arrive | in,road,road |
|
| d,c | depart,new name straight,arrive | in,road,road |
|
||||||
|
|
||||||
|
Scenario: Channing Street
|
||||||
|
Given the node map
|
||||||
|
| | | g | f | |
|
||||||
|
| | | | | |
|
||||||
|
| d | | c | b | a |
|
||||||
|
| | | | | |
|
||||||
|
| | | | | |
|
||||||
|
| | | h | e | |
|
||||||
|
|
||||||
|
And the nodes
|
||||||
|
| node | highway |
|
||||||
|
| c | traffic_signals |
|
||||||
|
| b | traffic_signals |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name | highway | oneway |
|
||||||
|
| ab | Channing Street Northeast | residential | no |
|
||||||
|
| bcd | Channing Street Northwest | residential | yes |
|
||||||
|
| ebf | North Capitol Street Northeast | primary | yes |
|
||||||
|
| gch | North Capitol Street Northeast | primary | yes |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | turns | route |
|
||||||
|
| a,d | depart,arrive | Channing Street Northeast,Channing Street Northwest |
|
||||||
|
| a,h | depart,turn left,arrive | Channing Street Northeast,North Capitol Street Northeast,North Capitol Street Northeast |
|
||||||
|
@ -385,7 +385,9 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(!one_back_step.intersections.empty());
|
BOOST_ASSERT(!one_back_step.intersections.empty());
|
||||||
if (TurnType::Continue == current_step.maneuver.instruction.type ||
|
if (TurnType::Continue == current_step.maneuver.instruction.type ||
|
||||||
TurnType::Suppressed == current_step.maneuver.instruction.type)
|
(TurnType::Suppressed == current_step.maneuver.instruction.type &&
|
||||||
|
current_step.maneuver.instruction.direction_modifier !=
|
||||||
|
DirectionModifier::Straight))
|
||||||
steps[step_index].maneuver.instruction.type = TurnType::Turn;
|
steps[step_index].maneuver.instruction.type = TurnType::Turn;
|
||||||
else if (TurnType::Merge == current_step.maneuver.instruction.type)
|
else if (TurnType::Merge == current_step.maneuver.instruction.type)
|
||||||
{
|
{
|
||||||
@ -399,6 +401,7 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
|
|||||||
DirectionModifier::Straight &&
|
DirectionModifier::Straight &&
|
||||||
one_back_step.intersections.front().bearings.size() > 2)
|
one_back_step.intersections.front().bearings.size() > 2)
|
||||||
steps[step_index].maneuver.instruction.type = TurnType::Turn;
|
steps[step_index].maneuver.instruction.type = TurnType::Turn;
|
||||||
|
|
||||||
steps[two_back_index] = elongate(std::move(steps[two_back_index]), one_back_step);
|
steps[two_back_index] = elongate(std::move(steps[two_back_index]), one_back_step);
|
||||||
// If the previous instruction asked to continue, the name change will have to
|
// If the previous instruction asked to continue, the name change will have to
|
||||||
// be changed into a turn
|
// be changed into a turn
|
||||||
@ -416,9 +419,7 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
|
|||||||
if ((TurnType::Continue == one_back_step.maneuver.instruction.type ||
|
if ((TurnType::Continue == one_back_step.maneuver.instruction.type ||
|
||||||
TurnType::Suppressed == one_back_step.maneuver.instruction.type) &&
|
TurnType::Suppressed == one_back_step.maneuver.instruction.type) &&
|
||||||
current_step.name_id != steps[two_back_index].name_id)
|
current_step.name_id != steps[two_back_index].name_id)
|
||||||
{
|
|
||||||
steps[one_back_index].maneuver.instruction.type = TurnType::Turn;
|
steps[one_back_index].maneuver.instruction.type = TurnType::Turn;
|
||||||
}
|
|
||||||
else if (TurnType::Turn == one_back_step.maneuver.instruction.type &&
|
else if (TurnType::Turn == one_back_step.maneuver.instruction.type &&
|
||||||
current_step.name_id == steps[two_back_index].name_id)
|
current_step.name_id == steps[two_back_index].name_id)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "extractor/guidance/turn_handler.hpp"
|
|
||||||
#include "extractor/guidance/constants.hpp"
|
#include "extractor/guidance/constants.hpp"
|
||||||
#include "extractor/guidance/intersection_scenario_three_way.hpp"
|
#include "extractor/guidance/intersection_scenario_three_way.hpp"
|
||||||
#include "extractor/guidance/toolkit.hpp"
|
#include "extractor/guidance/toolkit.hpp"
|
||||||
|
#include "extractor/guidance/turn_handler.hpp"
|
||||||
|
|
||||||
#include "util/guidance/toolkit.hpp"
|
#include "util/guidance/toolkit.hpp"
|
||||||
|
|
||||||
@ -88,18 +88,20 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
|
|||||||
|
|
||||||
const bool is_ramp = isRampClass(first_class);
|
const bool is_ramp = isRampClass(first_class);
|
||||||
const bool is_obvious_by_road_class =
|
const bool is_obvious_by_road_class =
|
||||||
(!is_ramp && (2 * getPriority(first_class) < getPriority(second_class))) ||
|
(!is_ramp && (2 * getPriority(first_class) < getPriority(second_class)) &&
|
||||||
|
in_data.road_classification.road_class == first_class) ||
|
||||||
(!isLowPriorityRoadClass(first_class) && isLowPriorityRoadClass(second_class));
|
(!isLowPriorityRoadClass(first_class) && isLowPriorityRoadClass(second_class));
|
||||||
|
|
||||||
if (is_obvious_by_road_class)
|
if (is_obvious_by_road_class)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const bool other_is_obvious_by_road_flass =
|
const bool other_is_obvious_by_road_class =
|
||||||
(!isRampClass(second_class) &&
|
(!isRampClass(second_class) &&
|
||||||
(2 * getPriority(second_class) < getPriority(first_class))) ||
|
(2 * getPriority(second_class) < getPriority(first_class)) &&
|
||||||
|
in_data.road_classification.road_class == second_class) ||
|
||||||
(!isLowPriorityRoadClass(second_class) && isLowPriorityRoadClass(first_class));
|
(!isLowPriorityRoadClass(second_class) && isLowPriorityRoadClass(first_class));
|
||||||
|
|
||||||
if (other_is_obvious_by_road_flass)
|
if (other_is_obvious_by_road_class)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const bool turn_is_perfectly_straight = angularDeviation(road.turn.angle, STRAIGHT_ANGLE) <
|
const bool turn_is_perfectly_straight = angularDeviation(road.turn.angle, STRAIGHT_ANGLE) <
|
||||||
@ -375,6 +377,7 @@ std::size_t TurnHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
double best_continue_deviation = 180;
|
double best_continue_deviation = 180;
|
||||||
|
|
||||||
const EdgeData &in_data = node_based_graph.GetEdgeData(via_edge);
|
const EdgeData &in_data = node_based_graph.GetEdgeData(via_edge);
|
||||||
|
const auto in_class = in_data.road_classification.road_class;
|
||||||
for (std::size_t i = 1; i < intersection.size(); ++i)
|
for (std::size_t i = 1; i < intersection.size(); ++i)
|
||||||
{
|
{
|
||||||
const double deviation = angularDeviation(intersection[i].turn.angle, STRAIGHT_ANGLE);
|
const double deviation = angularDeviation(intersection[i].turn.angle, STRAIGHT_ANGLE);
|
||||||
@ -388,9 +391,11 @@ std::size_t TurnHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
auto continue_class = node_based_graph.GetEdgeData(intersection[best_continue].turn.eid)
|
auto continue_class = node_based_graph.GetEdgeData(intersection[best_continue].turn.eid)
|
||||||
.road_classification.road_class;
|
.road_classification.road_class;
|
||||||
if (intersection[i].entry_allowed && out_data.name_id == in_data.name_id &&
|
if (intersection[i].entry_allowed && out_data.name_id == in_data.name_id &&
|
||||||
(best_continue == 0 || continue_class > out_data.road_classification.road_class ||
|
(best_continue == 0 || (continue_class > out_data.road_classification.road_class &&
|
||||||
|
in_class != continue_class) ||
|
||||||
(deviation < best_continue_deviation &&
|
(deviation < best_continue_deviation &&
|
||||||
out_data.road_classification.road_class == continue_class)))
|
(out_data.road_classification.road_class == continue_class ||
|
||||||
|
in_class == out_data.road_classification.road_class))))
|
||||||
{
|
{
|
||||||
best_continue_deviation = deviation;
|
best_continue_deviation = deviation;
|
||||||
best_continue = i;
|
best_continue = i;
|
||||||
|
Loading…
Reference in New Issue
Block a user