-
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
Take stop and give way signs into account during routing #6426
base: master
Are you sure you want to change the base?
Changes from all commits
8a4af59
7f635f2
72ea34f
36f3a5e
3558ec9
4432756
350862d
9788317
c28a683
62298cf
be1b866
b887e72
eb72ca4
a7142ee
3080be5
ee008e7
7508262
3f7a629
04ee126
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
@routing @car @give_way_sign | ||
Feature: Car - Handle give way signs | ||
|
||
Background: | ||
Given the profile "car" | ||
|
||
Scenario: Car - Encounters a give way sign | ||
Given the node map | ||
""" | ||
a-1-b-2-c | ||
|
||
d-3-e-4-f | ||
|
||
g-h-i k-l-m | ||
| | | ||
j n | ||
|
||
""" | ||
|
||
And the ways | ||
| nodes | highway | | ||
| abc | primary | | ||
| def | primary | | ||
| ghi | primary | | ||
| klm | primary | | ||
| hj | primary | | ||
| ln | primary | | ||
|
||
And the nodes | ||
| node | highway | | ||
| e | give_way | | ||
| l | give_way | | ||
|
||
# TODO: give way signs with no direction has no any impact on routing at the moment | ||
When I route I should get | ||
| from | to | time | # | | ||
| 1 | 2 | 11.1s | no turn with no give way | | ||
| 3 | 4 | 11.1s | no turn with give way | | ||
| g | j | 18.7s | turn with no give way | | ||
| k | n | 18.7s | turn with give way | | ||
|
||
|
||
Scenario: Car - Give way direction | ||
Given the node map | ||
""" | ||
a-1-b-2-c | ||
|
||
d-3-e-4-f | ||
|
||
g-5-h-6-i | ||
|
||
j-7-k-8-l | ||
|
||
""" | ||
|
||
And the ways | ||
| nodes | highway | | ||
| abc | primary | | ||
| def | primary | | ||
| ghi | primary | | ||
| jkl | primary | | ||
|
||
And the nodes | ||
| node | highway | direction | | ||
| e | give_way | | | ||
| h | give_way | forward | | ||
| k | give_way | backward | | ||
When I route I should get | ||
| from | to | time | weight | # | | ||
| 1 | 2 | 11.1s | 11.1 | no turn with no give way | | ||
| 2 | 1 | 11.1s | 11.1 | no turn with no give way | | ||
| 3 | 4 | 11.1s | 11.1 | no turn with give way | | ||
| 4 | 3 | 11.1s | 11.1 | no turn with give way | | ||
| 5 | 6 | 12.6s | 12.6 | no turn with give way | | ||
| 6 | 5 | 11.1s | 11.1 | no turn with no give way | | ||
| 7 | 8 | 11.1s | 11.1 | no turn with no give way | | ||
| 8 | 7 | 12.6s | 12.6 | no turn with give way | |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
@routing @car @stop_sign | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @mjjbell ! May I ask you to take a look here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes if we're viewing all of them as node penalties applicable by direction, then it's basically the same code. If we wanted to model the impact of each sign/traffic light more accurately (e.g. junction size, unprotected turns, all the other stuff in #2652, etc) then we'd probably want to handle them differently, but I don't think we're at that stage yet. |
||
Feature: Car - Handle stop signs | ||
|
||
Background: | ||
Given the profile "car" | ||
|
||
Scenario: Car - Encounters a stop sign | ||
Given the node map | ||
""" | ||
a-1-b-2-c | ||
|
||
d-3-e-4-f | ||
|
||
g-h-i k-l-m | ||
| | | ||
j n | ||
|
||
""" | ||
|
||
And the ways | ||
| nodes | highway | | ||
| abc | primary | | ||
| def | primary | | ||
| ghi | primary | | ||
| klm | primary | | ||
| hj | primary | | ||
| ln | primary | | ||
|
||
And the nodes | ||
| node | highway | | ||
| e | stop | | ||
| l | stop | | ||
|
||
# TODO: stop signs with no direction has no any impact on routing at the moment | ||
When I route I should get | ||
| from | to | time | # | | ||
| 1 | 2 | 11.1s | no turn with no stop sign | | ||
| 3 | 4 | 11.1s | no turn with stop sign | | ||
| g | j | 18.7s | turn with no stop sign | | ||
| k | n | 18.7s | turn with stop sign | | ||
|
||
Scenario: Car - Stop sign direction | ||
Given the node map | ||
""" | ||
a-1-b-2-c | ||
|
||
d-3-e-4-f | ||
|
||
g-5-h-6-i | ||
|
||
j-7-k-8-l | ||
|
||
""" | ||
|
||
And the ways | ||
| nodes | highway | | ||
| abc | primary | | ||
| def | primary | | ||
| ghi | primary | | ||
| jkl | primary | | ||
|
||
And the nodes | ||
| node | highway | direction | | ||
| e | stop | | | ||
| h | stop | forward | | ||
| k | stop | backward | | ||
|
||
When I route I should get | ||
| from | to | time | weight | # | | ||
| 1 | 2 | 11.1s | 11.1 | no turn with no stop sign | | ||
| 2 | 1 | 11.1s | 11.1 | no turn with no stop sign | | ||
| 3 | 4 | 11.1s | 11.1 | no turn with stop sign | | ||
| 4 | 3 | 11.1s | 11.1 | no turn with stop sign | | ||
| 5 | 6 | 13.1s | 13.1 | no turn with stop sign | | ||
| 6 | 5 | 11.1s | 11.1 | no turn with no stop sign | | ||
| 7 | 8 | 11.1s | 11.1 | no turn with no stop sign | | ||
| 8 | 7 | 13.1s | 13.1 | no turn with stop sign | |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
@routing @testbot @turn_function | ||
Feature: Turn Function Information | ||
|
||
|
||
Background: | ||
Given the profile file | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#ifndef EXTRACTION_NODE_HPP | ||
#define EXTRACTION_NODE_HPP | ||
|
||
#include "traffic_lights.hpp" | ||
#include "traffic_flow_control_nodes.hpp" | ||
#include <cstdint> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed? |
||
|
||
namespace osrm | ||
{ | ||
|
@@ -10,14 +11,19 @@ namespace extractor | |
|
||
struct ExtractionNode | ||
{ | ||
ExtractionNode() : traffic_lights(TrafficLightClass::NONE), barrier(false) {} | ||
ExtractionNode() : traffic_lights(TrafficFlowControlNodeDirection::NONE), barrier(false) {} | ||
void clear() | ||
{ | ||
traffic_lights = TrafficLightClass::NONE; | ||
traffic_lights = TrafficFlowControlNodeDirection::NONE; | ||
stop_sign = TrafficFlowControlNodeDirection::NONE; | ||
give_way = TrafficFlowControlNodeDirection::NONE; | ||
barrier = false; | ||
} | ||
TrafficLightClass::Direction traffic_lights; | ||
TrafficFlowControlNodeDirection traffic_lights; | ||
bool barrier; | ||
|
||
TrafficFlowControlNodeDirection stop_sign; | ||
TrafficFlowControlNodeDirection give_way; | ||
}; | ||
} // namespace extractor | ||
} // namespace osrm | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
#include <string> | ||
#include <unordered_map> | ||
#include <unordered_set> | ||
|
||
namespace osmium | ||
{ | ||
|
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.
It is almost copy-paste of existing tests for traffic lights
osrm-backend/features/car/traffic_light_penalties.feature
Line 7 in afe3445
Probably worth having here all tests we have for traffic lights, but is there way to reduce copy-paste here somehow? E.g. somehow run the same test multiple times, but with different
highway
tag values for each run?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 expect there's some support for parametrization of tests, but we're on an ancient Cucumber version, so might take a lot of effort. Plus, having a separate file per penalty feature will allow the functionality to diverge if required.