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

Updated segregated intersection identification #4845

Merged
merged 16 commits into from
Feb 27, 2018

Conversation

dgearhart
Copy link
Contributor

@dgearhart dgearhart commented Feb 1, 2018

Issue

Mark the segregated intersections using the internal intersection logic similar to Valhalla

Tasklist

  • CHANGELOG.md entry
  • add tests
  • add before/after examples
  • review
  • Fix problem that were found during reviewing classification
  • adjust for comments

Copy link

@kdiluca kdiluca left a comment

Choose a reason for hiding this comment

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

Looks great. We will still need to investigate roundabouts more though.

@TheMarex TheMarex added the Review label Feb 2, 2018
Copy link
Member

@TheMarex TheMarex left a comment

Choose a reason for hiding this comment

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

Thanks for taking a stab at this! There are some minor code style things that should be fixed. I'm not sure if you found scripts/format.sh but it might take care of a few of them.

It would be great if we could get some sort of map for SF/Berlin (because they are small) on what edges change classification with this PR. I think @oxidase wrote a tool for this? From my understanding it the classification seems more strict?

@@ -203,15 +219,17 @@ std::unordered_set<EdgeID> findSegregatedNodes(const NodeBasedGraphFactory &fact
return info;
};

auto const isSegregatedFn = [&](auto const &edgeData,
auto const isSegregatedFn = [&](EdgeID edgeID,
Copy link
Member

Choose a reason for hiding this comment

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

We use under_score convention when naming variables. So that would be edge_id and edge_data.

Copy link

Choose a reason for hiding this comment

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

Done

double edgeLength) {
// Internal intersection edges must be short and cannot be a roundabout
// TODO adjust length as needed with lamda
if (edgeLength > 32.0f || current.flags.roundabout) {
Copy link
Member

Choose a reason for hiding this comment

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

The constant 32.0f should be captured in a named constexpr somewhere to make it easier to look up and change.

Copy link

Choose a reason for hiding this comment

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

Done

std::vector<EdgeInfo> v1,
std::vector<EdgeInfo> v2,
EdgeInfo const &current,
double edgeLength) {
Copy link
Member

Choose a reason for hiding this comment

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

edgeLength -> edge_length

Copy link

Choose a reason for hiding this comment

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

Done

return false;
}

// Print information about angles at node 1 from all inbound edge to the current edge
Copy link
Member

Choose a reason for hiding this comment

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

Outdated comment?

Copy link

Choose a reason for hiding this comment

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

Removed

auto const turn_degree = get_angle(edge_from.node, edge_inbound, current.edge);
// Skip if the inbound edge is not somewhat perpendicular to the current edge
// TODO add turn degree lamda
if (turn_degree > 150 && turn_degree < 210) {
Copy link
Member

Choose a reason for hiding this comment

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

I think there is a helper function for determining if a turn is a straight angle somewhere. It might make sense to use it here.

return false;
}

// Print information about angles at node 2 from the current edge to all outbound edges
Copy link
Member

Choose a reason for hiding this comment

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

Comment seems outdated?

Copy link

Choose a reason for hiding this comment

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

Removed


// Print information about angles at node 1 from all inbound edge to the current edge
bool oneway_inbound = false;
for (auto const &edge_from : v1) {
Copy link
Member

@TheMarex TheMarex Feb 2, 2018

Choose a reason for hiding this comment

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

Reading the two for loops, it seems like both for loops check the same things on different data. Maybe we could introduce a helper function that we could reuse here?

| waypoints | route | turns |
| a,k | Broken Land Parkway,Broken Land Parkway | depart,arrive |
| l,b | Broken Land Parkway,Broken Land Parkway | depart,arrive |
# | g,j | Patuxent Woods Drive,Snowden River Parkway,Snowden River Parkway | depart,continue,arrive |
Copy link
Member

Choose a reason for hiding this comment

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

A comment column can be added by naming the column #. It would be nice to add a comment on why the specific test case was commented out.

Copy link

Choose a reason for hiding this comment

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

Done

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 nice! Are TODOs planned as follow-up tasks or will be implemented in this PR?

NodeID node;

util::StringView name;

bool reversed;

// 0 - outgoing (forward), 1 - incoming (reverse), 2 - both outgoing and incoming
int direction;
Copy link
Contributor

Choose a reason for hiding this comment

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

direction and a part of code at

// Merge equal infos with correct direction.
auto curr = info.begin();
auto next = curr;
while (++next != info.end())
{
if (curr->node == next->node)
{
BOOST_ASSERT(curr->name == next->name);
BOOST_ASSERT(curr->road_class == next->road_class);
BOOST_ASSERT(curr->direction != next->direction);
curr->direction = 2;
}
else
curr = next;
}
can be removed

Copy link

Choose a reason for hiding this comment

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

Done

// Get the turn degree from the current edge to the outbound edge
auto const turn_degree = get_angle(node1, current.edge, edge_to.edge);
// Skip if the outbound edge is not somewhat perpendicular to the current edge
// TODO add turn degree lamda
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 to move the check to lambda and remove code duplication

@chaupow chaupow added this to the 5.16.0 milestone Feb 5, 2018
@kdiluca kdiluca self-assigned this Feb 6, 2018
@kdiluca
Copy link

kdiluca commented Feb 6, 2018

@TheMarex @oxidase

@dgearhart and I are working on the lambda as well as the differ tool to show the before/after of the edge classifications in SF.

@dgearhart
Copy link
Contributor Author

BEFORE: 4 missing segregated intersection edges
md_segregated_before

AFTER: The segregated intersection edges are now marked
md_segregated_after

Copy link
Member

@TheMarex TheMarex left a comment

Choose a reason for hiding this comment

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

Thanks for iterating on this. 👍 Looks much better! Good to merge from my side.

@TheMarex
Copy link
Member

TheMarex commented Feb 7, 2018

@dgearhart If you could rebase this on master and squash some commits, we can merge this tomorrow. 👍

@dgearhart
Copy link
Contributor Author

@TheMarex thanks for the review and suggestions. We found a few issues when we reviewed the diffs - we would like to fix before merging.

@TheMarex TheMarex removed this from the 5.16.0 milestone Feb 10, 2018
@kdiluca
Copy link

kdiluca commented Feb 23, 2018

  1. This PR is ready for review for internal intersection identification.
  2. I will be opening a new issue/PR to resolve a few turn angle adjustments that need to be made, along with additional testing to make sure nothing else is impacted and will use this PR as the baseline. The turn angle adjustments should fix cases like this: THIS IS A NON ISSUE NOW AFTER REMOVAL OF BREAKS.
    image
    The intention of the Turn Angle adjustment is to not identify an internal intersection on the road where Miraloma Dr becomes Portola Dr for example.

dgearhart and others added 8 commits February 27, 2018 15:13
Added/Updated constexpr names and values
…e opposite turn degrees than outgoing edges or if the outgoing edges have opposing turn degrees; also merged with master v5.16
Breaks in code were a mistake and caused a change in the internal intersection identification.
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 great! I have rebased the branch to master and prepared a map with removed (red) and added (green) internal edges.

Some cases with removed edges like Peralta Avenue can be revisited after implementing post process logic.

@dgearhart
Copy link
Contributor Author

@kdiluca I thought you said the Portola Drive case was fixed with the latest code (prior to turn adjustments)
screenshot from 2018-02-27 10-37-55

@kdiluca
Copy link

kdiluca commented Feb 27, 2018

image
It is fixed. I just rechecked it and @oxidase is going to do the same. This is what I now see.

@oxidase
Copy link
Contributor

oxidase commented Feb 27, 2018

@dgearhart @kdiluca I have updated the map with correct OSM data and added unchanged (blue) edges:
screenshot from 2018-02-27 20-22-53

Added CHANGED #4845: Updated segregated intersection identification to Unreleased
@kdiluca kdiluca merged commit 33021d3 into master Feb 27, 2018
@oxidase oxidase deleted the gdg_internal_intersection branch February 28, 2018 08:48
@dgearhart
Copy link
Contributor Author

Before - production 5.16

production_segregated_5 16

After - staging 5.17

staging_segregated_5 17

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.

None yet

5 participants