fix bug in conflict resolution

This commit is contained in:
Moritz Kobitzsch 2017-08-07 14:10:06 +02:00
parent 3a01ba52ef
commit a17b07bc4c
3 changed files with 13 additions and 11 deletions

View File

@ -863,8 +863,8 @@ Feature: Slipways and Dedicated Turn Lanes
| af | primary | sliproad | yes | | af | primary | sliproad | yes |
When I route I should get When I route I should get
| waypoints | route | turns | locations | | waypoints | route | turns | locations |
| s,g | main,sliproad,another,another | depart,turn right,turn left,arrive | s,a,f,g | | s,g | main,sliproad,another,another | depart,turn right,turn slight left,arrive | s,a,f,g |
@sliproads: @sliproads:
Scenario: Throughabout-Sliproad Scenario: Throughabout-Sliproad

View File

@ -788,9 +788,9 @@ Feature: Simple Turns
| bg | primary | yes | | bg | primary | yes |
When I route I should get When I route I should get
| waypoints | route | turns | | waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp right,arrive | | a,d | abc,bd,bd | depart,turn right,arrive |
| a,f | abc,bf,bf | depart,turn right,arrive | | a,f | abc,bf,bf | depart,turn slight right,arrive |
Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 3 Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 3
Given the node map Given the node map

View File

@ -391,6 +391,7 @@ Intersection TurnHandler::handleComplexTurn(const EdgeID via_edge, Intersection
{ {
assignTrivialTurns(via_edge, intersection, 1, intersection.size()); assignTrivialTurns(via_edge, intersection, 1, intersection.size());
} }
return intersection; return intersection;
} }
@ -744,7 +745,7 @@ void TurnHandler::handleDistinctConflict(const EdgeID via_edge,
right.instruction = {right_type, DirectionModifier::Right}; right.instruction = {right_type, DirectionModifier::Right};
return; return;
} }
// Two Right Turns // Two Left Turns
if (angularDeviation(left.angle, 270) < MAXIMAL_ALLOWED_NO_TURN_DEVIATION) if (angularDeviation(left.angle, 270) < MAXIMAL_ALLOWED_NO_TURN_DEVIATION)
{ {
// Keep left perfect, shift right // Keep left perfect, shift right
@ -773,17 +774,18 @@ void TurnHandler::handleDistinctConflict(const EdgeID via_edge,
return; return;
} }
if (getTurnDirection(left.angle) == DirectionModifier::Right) // turn to the right
if (getTurnDirection(left.angle) <= 180)
{ {
if (angularDeviation(left.angle, 85) >= angularDeviation(right.angle, 85)) if (angularDeviation(left.angle, 85) >= angularDeviation(right.angle, 85))
{ {
left.instruction = {left_type, DirectionModifier::Right}; left.instruction = {left_type, DirectionModifier::SlightRight};
right.instruction = {right_type, DirectionModifier::SharpRight}; right.instruction = {right_type, DirectionModifier::Right};
} }
else else
{ {
left.instruction = {left_type, DirectionModifier::SlightRight}; left.instruction = {left_type, DirectionModifier::Right};
right.instruction = {right_type, DirectionModifier::Right}; right.instruction = {right_type, DirectionModifier::SharpRight};
} }
} }
else else