only consider narrow turns onto through streets straight

This commit is contained in:
Moritz Kobitzsch 2017-06-30 11:35:33 +02:00 committed by Patrick Niklaus
parent 2522f70f86
commit 4c7aa8f1c0
2 changed files with 15 additions and 12 deletions

View File

@ -1372,7 +1372,9 @@ Feature: Simple Turns
| waypoints | route |
| g,e | abcde,abcde |
Scenario: small ticks in roads
# 4205
# https://www.openstreetmap.org/node/36153635#map=19/51.97548/7.61795
Scenario: merging onto a through street
Given the node map
"""
e
@ -1439,7 +1441,6 @@ Feature: Simple Turns
| fcde | no | jahn |
When I route I should get
| waypoints | route | turns |
| a,f | fww,jahn,jahn | depart,turn straight,arrive |
| a,e | fww,jahn,jahn | depart,turn left,arrive |
| waypoints | route | turns |
| a,f | fww,jahn,jahn | depart,turn right,arrive |
| a,e | fww,jahn,jahn | depart,turn left,arrive |

View File

@ -119,7 +119,9 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
const double constexpr MAX_COLLAPSE_DISTANCE = 30;
// in normal road condidtions, we check if the turn is nearly straight.
// Doing so, we widen the angle that a turn is considered straight, but since it
// is obvious, the choice is arguably better.
// is obvious, the choice is arguably better. We need the road to continue for a
// bit though, until we assume this is safe to do. In addition, the angle cannot
// get too wide, so we only allow narrow turn angles to begin with.
// FIXME this requires https://github.com/Project-OSRM/osrm-backend/pull/2399,
// since `distance` does not refer to an actual distance but rather to the
@ -129,12 +131,12 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
const auto distance = util::coordinate_calculation::haversineDistance(
coordinates[node_based_graph.GetTarget(via_edge)],
coordinates[node_based_graph.GetTarget(road.eid)]);
return {
TurnType::Turn,
(angularDeviation(road.angle, STRAIGHT_ANGLE) < FUZZY_ANGLE_DIFFERENCE ||
distance > 2 * MAX_COLLAPSE_DISTANCE)
? DirectionModifier::Straight
: getTurnDirection(road.angle)};
return {TurnType::Turn,
(angularDeviation(road.angle, STRAIGHT_ANGLE) < NARROW_TURN_ANGLE &&
distance > 2 * MAX_COLLAPSE_DISTANCE)
? DirectionModifier::Straight
: getTurnDirection(road.angle)};
}
}
else