Gracefully handle no-turn intersections in guidance processing. (#6382)

Badly constructed OSM intersections can create OSRM intersection
views that have no valid turns.
The guidance code for segregated intersections tries to look
ahead to the second intersection to ensure lanes are  announced
intuitively.
Currently, OSRM assumes there are always turns at the second
intersection that we should consider. This commit corrects
this assumption so that it can now handle badly constructed
OSM intersections with no turns.
This commit is contained in:
Michael Bell 2022-10-01 14:35:08 +01:00 committed by GitHub
parent 21888334dd
commit b7daa7e641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 4 deletions

View File

@ -62,6 +62,7 @@
- FIXED: Fix snapping target locations to ways used in turn restrictions. [#6339](https://github.com/Project-OSRM/osrm-backend/pull/6339)
- ADDED: Support OSM traffic signal directions. [#6153](https://github.com/Project-OSRM/osrm-backend/pull/6153)
- FIXED: Ensure u-turn exists in intersection view. [#6376](https://github.com/Project-OSRM/osrm-backend/pull/6376)
- FIXED: Gracefully handle no-turn intersections in guidance processing. [#6382](https://github.com/Project-OSRM/osrm-backend/issues/6382)
- Profile:
- CHANGED: Bicycle surface speeds [#6212](https://github.com/Project-OSRM/osrm-backend/pull/6212)
- Tools:

View File

@ -67,3 +67,37 @@ Feature: Features related to bugs
When I route I should get
| waypoints | route | intersections |
| a,c | Pear to Merrit,Merritt to Apricot,Merritt to Apricot | true:0;true:0 false:180;true:180 |
# https://github.com/Project-OSRM/osrm-backend/issues/6373
Scenario: Segregated intersection with no second intersection turns
Given the node map
"""
a b
| |
c--d--e--f
| |
g--h--i--j
"""
And the ways
| nodes | oneway | lanes | turn:lanes |
| dc | yes | 4 | |
| ed | yes | 4 | |
| fe | yes | 3 | |
| gh | yes | 4 | left\|left\|through\|through;right |
| hi | yes | 2 | |
| ij | yes | 3 | |
| ie | yes | 4 | |
| eb | yes | 2 | |
| ad | yes | 4 | reverse\|right\|right\|right |
| dh | yes | | |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | dh | hi | h | no_left_turn |
And the data has been saved to disk
When I try to run "osrm-extract {osm_file} --profile {profile_file}"
Then it should exit successfully

View File

@ -329,7 +329,7 @@ TurnLaneScenario TurnLaneHandler::deduceScenario(const NodeID at,
intersection)
.first;
// check if we were successfull in trimming
// check if we were successful in trimming
if (lane_data.size() == possible_entries &&
isSimpleIntersection(lane_data, intersection))
return TurnLaneScenario::PARTITION_LOCAL;
@ -556,7 +556,7 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
* into two parts, one for the first and one for the second intersection.
*/
// Try and maitch lanes to available turns. For Turns that are not directly matchable, check
// Try and match lanes to available turns. For Turns that are not directly matchable, check
// whether we can match them at the upcoming intersection.
const auto straightmost = intersection.findClosestTurn(STRAIGHT_ANGLE);
@ -675,10 +675,11 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
first.push_back(turn_lane_data[lane]);
}
if (straightmost_tag_index == turn_lane_data.size() &&
std::size_t num_next_intersection_turns = getNumberOfTurns(next_intersection);
if (straightmost_tag_index == turn_lane_data.size() && num_next_intersection_turns > 0 &&
static_cast<std::size_t>(
std::count(matched_at_second.begin(), matched_at_second.end(), true)) ==
getNumberOfTurns(next_intersection))
num_next_intersection_turns)
{
TurnLaneData data = {TurnLaneType::straight, 255, 0};
augmentEntry(data);