From 861314256ebaa0ce4ec5c1e5259da401d7edf584 Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch Date: Tue, 13 Sep 2016 18:57:28 +0200 Subject: [PATCH] fix roundabout-intersection on immediate exit --- CHANGELOG.md | 1 + features/guidance/roundabout-turn.feature | 20 ++++++++++++++++++++ include/util/guidance/toolkit.hpp | 2 +- src/engine/guidance/post_processing.cpp | 5 ++++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bfe43d31..0cd1b9252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - Fixes a bug where a bearing range of zero would cause exhaustive graph traversals - Fixes a bug where certain looped geometries could cause an infinite loop during extraction - Fixed a bug where some roads could be falsly identified as sliproads + - Fixed a bug where roundabout intersections could result in breaking assertions when immediately exited - Infrastructure: - Adds a feature to limit results in nearest service with a default of 100 in `osrm-routed` diff --git a/features/guidance/roundabout-turn.feature b/features/guidance/roundabout-turn.feature index 743f2fabb..d62c5fe0a 100644 --- a/features/guidance/roundabout-turn.feature +++ b/features/guidance/roundabout-turn.feature @@ -491,3 +491,23 @@ Feature: Basic Roundabout | h,a | gh,ab,ab | depart,roundabout turn left exit-3,arrive | | h,d | gh,cd,cd | depart,roundabout turn straight exit-2,arrive | | h,f | gh,ef,ef | depart,roundabout turn right exit-1,arrive | + + #http://www.openstreetmap.org/#map=19/41.03275/-2.18990 + #at some point we probably want to recognise these situations and don't mention the roundabout at all here + Scenario: Enter And Exit Throughabout + Given the node map + | | | | | | h | | | | | + | | | | | | | | | | | + | c | b | | d | | | | e | | f | + | | | | | | | | | | | + | | a | | | | g | | | | | + + And the ways + | nodes | highway | name | junction | oneway | + | dghd | tertiary_link | | roundabout | | + | cbdef | trunk | through | | no | + | ab | residential | in | | | + + When I route I should get + | waypoints | turns | route | + | a,f | depart,turn right,roundabout turn straight exit-1,arrive | in,through,through,through | diff --git a/include/util/guidance/toolkit.hpp b/include/util/guidance/toolkit.hpp index 8582b8056..14f239699 100644 --- a/include/util/guidance/toolkit.hpp +++ b/include/util/guidance/toolkit.hpp @@ -113,7 +113,7 @@ inline bool entersRoundabout(const extractor::guidance::TurnInstruction instruct instruction.type == extractor::guidance::TurnType::EnterRoundaboutIntersectionAtExit || instruction.type == extractor::guidance::TurnType::EnterAndExitRoundabout || instruction.type == extractor::guidance::TurnType::EnterAndExitRotary || - instruction.type == extractor::guidance::TurnType::EnterAndExitRotary); + instruction.type == extractor::guidance::TurnType::EnterAndExitRoundaboutIntersection); } inline bool leavesRoundabout(const extractor::guidance::TurnInstruction instruction) diff --git a/src/engine/guidance/post_processing.cpp b/src/engine/guidance/post_processing.cpp index 29f07136a..4e9f03455 100644 --- a/src/engine/guidance/post_processing.cpp +++ b/src/engine/guidance/post_processing.cpp @@ -1,5 +1,5 @@ -#include "engine/guidance/post_processing.hpp" #include "extractor/guidance/turn_instruction.hpp" +#include "engine/guidance/post_processing.hpp" #include "engine/guidance/assemble_steps.hpp" #include "engine/guidance/lane_processing.hpp" @@ -203,6 +203,8 @@ bool setUpRoundabout(RouteStep &step) instruction.type == TurnType::EnterRoundaboutAtExit || instruction.type == TurnType::EnterRoundaboutIntersectionAtExit) { + // Here we consider an actual entry, not an exit. We simply have to count the additional + // exit step.maneuver.exit = 1; // prevent futher special case handling of these two. if (instruction.type == TurnType::EnterRotaryAtExit) @@ -215,6 +217,7 @@ bool setUpRoundabout(RouteStep &step) if (leavesRoundabout(instruction)) { + // This set-up, even though it looks the same, is actually looking at entering AND exiting step.maneuver.exit = 1; // count the otherwise missing exit // prevent futher special case handling of these two.