-
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
Updated segregated intersection identification #4845
Conversation
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 great. We will still need to investigate roundabouts more though.
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.
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, |
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.
We use under_score
convention when naming variables. So that would be edge_id
and edge_data
.
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.
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) { |
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 constant 32.0f
should be captured in a named constexpr
somewhere to make it easier to look up and change.
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.
Done
std::vector<EdgeInfo> v1, | ||
std::vector<EdgeInfo> v2, | ||
EdgeInfo const ¤t, | ||
double edgeLength) { |
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.
edgeLength
-> edge_length
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.
Done
return false; | ||
} | ||
|
||
// Print information about angles at node 1 from all inbound edge to the current edge |
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.
Outdated comment?
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.
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) { |
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.
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 |
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.
Comment seems outdated?
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.
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) { |
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.
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 | |
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.
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.
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.
Done
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 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; |
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.
direction
and a part of code at
osrm-backend/src/extractor/guidance/segregated_intersection_classification.cpp
Lines 197 to 211 in 8d468cd
// 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; | |
} |
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.
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 |
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.
👍 to move the check to lambda and remove code duplication
@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. |
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.
Thanks for iterating on this. 👍 Looks much better! Good to merge from my side.
@dgearhart If you could rebase this on master and squash some commits, we can merge this tomorrow. 👍 |
@TheMarex thanks for the review and suggestions. We found a few issues when we reviewed the diffs - we would like to fix before merging. |
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.
eb8e81b
to
4ef649a
Compare
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 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.
@kdiluca I thought you said the |
|
@dgearhart @kdiluca I have updated the map with correct OSM data and added unchanged (blue) edges: |
Added CHANGED #4845: Updated segregated intersection identification to Unreleased
Issue
Mark the segregated intersections using the internal intersection logic similar to Valhalla
Tasklist