Skip to content

Commit 3aba2bc

Browse files
karenzsheaTheMarex
authored andcommitted
expose data about turning onto restricted roads to turn function
1 parent c42478f commit 3aba2bc

19 files changed

+210
-103
lines changed

features/car/access.feature

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,13 @@ Feature: Car - Restricted access
119119
| permissive | x |
120120
| designated | x |
121121
| no | |
122-
| private | |
122+
| private | x |
123123
| agricultural | |
124124
| forestry | |
125125
| psv | |
126-
| delivery | |
126+
| delivery | x |
127127
| some_tag | x |
128+
| destination | x |
128129

129130

130131
Scenario: Car - Access tags on nodes
@@ -134,11 +135,11 @@ Feature: Car - Restricted access
134135
| permissive | x |
135136
| designated | x |
136137
| no | |
137-
| private | |
138+
| private | x |
138139
| agricultural | |
139140
| forestry | |
140141
| psv | |
141-
| delivery | |
142+
| delivery | x |
142143
| some_tag | x |
143144

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

157158
Scenario: Car - Access combinations
158159
Then routability should be
159-
| highway | accesss | vehicle | motor_vehicle | motorcar | bothw |
160-
| runway | private | | | permissive | x |
161-
| primary | forestry | | yes | | x |
162-
| cycleway | | | designated | | x |
163-
| residential | | yes | no | | |
164-
| motorway | yes | permissive | | private | |
165-
| trunk | agricultural | designated | permissive | no | |
166-
| pedestrian | | | | | |
167-
| pedestrian | | | | destination | x |
160+
| highway | access | vehicle | motor_vehicle | motorcar | forw | backw | # |
161+
| runway | private | | | permissive | x | x | |
162+
| primary | forestry | | yes | | x | x | |
163+
| cycleway | | | designated | | x | x | |
164+
| residential | | yes | no | | | | |
165+
| motorway | yes | permissive | | private | x | | implied oneway |
166+
| trunk | agricultural | designated | permissive | no | | | |
167+
| pedestrian | | | | | | | |
168+
| pedestrian | | | | destination | x | x | |
168169

169170
Scenario: Car - Ignore access tags for other modes
170171
Then routability should be
@@ -182,7 +183,7 @@ Feature: Car - Restricted access
182183
Scenario: Car - designated HOV ways are rated low
183184
Then routability should be
184185
| highway | hov | bothw | forw_rate | backw_rate |
185-
| primary | designated | x | 2 | 2 |
186+
| primary | designated | x | 18 | 18 |
186187
| primary | yes | x | 18 | 18 |
187188
| primary | no | x | 18 | 18 |
188189

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

199200
@hov
200201
Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated)
201202
Then routability should be
202203
| highway | hov:lanes:forward | hov:lanes:backward | hov:lanes | oneway | forw | backw | forw_rate | backw_rate |
203-
| primary | designated | designated | | | x | x | 2 | 2 |
204-
| primary | | designated | | | x | x | 18 | 2 |
205-
| primary | designated | | | | x | x | 2 | 18 |
206-
| primary | designated\|designated | designated\|designated | | | x | x | 2 | 2 |
204+
| primary | designated | designated | | | x | x | 18 | 18 |
205+
| primary | | designated | | | x | x | 18 | 18 |
206+
| primary | designated | | | | x | x | 18 | 18 |
207+
| primary | designated\|designated | designated\|designated | | | x | x | 18 | 18 |
207208
| primary | designated\|no | designated\|no | | | x | x | 18 | 18 |
208209
| primary | yes\|no | yes\|no | | | x | x | 18 | 18 |
209210
| primary | | | | | x | x | 18 | 18 |
210211
| primary | designated | | | -1 | | x | | 18 |
211-
| primary | | designated | | -1 | | x | | 2 |
212-
| primary | | | designated | yes | x | | 2 | |
213-
| primary | | | designated | -1 | | x | | 2 |
212+
| primary | | designated | | -1 | | x | | 18 |
213+
| primary | | | designated | yes | x | | 18 | |
214+
| primary | | | designated | -1 | | x | | 18 |
214215
| primary | | | designated\| | yes | x | | 18 | |
215216
| primary | | | designated\| | -1 | | x | | 18 |
216-
| primary | | | designated\|designated | yes | x | | 2 | |
217-
| primary | | | designated\|designated | -1 | | x | | 2 |
217+
| primary | | | designated\|designated | yes | x | | 18 | |
218+
| primary | | | designated\|designated | -1 | | x | | 18 |
218219
| primary | | | designated\|yes | yes | x | | 18 | |
219220
| primary | | | designated\|no | -1 | | x | | 18 |
220221

@@ -250,7 +251,7 @@ Feature: Car - Restricted access
250251
| gate | yes | x |
251252
| gate | permissive | x |
252253
| gate | designated | x |
253-
| gate | private | |
254+
| gate | private | x |
254255
| gate | garbagetag | x |
255256

256257
Scenario: Car - a way with conditional access

features/car/barrier.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ Feature: Car - Barriers
2929
| gate | permissive | x |
3030
| gate | designated | x |
3131
| gate | no | |
32-
| gate | private | |
32+
| gate | private | x |
3333
| gate | agricultural | |
3434
| wall | | |
3535
| wall | yes | x |
3636
| wall | permissive | x |
3737
| wall | designated | x |
3838
| wall | no | |
39-
| wall | private | |
39+
| wall | private | x |
4040
| wall | agricultural | |
4141

4242
Scenario: Car - Rising bollard exception for barriers

features/car/destination.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@routing @car @destination @todo
1+
@routing @car @destination
22
Feature: Car - Destination only, no passing through
33

44
Background:

features/car/hov.feature

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@routing @car @hov
2+
Feature: Car - Handle driving
3+
4+
Background:
5+
Given the profile "car"
6+
And a grid size of 100 meters
7+
8+
Scenario: Car - Avoid hov when not on hov
9+
Given the node map
10+
"""
11+
b=========c========================e====j
12+
~ ~ ~
13+
a ~ f----m
14+
| i |
15+
| | ----------------l
16+
| | /
17+
g_______________h______k_____n
18+
"""
19+
20+
And the ways
21+
| nodes | highway | hov |
22+
| ab | motorway_link | |
23+
| bcej | motorway | designated |
24+
| ag | primary | |
25+
| ghkn | primary | |
26+
| ih | primary | |
27+
| kl | secondary | |
28+
| lf | secondary | |
29+
| ci | motorway_link | |
30+
| ef | motorway_link | |
31+
| fm | secondary | |
32+
33+
When I route I should get
34+
| from | to | route |
35+
| a | m | ag,ghkn,kl,lf,fm,fm |
36+
| c | m | bcej,ef,fm,fm |

features/car/surface.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ Feature: Car - Surfaces
4040
| highway | access | tracktype | smoothness | surface | forw | backw |
4141
| motorway | | | | | x | |
4242
| motorway | no | grade1 | excellent | asphalt | | |
43-
| motorway | private | grade1 | excellent | asphalt | | |
43+
| motorway | private | grade1 | excellent | asphalt | x | |
4444
| motorway | agricultural | grade1 | excellent | asphalt | | |
4545
| motorway | forestry | grade1 | excellent | asphalt | | |
4646
| motorway | emergency | grade1 | excellent | asphalt | | |
4747
| primary | | | | | x | x |
48+
| primary | private | grade1 | excellent | asphalt | x | x |
4849
| primary | no | grade1 | excellent | asphalt | | |
49-
| primary | private | grade1 | excellent | asphalt | | |
5050
| primary | agricultural | grade1 | excellent | asphalt | | |
5151
| primary | forestry | grade1 | excellent | asphalt | | |
5252
| primary | emergency | grade1 | excellent | asphalt | | |

include/extractor/extraction_turn.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ struct ExtractionTurn
1717
ExtractionTurn(const guidance::ConnectedRoad &turn, bool has_traffic_light)
1818
: angle(180. - turn.angle), turn_type(turn.instruction.type),
1919
direction_modifier(turn.instruction.direction_modifier),
20-
has_traffic_light(has_traffic_light), weight(0.), duration(0.)
20+
has_traffic_light(has_traffic_light), weight(0.), duration(0.), source_restricted(false),
21+
target_restricted(false)
2122
{
2223
}
2324

@@ -27,6 +28,8 @@ struct ExtractionTurn
2728
const bool has_traffic_light;
2829
double weight;
2930
double duration;
31+
bool source_restricted;
32+
bool target_restricted;
3033
};
3134
}
3235
}

include/extractor/extraction_way.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ struct ExtractionWay
5858
turn_lanes_forward.clear();
5959
turn_lanes_backward.clear();
6060
road_classification = guidance::RoadClassification();
61+
backward_restricted = false;
62+
forward_restricted = false;
6163
}
6264

6365
// These accessors exists because it's not possible to take the address of a bitfield,
@@ -106,6 +108,8 @@ struct ExtractionWay
106108
bool roundabout;
107109
bool circular;
108110
bool is_startpoint;
111+
bool backward_restricted;
112+
bool forward_restricted;
109113
TravelMode forward_travel_mode : 4;
110114
TravelMode backward_travel_mode : 4;
111115
guidance::RoadClassification road_classification;

include/extractor/internal_extractor_edge.hpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ struct InternalExtractorEdge
7070
false, // roundabout
7171
false, // circular
7272
true, // can be startpoint
73+
false, // local access only
74+
false, // split edge
7375
TRAVEL_MODE_INACCESSIBLE,
74-
false,
7576
guidance::TurnLaneType::empty,
7677
guidance::RoadClassification()),
7778
weight_data(), duration_data()
@@ -88,8 +89,9 @@ struct InternalExtractorEdge
8889
bool roundabout,
8990
bool circular,
9091
bool startpoint,
91-
TravelMode travel_mode,
92+
bool restricted,
9293
bool is_split,
94+
TravelMode travel_mode,
9395
LaneDescriptionID lane_description,
9496
guidance::RoadClassification road_classification,
9597
util::Coordinate source_coordinate)
@@ -103,8 +105,9 @@ struct InternalExtractorEdge
103105
roundabout,
104106
circular,
105107
startpoint,
106-
travel_mode,
108+
restricted,
107109
is_split,
110+
travel_mode,
108111
lane_description,
109112
std::move(road_classification)),
110113
weight_data(std::move(weight_data)), duration_data(std::move(duration_data)),
@@ -134,8 +137,9 @@ struct InternalExtractorEdge
134137
false, // roundabout
135138
false, // circular
136139
true, // can be startpoint
140+
false, // local access only
141+
false, // split edge
137142
TRAVEL_MODE_INACCESSIBLE,
138-
false,
139143
INVALID_LANE_DESCRIPTIONID,
140144
guidance::RoadClassification(),
141145
util::Coordinate());
@@ -152,8 +156,9 @@ struct InternalExtractorEdge
152156
false, // roundabout
153157
false, // circular
154158
true, // can be startpoint
159+
false, // local access only
160+
false, // split edge
155161
TRAVEL_MODE_INACCESSIBLE,
156-
false,
157162
INVALID_LANE_DESCRIPTIONID,
158163
guidance::RoadClassification(),
159164
util::Coordinate());

0 commit comments

Comments
 (0)