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

Fixed order of generated edges and guidance turns #4706

Merged
merged 15 commits into from
Jan 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# UNRELEASED
- Changes from 5.14.3:
- Bugfixes:
- FIXED #4704: Fixed regression in bearings reordering introduced in 5.13 [#4704](https://github.com/Project-OSRM/osrm-backend/issues/4704)
- Guidance:
- CHANGED #4706: Guidance refactoring step to decouple intersection connectivity analysis and turn instructions generation [#4706](https://github.com/Project-OSRM/osrm-backend/pull/4706)

# 5.14.3
- Changes from 5.14.2:
- Bugfixes:
- FIXED #4754: U-Turn penalties are applied to straight turns.
Expand Down
3 changes: 1 addition & 2 deletions features/car/conditional_restrictions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ Feature: Car - Turn restrictions
| a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive |
| a | e | albic,dobe,dobe | depart,turn left,arrive |

@no_turning @conditionals
@no_turning @conditionals @restriction-way
Scenario: Car - Conditional restriction with multiple time windows
Given the extract extra arguments "--parse-conditional-restrictions"
# 5pm Wed 02 May, 2017 GMT
Expand Down Expand Up @@ -1054,4 +1054,3 @@ Feature: Car - Turn restrictions
| a | f | ab,be,ef,ef | depart,turn right,turn left,arrive | a,b,e,f |
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |

20 changes: 10 additions & 10 deletions features/car/restrictions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ Feature: Car - Turn restrictions
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |

@restriction @overlap
@restriction-way @overlap
Scenario: Car - prohibit turn
Given the node map
"""
Expand Down Expand Up @@ -710,7 +710,7 @@ Feature: Car - Turn restrictions
| a | j | left,first,right,right |
| f | e | right,third,left,left |

@restriction
@restriction-way
Scenario: Car - allow only turn
Given the node map
"""
Expand Down Expand Up @@ -742,7 +742,7 @@ Feature: Car - Turn restrictions
| c | d | bc,be,de,de | depart,turn left,turn right,arrive | c,b,e,d |
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |

@restriction
@restriction-way
Scenario: Car - allow only turn
Given the node map
"""
Expand Down Expand Up @@ -771,7 +771,7 @@ Feature: Car - Turn restrictions
| from | to | route |
| a | d | ab,be,de,de |

@restriction
@restriction-way
Scenario: Multi Way restriction
Given the node map
"""
Expand Down Expand Up @@ -808,7 +808,7 @@ Feature: Car - Turn restrictions
| from | to | route |
| a | h | horiz,vert,horiz,horiz |

@restriction
@restriction-way
Scenario: Multi-Way overlapping single-way
Given the node map
"""
Expand Down Expand Up @@ -847,7 +847,7 @@ Feature: Car - Turn restrictions
| h | d | hfb,abcd,abcd | depart,end of road right,arrive | h,b,d |


@restriction
@restriction-way
Scenario: Car - prohibit turn, traffic lights
Given the node map
"""
Expand Down Expand Up @@ -890,7 +890,7 @@ Feature: Car - Turn restrictions
| c | f | bc,be,ef,ef | depart,turn left,turn left,arrive | c,b,e,f |


@restriction @overlap @geometry
@restriction-way @overlap @geometry
Scenario: Geometry
Given the node map
"""
Expand Down Expand Up @@ -925,7 +925,7 @@ Feature: Car - Turn restrictions
| c | d | bc,bge,de,de |
| c | f | bc,bge,de,de,ef,ef |

@restriction @overlap @geometry @traffic-signals
@restriction-way @overlap @geometry @traffic-signals
Scenario: Geometry
Given the node map
"""
Expand Down Expand Up @@ -967,7 +967,7 @@ Feature: Car - Turn restrictions
| c | f | bc,bge,de,de,ef,ef |

# don't crash hard on invalid restrictions
@restriction @invalid
@restriction-way @invalid
Scenario: Geometry
Given the node map
"""
Expand Down Expand Up @@ -999,7 +999,7 @@ Feature: Car - Turn restrictions
| a | f | ab,be,ef,ef |


@restriction @overlap @geometry
@restriction @restriction-way @overlap @geometry
Scenario: Duplicated restriction
Given the node map
"""
Expand Down
63 changes: 38 additions & 25 deletions features/guidance/merge-segregated-roads.feature
Original file line number Diff line number Diff line change
Expand Up @@ -393,31 +393,44 @@ Feature: Merge Segregated Roads
"""
a
|
b
b-----z
/ \
c h
| |
| |
| |
| |
| |
| |
| |
| |
| |
d g
\ /
e
|
f
"""

And the ways
| nodes | name | oneway |
| ab | road | no |
| ef | road | no |
| bcde | road | yes |
| eghb | road | yes |
| nodes | name | oneway |
| ab | road | no |
| ef | road | no |
| bcde | road | yes |
| eghb | road | yes |
| bz | cross | no |

And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bz | bcde | b | no_left_turn |

When I route I should get
| waypoints | turns | route |
| a,f | depart,arrive | road,road |
| c,f | depart,arrive | road,road |
| f,a | depart,arrive | road,road |
| g,a | depart,arrive | road,road |
| waypoints | turns | route |
| a,f | depart,arrive | road,road |
| c,f | depart,arrive | road,road |
| f,a | depart,arrive | road,road |
| g,a | depart,arrive | road,road |
| z,a | depart,turn right,arrive | cross,road,road |

Scenario: Traffic Island
Given the node map
Expand Down Expand Up @@ -588,10 +601,10 @@ Feature: Merge Segregated Roads

When I route I should get
| waypoints | route | turns |
| a,c | germ,ober | depart,arrive |
| a,g | germ,germ,germ | depart,continue right,arrive |
| a,1 | germ,germ,germ | depart,continue left,arrive |
| d,g | ober,germ,germ | depart,turn left,arrive |
| a,c | germ,ober | depart,arrive |
| a,g | germ,germ,germ | depart,continue right,arrive |
| a,1 | germ,germ,germ | depart,continue left,arrive |
| d,g | ober,germ,germ | depart,turn left,arrive |

# https://www.openstreetmap.org/#map=19/51.32888/6.57059
Scenario: Places in presence of oneways
Expand Down Expand Up @@ -623,16 +636,16 @@ Feature: Merge Segregated Roads
| cf | albrecht | yes |

When I route I should get
| waypoints | route | turns |
| a,l | schwert,albrecht,marianne,marianne | depart,new name straight,turn left,arrive |
| a,j | schwert,luise,luise | depart,turn right,arrive |
| a,1 | schwert,albrecht,albrecht,albrecht | depart,new name straight,continue uturn,arrive |
| k,l | marianne,marianne | depart,arrive |
| k,j | marianne,albrecht,luise,luise | depart,turn left,turn left,arrive |
| k,d | marianne,schwert,schwert | depart,turn right,arrive |
| i,j | luise,luise | depart,arrive |
| i,d | luise,albrecht,schwert,schwert | depart,turn left,turn straight,arrive |
| i,l | luise,albrecht,marianne,marianne | depart,turn left,turn left,arrive |
| waypoints | route | turns |
| a,l | schwert,albrecht,marianne,marianne | depart,new name straight,turn left,arrive |
| a,j | schwert,luise,luise | depart,turn right,arrive |
| a,1 | schwert,albrecht,albrecht,albrecht | depart,new name straight,continue uturn,arrive |
| k,l | marianne,marianne | depart,arrive |
| k,j | marianne,albrecht,luise,luise | depart,turn left,turn left,arrive |
| k,d | marianne,schwert,schwert | depart,turn right,arrive |
| i,j | luise,luise | depart,arrive |
| i,d | luise,albrecht,schwert,schwert | depart,turn left,turn straight,arrive |
| i,l | luise,albrecht,marianne,marianne | depart,turn left,turn left,arrive |

# https://www.openstreetmap.org/#map=19/52.46339/13.40272
Scenario: Do not merge links between segregated roads
Expand Down
12 changes: 6 additions & 6 deletions features/guidance/turn-angles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -961,12 +961,12 @@ Feature: Simple Turns
g
.
.
.
.
f
h .
. .
. j
.
.
h f
.
. .
. j
. .
c
. . .
Expand Down
4 changes: 4 additions & 0 deletions features/support/data_classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ module.exports = {

FuzzyMatch: class {
match (got, want) {
// don't fail if bearings input and extected string is empty and actual result is undefined
if (want === '' && (got === '' || got === undefined))
return true;

var matchPercent = want.match(/(.*)\s+~(.+)%$/),
matchAbs = want.match(/(.*)\s+\+\-(.+)$/),
matchRe = want.match(/^\/(.*)\/$/),
Expand Down
2 changes: 1 addition & 1 deletion include/extractor/geojson_debug_policies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ operator()(const NodeID intersection_node,
const boost::optional<util::json::Object> &way_style) const
{
// request the number of lanes. This process needs to be in sync with what happens over at
// intersection_generator
// intersection analysis
const auto intersection_lanes =
intersection.FindMaximum(guidance::makeExtractLanesForRoad(node_based_graph));

Expand Down
7 changes: 5 additions & 2 deletions include/extractor/guidance/driveway_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ namespace guidance
class DrivewayHandler final : public IntersectionHandler
{
public:
DrivewayHandler(const IntersectionGenerator &intersection_generator,
const util::NodeBasedDynamicGraph &node_based_graph,
DrivewayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container,
const std::vector<util::Coordinate> &coordinates,
const extractor::CompressedEdgeContainer &compressed_geometries,
const RestrictionMap &node_restriction_map,
const std::unordered_set<NodeID> &barrier_nodes,
const guidance::TurnLanesIndexedArray &turn_lanes_data,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table);

Expand Down
8 changes: 0 additions & 8 deletions include/extractor/guidance/intersection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ inline auto makeCompareShapeDataByBearing(const double base_bearing)
};
}

inline auto makeCompareShapeDataAngleToBearing(const double base_bearing)
{
return [base_bearing](const auto &lhs, const auto &rhs) {
return util::bearing::angleBetween(lhs.bearing, base_bearing) <
util::bearing::angleBetween(rhs.bearing, base_bearing);
};
}

inline auto makeCompareAngularDeviation(const double angle)
{
return [angle](const auto &lhs, const auto &rhs) {
Expand Down
Loading