Improvements to maneuver override processing (#6215)

This change unblocks the osrm-extract debug build, which is
currently failing on a maneuver override assertion.

The processing of maneuver overrides currently has three issues
- It assumes the via node(s) can't be compressed (the failing assertion)
- It can't handle via-paths containing incompressible nodes
- It doesn't interop with turn restriction on the same path

Turn restrictions and maneuver overrides both use the same
from-via-to path representation.
Therefore, we can fix these issues by consolidating their
structures and reusing the path representation for
turn restrictions, which already is robust to the above
issues.

This also simplifies some of the codebase by removing maneuver
override specific path processing.

There are ~100 maneuver overrides in the OSM database, so the
impact on processing and routing will be minimal.
This commit is contained in:
Michael Bell
2022-08-24 16:19:24 +01:00
committed by GitHub
parent 8e74b7af9d
commit a98074a051
24 changed files with 1224 additions and 1045 deletions
@@ -23,7 +23,7 @@ BOOST_AUTO_TEST_CASE(simple_intersection_connectivity)
std::vector<NodeBasedEdgeAnnotation> annotations{
{EMPTY_NAMEID, 0, INAVLID_CLASS_DATA, TRAVEL_MODE_DRIVING, false},
{EMPTY_NAMEID, 1, INAVLID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}};
std::vector<TurnRestriction> restrictions{TurnRestriction{NodeRestriction{0, 2, 1}, false}};
std::vector<TurnRestriction> restrictions{TurnRestriction{{ViaNodePath{0, 2, 1}}, false}};
CompressedEdgeContainer container;
test::MockScriptingEnvironment scripting_environment;
std::vector<UnresolvedManeuverOverride> maneuver_overrides;
+5 -5
View File
@@ -15,14 +15,14 @@ using namespace osrm::extractor;
TurnRestriction makeWayRestriction(NodeID from, std::vector<NodeID> via, NodeID to, bool is_only)
{
WayRestriction wr{from, std::move(via), to};
return TurnRestriction(wr, is_only);
ViaWayPath vwp{from, std::move(via), to};
return TurnRestriction({vwp}, is_only);
}
TurnRestriction makeNodeRestriction(NodeID from, NodeID via, NodeID to, bool is_only)
{
NodeRestriction nr{from, via, to};
return TurnRestriction(nr, is_only);
ViaNodePath vnp{from, via, to};
return TurnRestriction({vnp}, is_only);
}
struct instruction
@@ -52,7 +52,7 @@ void checkInstructions(RestrictionGraph::RestrictionRange restrictions,
restrictions.end(),
std::back_inserter(actual_instructions),
[](const auto &restriction) {
return instruction{restriction->To(), bool(restriction->is_only)};
return instruction{restriction->turn_path.To(), bool(restriction->is_only)};
});
std::sort(actual_instructions.begin(),
actual_instructions.end(),