Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug in conflict resolution #4375

Merged
merged 1 commit into from
Aug 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions features/guidance/dedicated-turn-roads.feature
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,8 @@ Feature: Slipways and Dedicated Turn Lanes
| af | primary | sliproad | yes |

When I route I should get
| waypoints | route | turns | locations |
| s,g | main,sliproad,another,another | depart,turn right,turn left,arrive | s,a,f,g |
| waypoints | route | turns | locations |
| s,g | main,sliproad,another,another | depart,turn right,turn slight left,arrive | s,a,f,g |

@sliproads:
Scenario: Throughabout-Sliproad
Expand Down
6 changes: 3 additions & 3 deletions features/guidance/turn.feature
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,9 @@ Feature: Simple Turns
| bg | primary | yes |

When I route I should get
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn sharp right,arrive |
| a,f | abc,bf,bf | depart,turn right,arrive |
| waypoints | route | turns |
| a,d | abc,bd,bd | depart,turn right,arrive |
| a,f | abc,bf,bf | depart,turn slight right,arrive |

Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 3
Given the node map
Expand Down
14 changes: 8 additions & 6 deletions src/extractor/guidance/turn_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ Intersection TurnHandler::handleComplexTurn(const EdgeID via_edge, Intersection
{
assignTrivialTurns(via_edge, intersection, 1, intersection.size());
}

return intersection;
}

Expand Down Expand Up @@ -744,7 +745,7 @@ void TurnHandler::handleDistinctConflict(const EdgeID via_edge,
right.instruction = {right_type, DirectionModifier::Right};
return;
}
// Two Right Turns
// Two Left Turns
if (angularDeviation(left.angle, 270) < MAXIMAL_ALLOWED_NO_TURN_DEVIATION)
{
// Keep left perfect, shift right
Expand Down Expand Up @@ -773,17 +774,18 @@ void TurnHandler::handleDistinctConflict(const EdgeID via_edge,
return;
}

if (getTurnDirection(left.angle) == DirectionModifier::Right)
// turn to the right
if (getTurnDirection(left.angle) <= 180)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the main bug here. By checking for the modifier, we do not use right turns when the angles involved are slight/sharp

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Urgh this compiled because of the enum not being a strong typedef, right?

{
if (angularDeviation(left.angle, 85) >= angularDeviation(right.angle, 85))
{
left.instruction = {left_type, DirectionModifier::Right};
right.instruction = {right_type, DirectionModifier::SharpRight};
left.instruction = {left_type, DirectionModifier::SlightRight};
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notices this bug in the process of fixing the above.
Left is farther away from a 90 degree turn than right. So left cannot be a stronger turn than right.
These two were mixed up.

right.instruction = {right_type, DirectionModifier::Right};
}
else
{
left.instruction = {left_type, DirectionModifier::SlightRight};
right.instruction = {right_type, DirectionModifier::Right};
left.instruction = {left_type, DirectionModifier::Right};
right.instruction = {right_type, DirectionModifier::SharpRight};
}
}
else
Expand Down