-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Added post process logic to collapse segregated turn instructions #4925
Conversation
Updated left turn road name
…eet - features/guidance/collapse.feature:79
… Intersection belongs to Second - features/guidance/collapse.feature:219
…, Two Segregated Roads, Intersection belongs to Second - features/guidance/collapse.feature:219
…s Belonging to Mixed Streets - Slight Angles (2) - features/guidance/collapse.feature:318
…uidance/collapse.feature:581
…rn-lanes.feature:1220
…guidance/turn-lanes.feature:936
…rn-lanes.feature:961
@oxidase @danpat Above are the remaining failures - could you please review code updates and possibly discuss/help with the remaining issues? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I have some inline comments and there are still 5 failing test cases:
1) Scenario: Segregated Intersection, Cross Belonging to Mixed Streets - Slight Angles (2) - features/guidance/collapse.feature:318
Two turn instructions were suppressed inisNameOszillation
branch that is not the case after merging instructions incollapseSegregatedTurnInstructions
. I think it is ok to update expectations
| a,d | (-) first,first | (-) depart,arrive | (-) a,d |
| a,d | (+) first,first,first | (+) depart,turn left,arrive | (+) a,b,d |
For
| a,d | (-) first,first | (-) depart,arrive | (-) a,d |
| a,d | (+) first,first,first | (+) depart,turn left,arrive | (+) a,b,d |
the reason is in overwriting Suppressed
instruction by Turn
in SegregatedTurnStrategy
,but i think it is also ok to update the expectation.
2) Scenario: Entering a segregated road - features/guidance/collapse.feature:363
| g,c | second,first,first | (-) depart,end of road left,arrive | (-) g,b,c |
| g,c | second,first,first | (+) depart,turn left,arrive | (+) g,e,c |
This is similar to other end of road
to turn
changes that are related to PR #2587
3) Scenario: Crossing Segregated before a turn - features/guidance/obvious-turn-discovery.feature:1052
| g | f | woll,scho,scho | (-) depart,continue sharp left,arrive |
| g | f | woll,scho,scho | (+) depart,turn sharp left,arrive |
The expectation can be updated to turn sharp left
.
4) Scenario: Turn Lanes at Segregated Road - features/guidance/turn-lanes.feature:271
| i,l | cross,cross,cross | depart,continue uturn,arrive | (-) ;,left:true straight:false;left:true straight:false;left:false straight:true, |
| i,l | cross,cross,cross | depart,continue uturn,arrive | (+) ,left:true straight:false;left:true straight:false;left:true straight:false;left:false straight:true, |
The expectation for lanes can be updated to the new value.
5) Scenario: No Slight Right at Stralauer Strasse - features/guidance/turn.feature:1212
| a,d | (-) depart,arrive | (-) Stralauer Str,Holzmarktstr |
| a,d | (+) depart,turn slight right,arrive | (+) Stralauer Str,Holzmarktstr,Holzmarktstr |
The test explicitly checks instruction collapsing that happens in a sequence of buildIntersections
and suppressShortNameSegments
calls. I would suggest to update the test map as the real intersection has different geometry or remove the test as a duplicate of features/guidance/collapse.feature
tests.
It is also possible to add an intersections
column to Segregated Intersection, Cross Belonging to Single Street
test in features/guidance/collapse.feature
to check outgoing bearings after collapsing
When I route I should get
| waypoints | intersections |
| e,j | true:90;false:0 true:90 true:180 false:270;true:0 |
| e,h | true:90,false:0 true:90 true:180 false:270,true:0 true:90 false:180 false:270;true:270 |
| e,l | true:90;false:0 true:90 true:180 false:270,true:0 true:90 false:180 false:270,true:0 false:90 false:180 true:270;true:180 |
| e,d | true:90;false:0 true:90 true:180 false:270,true:0 true:90 false:180 false:270,true:0 false:90 false:180 true:270,false:0 false:90 true:180 true:270;true:90 |
| c | ||
a - b ' | | ||
g d | ||
f e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR moves maneuvers locations to node b
, i think it is ok to keep the original mini-map and update test expectations to
| ,left:false right:true, | a,b,g |
| ,left:true right:false;left:true right:false, | a,b,e |
for this test and tests below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mini map was updated so there would be an intersection prior to the turn so end of road
would be marked. I think before the end of road
was being marked on a false intersection - since the turn is at the intersection
@@ -13,19 +13,23 @@ Feature: Divided road entry | |||
d-------e-----f | |||
| | |||
| | |||
g | |||
i---g---j |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test modification changes result of previous_step.intersections.size() < MIN_END_OF_ROAD_INTERSECTIONS
condition to false. But the PR modifies intersections clustering and respectively the value of previous_step.intersections.size()
at node g
now is 1 instead of 2, so it is ok to adjust expectation to turn
instruction.
If end of road
instructions are still required then the commit or PR #2587 must be revisited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above - intersection before the turn was added so the end of road
would still be marked properly
@@ -691,14 +691,14 @@ Feature: Car - Turn restrictions | |||
# """ | |||
Given the node locations | |||
| node | lat | lon | | |||
| a | 38.9113 | -77.0091 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change of locations does not seem necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to match current map - it was producing odd results
void CombineSegregatedStepsStrategy::operator()(RouteStep &step_at_turn_location, | ||
const RouteStep &transfer_from_step) const | ||
{ | ||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add TODO
description
|
||
const auto is_straight_step = [](const RouteStep &step) { | ||
return ((hasTurnType(step, TurnType::NewName) || hasTurnType(step, TurnType::Continue) || | ||
hasTurnType(step, TurnType::Suppressed) || hasTurnType(step, TurnType::Turn)) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be change to is_turn_step(step) || (....)
as
const auto is_turn_step = [](const RouteStep &step) {
return (hasTurnType(step, TurnType::Turn) || hasTurnType(step, TurnType::Continue) ||
hasTurnType(step, TurnType::NewName) || hasTurnType(step, TurnType::Suppressed));
};
const auto is_straight_step = [&is_turn_step](const RouteStep &step) {
return is_turn_step(step) &&
(hasModifier(step, DirectionModifier::Straight) ||
hasModifier(step, DirectionModifier::SlightLeft) ||
hasModifier(step, DirectionModifier::SlightRight));
};
else if (hasTurnType(step_at_turn_location, TurnType::Fork)) | ||
{ | ||
// Keep fork | ||
setInstructionType(step_at_turn_location, TurnType::Fork); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
step_at_turn_location
has already TurnType::Fork
What will happen if hasTurnType(transfer_from_step, TurnType::Fork)
is true?
setInstructionType(step_at_turn_location, TurnType::EndOfRoad); | ||
|
||
// Set modifier based on turn angle | ||
setModifier(step_at_turn_location, turn_direction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this duplicates setModifier
on line 378
…into gdg_segregated_post_process
…d the expectation
Fixed tests
@oxidase i pushed up logic to handle the wider straight intersections - all of the tests now pass |
Added #4925
…into gdg_segregated_post_process
…ect-OSRM/osrm-backend into gdg_segregated_post_process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you @oxidase for your advice! Everything passed |
Issue
Collapse turns at segregated intersections to simplify guidance
Tasklist
Before
After