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

Penalize turns from non-local access only edges to local access only edges #3721

Merged
merged 1 commit into from
Feb 20, 2017
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
51 changes: 26 additions & 25 deletions features/car/access.feature
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ Feature: Car - Restricted access
| permissive | x |
| designated | x |
| no | |
| private | |
| private | x |
| agricultural | |
| forestry | |
| psv | |
| delivery | |
| delivery | x |
| some_tag | x |
| destination | x |


Scenario: Car - Access tags on nodes
Expand All @@ -134,11 +135,11 @@ Feature: Car - Restricted access
| permissive | x |
| designated | x |
| no | |
| private | |
| private | x |
| agricultural | |
| forestry | |
| psv | |
| delivery | |
| delivery | x |
| some_tag | x |

Scenario: Car - Access tags on both node and way
Expand All @@ -156,15 +157,15 @@ Feature: Car - Restricted access

Scenario: Car - Access combinations
Then routability should be
| highway | accesss | vehicle | motor_vehicle | motorcar | bothw |
| runway | private | | | permissive | x |
| primary | forestry | | yes | | x |
| cycleway | | | designated | | x |
| residential | | yes | no | | |
| motorway | yes | permissive | | private | |
| trunk | agricultural | designated | permissive | no | |
| pedestrian | | | | | |
| pedestrian | | | | destination | x |
| highway | access | vehicle | motor_vehicle | motorcar | forw | backw | # |
| runway | private | | | permissive | x | x | |
| primary | forestry | | yes | | x | x | |
| cycleway | | | designated | | x | x | |
| residential | | yes | no | | | | |
| motorway | yes | permissive | | private | x | | implied oneway |
| trunk | agricultural | designated | permissive | no | | | |
| pedestrian | | | | | | | |
| pedestrian | | | | destination | x | x | |

Scenario: Car - Ignore access tags for other modes
Then routability should be
Expand All @@ -182,7 +183,7 @@ Feature: Car - Restricted access
Scenario: Car - designated HOV ways are rated low
Then routability should be
| highway | hov | bothw | forw_rate | backw_rate |
| primary | designated | x | 2 | 2 |
| primary | designated | x | 18 | 18 |
| primary | yes | x | 18 | 18 |
| primary | no | x | 18 | 18 |

Expand All @@ -193,28 +194,28 @@ Feature: Car - Restricted access
Scenario: Car - I-66 use HOV-only roads with heavy penalty
Then routability should be
| highway | hov | hov:lanes | lanes | access | oneway | forw | backw | forw_rate |
| motorway | designated | designated\|designated\|designated | 3 | hov | yes | x | | 3 |
| motorway | designated | designated\|designated\|designated | 3 | hov | yes | x | | 25 |
| motorway | lane | | 3 | designated | yes | x | | 25 |

@hov
Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated)
Then routability should be
| highway | hov:lanes:forward | hov:lanes:backward | hov:lanes | oneway | forw | backw | forw_rate | backw_rate |
| primary | designated | designated | | | x | x | 2 | 2 |
| primary | | designated | | | x | x | 18 | 2 |
| primary | designated | | | | x | x | 2 | 18 |
| primary | designated\|designated | designated\|designated | | | x | x | 2 | 2 |
| primary | designated | designated | | | x | x | 18 | 18 |
| primary | | designated | | | x | x | 18 | 18 |
| primary | designated | | | | x | x | 18 | 18 |
| primary | designated\|designated | designated\|designated | | | x | x | 18 | 18 |
| primary | designated\|no | designated\|no | | | x | x | 18 | 18 |
| primary | yes\|no | yes\|no | | | x | x | 18 | 18 |
| primary | | | | | x | x | 18 | 18 |
| primary | designated | | | -1 | | x | | 18 |
| primary | | designated | | -1 | | x | | 2 |
| primary | | | designated | yes | x | | 2 | |
| primary | | | designated | -1 | | x | | 2 |
| primary | | designated | | -1 | | x | | 18 |
| primary | | | designated | yes | x | | 18 | |
| primary | | | designated | -1 | | x | | 18 |
| primary | | | designated\| | yes | x | | 18 | |
| primary | | | designated\| | -1 | | x | | 18 |
| primary | | | designated\|designated | yes | x | | 2 | |
| primary | | | designated\|designated | -1 | | x | | 2 |
| primary | | | designated\|designated | yes | x | | 18 | |
| primary | | | designated\|designated | -1 | | x | | 18 |
| primary | | | designated\|yes | yes | x | | 18 | |
| primary | | | designated\|no | -1 | | x | | 18 |

Expand Down Expand Up @@ -250,7 +251,7 @@ Feature: Car - Restricted access
| gate | yes | x |
| gate | permissive | x |
| gate | designated | x |
| gate | private | |
| gate | private | x |
| gate | garbagetag | x |

Scenario: Car - a way with conditional access
Expand Down
4 changes: 2 additions & 2 deletions features/car/barrier.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ Feature: Car - Barriers
| gate | permissive | x |
| gate | designated | x |
| gate | no | |
| gate | private | |
| gate | private | x |
| gate | agricultural | |
| wall | | |
| wall | yes | x |
| wall | permissive | x |
| wall | designated | x |
| wall | no | |
| wall | private | |
| wall | private | x |
| wall | agricultural | |

Scenario: Car - Rising bollard exception for barriers
Expand Down
2 changes: 1 addition & 1 deletion features/car/destination.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@routing @car @destination @todo
@routing @car @destination
Feature: Car - Destination only, no passing through

Background:
Expand Down
36 changes: 36 additions & 0 deletions features/car/hov.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@routing @car @hov
Feature: Car - Handle driving

Background:
Given the profile "car"
And a grid size of 100 meters

Scenario: Car - Avoid hov when not on hov
Given the node map
"""
b=========c========================e====j
~ ~ ~
a ~ f----m
| i |
| | ----------------l
| | /
g_______________h______k_____n
"""

And the ways
| nodes | highway | hov |
| ab | motorway_link | |
| bcej | motorway | designated |
| ag | primary | |
| ghkn | primary | |
| ih | primary | |
| kl | secondary | |
| lf | secondary | |
| ci | motorway_link | |
| ef | motorway_link | |
| fm | secondary | |

When I route I should get
| from | to | route |
| a | m | ag,ghkn,kl,lf,fm,fm |
| c | m | bcej,ef,fm,fm |
4 changes: 2 additions & 2 deletions features/car/surface.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ Feature: Car - Surfaces
| highway | access | tracktype | smoothness | surface | forw | backw |
| motorway | | | | | x | |
| motorway | no | grade1 | excellent | asphalt | | |
| motorway | private | grade1 | excellent | asphalt | | |
| motorway | private | grade1 | excellent | asphalt | x | |
| motorway | agricultural | grade1 | excellent | asphalt | | |
| motorway | forestry | grade1 | excellent | asphalt | | |
| motorway | emergency | grade1 | excellent | asphalt | | |
| primary | | | | | x | x |
| primary | private | grade1 | excellent | asphalt | x | x |
| primary | no | grade1 | excellent | asphalt | | |
| primary | private | grade1 | excellent | asphalt | | |
| primary | agricultural | grade1 | excellent | asphalt | | |
| primary | forestry | grade1 | excellent | asphalt | | |
| primary | emergency | grade1 | excellent | asphalt | | |
Expand Down
5 changes: 4 additions & 1 deletion include/extractor/extraction_turn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ struct ExtractionTurn
ExtractionTurn(const guidance::ConnectedRoad &turn, bool has_traffic_light)
: angle(180. - turn.angle), turn_type(turn.instruction.type),
direction_modifier(turn.instruction.direction_modifier),
has_traffic_light(has_traffic_light), weight(0.), duration(0.)
has_traffic_light(has_traffic_light), weight(0.), duration(0.), source_restricted(false),
target_restricted(false)
{
}

Expand All @@ -27,6 +28,8 @@ struct ExtractionTurn
const bool has_traffic_light;
double weight;
double duration;
bool source_restricted;
bool target_restricted;
};
}
}
Expand Down
4 changes: 4 additions & 0 deletions include/extractor/extraction_way.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ struct ExtractionWay
turn_lanes_forward.clear();
turn_lanes_backward.clear();
road_classification = guidance::RoadClassification();
backward_restricted = false;
forward_restricted = false;
}

// These accessors exists because it's not possible to take the address of a bitfield,
Expand Down Expand Up @@ -106,6 +108,8 @@ struct ExtractionWay
bool roundabout;
bool circular;
bool is_startpoint;
bool backward_restricted;
bool forward_restricted;
TravelMode forward_travel_mode : 4;
TravelMode backward_travel_mode : 4;
guidance::RoadClassification road_classification;
Expand Down
15 changes: 10 additions & 5 deletions include/extractor/internal_extractor_edge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ struct InternalExtractorEdge
false, // roundabout
false, // circular
true, // can be startpoint
false, // local access only
false, // split edge
TRAVEL_MODE_INACCESSIBLE,
false,
guidance::TurnLaneType::empty,
guidance::RoadClassification()),
weight_data(), duration_data()
Expand All @@ -88,8 +89,9 @@ struct InternalExtractorEdge
bool roundabout,
bool circular,
bool startpoint,
TravelMode travel_mode,
bool restricted,
bool is_split,
TravelMode travel_mode,
LaneDescriptionID lane_description,
guidance::RoadClassification road_classification,
util::Coordinate source_coordinate)
Expand All @@ -103,8 +105,9 @@ struct InternalExtractorEdge
roundabout,
circular,
startpoint,
travel_mode,
restricted,
is_split,
travel_mode,
lane_description,
std::move(road_classification)),
weight_data(std::move(weight_data)), duration_data(std::move(duration_data)),
Expand Down Expand Up @@ -134,8 +137,9 @@ struct InternalExtractorEdge
false, // roundabout
false, // circular
true, // can be startpoint
false, // local access only
false, // split edge
TRAVEL_MODE_INACCESSIBLE,
false,
INVALID_LANE_DESCRIPTIONID,
guidance::RoadClassification(),
util::Coordinate());
Expand All @@ -152,8 +156,9 @@ struct InternalExtractorEdge
false, // roundabout
false, // circular
true, // can be startpoint
false, // local access only
false, // split edge
TRAVEL_MODE_INACCESSIBLE,
false,
INVALID_LANE_DESCRIPTIONID,
guidance::RoadClassification(),
util::Coordinate());
Expand Down
Loading