Skip to content
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

Merged
merged 36 commits into from
Mar 30, 2018

Conversation

dgearhart
Copy link
Contributor

@dgearhart dgearhart commented Feb 28, 2018

Issue

Collapse turns at segregated intersections to simplify guidance

Tasklist

  • CHANGELOG.md entry (How to write a changelog entry)
  • discuss impact of maneuver overrides
  • update cucumber tests
  • add tests
  • review
  • adjust for comments
  • fix final issues

Before
screenshot from 2018-02-27 17-54-22

After
screenshot from 2018-02-27 10-59-33

@dgearhart dgearhart requested review from danpat and oxidase February 28, 2018 15:27
@dgearhart dgearhart changed the title Added post process logic to collapse segregated turn instructions [WIP] Added post process logic to collapse segregated turn instructions Feb 28, 2018
@TheMarex TheMarex changed the title [WIP] Added post process logic to collapse segregated turn instructions Added post process logic to collapse segregated turn instructions Mar 1, 2018
@dgearhart
Copy link
Contributor Author

@danpat @oxidase I updated several of the cucumber tests since when we collapse the segregated edges the transition point will be the same for right, left, or U turns. Seem reasonable?

@dgearhart
Copy link
Contributor Author

dgearhart commented Mar 20, 2018

segregated_failures

@oxidase @danpat Above are the remaining failures - could you please review code updates and possibly discuss/help with the remaining issues?
1) and 4) are issues because when the segregated step is collapsed the result is a slight turn. Might need more logic to know if it is the most straight and should be collapsed. Any other suggestions?
2) is an issue because the segregated identification code needs to handle the circular attribute like it handles the roundabout attribute. This will be fixed when the identification logic is updated.
3) I am not sure why the lane information is not correct on this test - any insights here?

@danpat danpat added this to the 5.17.0 milestone Mar 23, 2018
Copy link
Contributor

@oxidase oxidase left a 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 in isNameOszillation branch that is not the case after merging instructions in collapseSegregatedTurnInstructions. 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 screenshot from 2018-03-24 11-20-55 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
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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 |
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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)) &&
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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

@dgearhart
Copy link
Contributor Author

@oxidase i pushed up logic to handle the wider straight intersections - all of the tests now pass

Copy link
Contributor

@oxidase oxidase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dgearhart
Copy link
Contributor Author

Thank you @oxidase for your advice! Everything passed

@dgearhart dgearhart merged commit 8a63ad9 into master Mar 30, 2018
@dgearhart dgearhart deleted the gdg_segregated_post_process branch March 30, 2018 11:44
@dgearhart dgearhart removed the Review label Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants