-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Obvious Turn Handling, code transfer from #4426 #4867
Conversation
c156b84
to
c74ad95
Compare
4c289ba
to
22cdc06
Compare
Finished initial code transfer from #4426 and prepared PR for the first review iteration The PR extends
For SF-area comparison of the branch with 5.16 release shows 2447 modified turns out of 812570 (0.3%) |
5177947
to
2ca9b11
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 good! I have a few questions regarding some test cases and I think there might be some debugging code left.
@@ -1010,7 +1010,7 @@ Feature: Collapse | |||
| f,j | hohe,hohe | depart,arrive | f,j | | |||
| a,t | hohe,a100,a100 | depart,on ramp right,arrive | a,b,t | | |||
| f,e | | | | | |||
| q,j | a100,hohe,hohe | depart,turn right,arrive | q,p,j | | |||
| q,j | a100,hohe,hohe | depart,turn right,arrive | q,i,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.
Did the turn location logic also change, or is this a side-effect of an obvious turn 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.
location logic was not changed, but obvious turn changed at node p
features/guidance/continue.feature
Outdated
@@ -108,7 +108,7 @@ Feature: Continue Instructions | |||
When I route I should get | |||
| waypoints | route | turns | | |||
| a,c | abc,abc,abc | depart,continue right,arrive | | |||
| a,d | abc,bd,bd | depart,turn straight,arrive | | |||
| a,d | abc,bd | depart,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.
I'm not sure if this expectation is right? I would expect a turn instruction since you are not following the street abc
.
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 have adjusted conditions. Now the expectation is again depart,turn straight,arrive
.
| a,d | left,circle,circle,right,right | true:90;false:90 true:120 false:270;true:60 true:180 false:300;true:90 false:240 true:270;true:270 | | ||
| g,d | bottom,circle,right,right | true:0;true:60 false:180 false:300;true:90 false:240 true:270;true:270 | | ||
| waypoints | route | intersections | | ||
| a,d | left,right,right | true:90,false:90 true:120 false:270;true:60 true:180 false:300,true:90 false:240 true:270;true:270 | |
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 functional change here is that going straight
is an obvious turn, even though the street name changes?
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.
adjusted detection conditions to expectations:
| a,d | left,circle,right,right | true:90,false:90 true:120 false:270;true:60 true:180 false:300;true:90 false:240 true:270;true:270 |
| g,d | bottom,circle,right,right | true:0;true:60 false:180 false:300;true:90 false:240 true:270;true:270 |
|
||
|
||
# https://www.openstreetmap.org/#map=19/37.63829/-122.46345 | ||
@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.
This one is marked as todo, maybe we should add a comment what is missing here?
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 have reviewed new test cases and marked as @todo
in the following cases:
- tests fail due to geometry conditions
compare_road_deviation_is_distinct
andcompare_road_deviation_is_slightly_distinct
. I would keep ratios 2 and 1.4 in these conditions as was proposed in the original PR - additional post-processing logic is required to collapse instructions.
|
||
|
||
# https://www.openstreetmap.org/#map=18/48.99155/8.43520 | ||
@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.
Same here.
// Find the most obvious turn to follow. The function returns an index into the intersection | ||
// determining whether there is a road that can be seen as obvious turn in the presence of many | ||
// other possible turns. The function will consider road categories and other inputs like the | ||
// turn angles. | ||
template <typename IntersectionType> // works with Intersection and IntersectionView | ||
std::size_t findObviousTurn(const EdgeID via_edge, const IntersectionType &intersection) const; | ||
|
||
template <typename IntersectionType> // works with Intersection and IntersectionView | ||
std::size_t findObviousTurnOld(const EdgeID via_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.
These two declarations seem to be leftover from debugging?
// indicate that a low priority road is obvious | ||
if (IsLowPriority(best_option_edge) && | ||
best_option_edge.flags.road_classification != in_way_edge.flags.road_classification) | ||
if (candidate_deviation < GROUP_ANGLE) |
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.
Nit pick: It might make sense to split this function into two sub-functions each for handling a case of this if
block. The function is quite huge.
return best_continue; | ||
// Special case handling for roads splitting up, all the same name (exactly the same) | ||
if (intersection.size() == 3 && | ||
std::all_of(intersection.begin(), |
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 function call should be moved out of the if
head for readability.
profiles/lib/tags.lua
Outdated
if data.is_forward_oneway then | ||
forward = forward or common | ||
end | ||
if data.is_reverse_oneway then |
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.
Is this an added bug fix for the profile? It might make sense to capture that separately.
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 found some bugs and will open a separate PR for review, namely here is a fix for double counting of lanes in case of oneways
.
@@ -185,7 +185,7 @@ util::Coordinate CoordinateExtractor::ExtractRepresentativeCoordinate( | |||
*/ | |||
const bool first_coordinate_is_far_away = [&first_distance, considered_lanes]() { | |||
const auto required_distance = | |||
considered_lanes * 0.5 * ASSUMED_LANE_WIDTH + LOOKAHEAD_DISTANCE_WITHOUT_LANES; |
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.
Any background why we removed the magic parameter here?
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 don't know exactly where 0.5
comes from, but assume that it is needed to reduce number of considered_lanes
by factor 2 due to double counting.
3726dae
to
82241ed
Compare
The current state of PR:
|
82241ed
to
09b5564
Compare
09b5564
to
3f5ff84
Compare
3f5ff84
to
f4a9f1f
Compare
Issue
PR #4426 has an initial implementation of the obvious turn detection restructuring.
This PR rebases parts of the branch https://github.com/Project-OSRM/osrm-backend/tree/fix/obvious-2
0001-Don-t-show-time-by-default-in-osrm-runner.patch.txt
to the current master:
obvious-turn-discovery.feature
include/extractor/guidance/road_classification.hpp
findObviousTurn
->findObviousTurnNew
src/extractor/guidance/motorway_handler.cpp
src/extractor/guidance/turn_handler.cpp
src/engine/guidance/collapse_scenario_detection.cpp
src/extractor/scripting_environment_lua.cpp
and changes in Lua scriptsTasklist
findObviousTurnNew
-> no failing cucumber testsAdditional cases to check
Make a slight right
instruction at https://www.openstreetmap.org/node/568760458Turn left
instruction at https://www.openstreetmap.org/node/985525653Requirements / Relations
Related #3105, #4426, #4414