mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 23:43:25 +03:00
Swap left/right turns when generating traffic signal policies in the UK.
Verified by trying the "four-stage" template at some intersections. Now regenerating data.
This commit is contained in:
parent
6f0751111e
commit
68e406d26b
@ -61,9 +61,9 @@
|
|||||||
"compressed_size_bytes": 3653200
|
"compressed_size_bytes": 3653200
|
||||||
},
|
},
|
||||||
"data/input/cambridge/screenshots/great_kneighton.zip": {
|
"data/input/cambridge/screenshots/great_kneighton.zip": {
|
||||||
"checksum": "b235717d76eb42bcfb084c8cd75bb8f1",
|
"checksum": "2f25df16f5906715f67d2a36f86720aa",
|
||||||
"uncompressed_size_bytes": 43034261,
|
"uncompressed_size_bytes": 42821126,
|
||||||
"compressed_size_bytes": 43008636
|
"compressed_size_bytes": 42795366
|
||||||
},
|
},
|
||||||
"data/input/cheshire/osm/chapelford.osm": {
|
"data/input/cheshire/osm/chapelford.osm": {
|
||||||
"checksum": "da8daf2687f5fdccd483d4724c63e92e",
|
"checksum": "da8daf2687f5fdccd483d4724c63e92e",
|
||||||
@ -716,9 +716,9 @@
|
|||||||
"compressed_size_bytes": 8958635
|
"compressed_size_bytes": 8958635
|
||||||
},
|
},
|
||||||
"data/system/cambridge/maps/great_kneighton.bin": {
|
"data/system/cambridge/maps/great_kneighton.bin": {
|
||||||
"checksum": "e96e13b3bd39d7046bb8c66f4bf82903",
|
"checksum": "1b9b30ddedac25dcd44bcb07ab3167f8",
|
||||||
"uncompressed_size_bytes": 33205510,
|
"uncompressed_size_bytes": 33199644,
|
||||||
"compressed_size_bytes": 11726280
|
"compressed_size_bytes": 11724242
|
||||||
},
|
},
|
||||||
"data/system/cambridge/scenarios/great_kneighton/baseline.bin": {
|
"data/system/cambridge/scenarios/great_kneighton/baseline.bin": {
|
||||||
"checksum": "5bf4753521040da79b85cf80053794a1",
|
"checksum": "5bf4753521040da79b85cf80053794a1",
|
||||||
@ -731,9 +731,9 @@
|
|||||||
"compressed_size_bytes": 19234
|
"compressed_size_bytes": 19234
|
||||||
},
|
},
|
||||||
"data/system/cheshire/maps/chapelford.bin": {
|
"data/system/cheshire/maps/chapelford.bin": {
|
||||||
"checksum": "d9e22283fb9dead8313324210d1a7334",
|
"checksum": "1ea548d695deaad1fa045d9050e89329",
|
||||||
"uncompressed_size_bytes": 55235444,
|
"uncompressed_size_bytes": 55232315,
|
||||||
"compressed_size_bytes": 18844115
|
"compressed_size_bytes": 18838545
|
||||||
},
|
},
|
||||||
"data/system/detroit/maps/downtown.bin": {
|
"data/system/detroit/maps/downtown.bin": {
|
||||||
"checksum": "254736ae813951a49d987b60ec2b643e",
|
"checksum": "254736ae813951a49d987b60ec2b643e",
|
||||||
@ -751,29 +751,29 @@
|
|||||||
"compressed_size_bytes": 794704
|
"compressed_size_bytes": 794704
|
||||||
},
|
},
|
||||||
"data/system/leeds/maps/central.bin": {
|
"data/system/leeds/maps/central.bin": {
|
||||||
"checksum": "d922919392ce715bfeedca20a95d5842",
|
"checksum": "5d6db225bdc7eee535b99f9d8e9b0f2b",
|
||||||
"uncompressed_size_bytes": 31546671,
|
"uncompressed_size_bytes": 31543227,
|
||||||
"compressed_size_bytes": 10608418
|
"compressed_size_bytes": 10606562
|
||||||
},
|
},
|
||||||
"data/system/leeds/maps/huge.bin": {
|
"data/system/leeds/maps/huge.bin": {
|
||||||
"checksum": "4720e15252bcdb70f2a56cefd537c7d9",
|
"checksum": "62b091779feabf743092259cc7ca35db",
|
||||||
"uncompressed_size_bytes": 119938913,
|
"uncompressed_size_bytes": 119926264,
|
||||||
"compressed_size_bytes": 41226943
|
"compressed_size_bytes": 41216621
|
||||||
},
|
},
|
||||||
"data/system/leeds/maps/north.bin": {
|
"data/system/leeds/maps/north.bin": {
|
||||||
"checksum": "005953eda1980532e4553096f2234cb1",
|
"checksum": "a91dbfa2a170575f0987f6409b3f3cf1",
|
||||||
"uncompressed_size_bytes": 52277694,
|
"uncompressed_size_bytes": 52270428,
|
||||||
"compressed_size_bytes": 17977421
|
"compressed_size_bytes": 17972902
|
||||||
},
|
},
|
||||||
"data/system/leeds/maps/west.bin": {
|
"data/system/leeds/maps/west.bin": {
|
||||||
"checksum": "832a0c9633379ce4c75ecc7b072f3696",
|
"checksum": "8a164166cf61e20e0049a14a12ac9d3b",
|
||||||
"uncompressed_size_bytes": 44019439,
|
"uncompressed_size_bytes": 44014861,
|
||||||
"compressed_size_bytes": 15023857
|
"compressed_size_bytes": 15020248
|
||||||
},
|
},
|
||||||
"data/system/london/maps/southbank.bin": {
|
"data/system/london/maps/southbank.bin": {
|
||||||
"checksum": "d0f7dc86692fd28a8e7e75f00bbafaf5",
|
"checksum": "00d84694f4a90b5a699348f5d8c5ea63",
|
||||||
"uncompressed_size_bytes": 9111166,
|
"uncompressed_size_bytes": 9108429,
|
||||||
"compressed_size_bytes": 3037504
|
"compressed_size_bytes": 3036891
|
||||||
},
|
},
|
||||||
"data/system/montreal/maps/plateau.bin": {
|
"data/system/montreal/maps/plateau.bin": {
|
||||||
"checksum": "c4421dd74cf45f4277e108720b460895",
|
"checksum": "c4421dd74cf45f4277e108720b460895",
|
||||||
|
@ -3,8 +3,8 @@ use std::collections::HashSet;
|
|||||||
use geom::Duration;
|
use geom::Duration;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ControlTrafficSignal, IntersectionCluster, IntersectionID, Map, Movement, MovementID, RoadID,
|
ControlTrafficSignal, DrivingSide, IntersectionCluster, IntersectionID, Map, Movement,
|
||||||
Stage, StageType, TurnPriority, TurnType,
|
MovementID, RoadID, Stage, StageType, TurnPriority, TurnType,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Applies a bunch of heuristics to a single intersection, returning the valid results in
|
/// Applies a bunch of heuristics to a single intersection, returning the valid results in
|
||||||
@ -145,6 +145,7 @@ fn degenerate(map: &Map, i: IntersectionID) -> Option<ControlTrafficSignal> {
|
|||||||
let mut ts = new(i, map);
|
let mut ts = new(i, map);
|
||||||
make_stages(
|
make_stages(
|
||||||
&mut ts,
|
&mut ts,
|
||||||
|
map.config.driving_side,
|
||||||
vec![vec![(vec![r1, r2], TurnType::Straight, PROTECTED)]],
|
vec![vec![(vec![r1, r2], TurnType::Straight, PROTECTED)]],
|
||||||
);
|
);
|
||||||
Some(ts)
|
Some(ts)
|
||||||
@ -193,6 +194,7 @@ fn three_way(map: &Map, i: IntersectionID) -> Option<ControlTrafficSignal> {
|
|||||||
// Two-stage with no protected lefts, right turn on red, turning cars yield to peds
|
// Two-stage with no protected lefts, right turn on red, turning cars yield to peds
|
||||||
make_stages(
|
make_stages(
|
||||||
&mut ts,
|
&mut ts,
|
||||||
|
map.config.driving_side,
|
||||||
vec![
|
vec![
|
||||||
vec![
|
vec![
|
||||||
(vec![north, south], TurnType::Straight, PROTECTED),
|
(vec![north, south], TurnType::Straight, PROTECTED),
|
||||||
@ -226,6 +228,7 @@ fn four_way_four_stage(map: &Map, i: IntersectionID) -> Option<ControlTrafficSig
|
|||||||
let mut ts = new(i, map);
|
let mut ts = new(i, map);
|
||||||
make_stages(
|
make_stages(
|
||||||
&mut ts,
|
&mut ts,
|
||||||
|
map.config.driving_side,
|
||||||
vec![
|
vec![
|
||||||
vec![
|
vec![
|
||||||
(vec![north, south], TurnType::Straight, PROTECTED),
|
(vec![north, south], TurnType::Straight, PROTECTED),
|
||||||
@ -257,6 +260,7 @@ fn four_way_two_stage(map: &Map, i: IntersectionID) -> Option<ControlTrafficSign
|
|||||||
let mut ts = new(i, map);
|
let mut ts = new(i, map);
|
||||||
make_stages(
|
make_stages(
|
||||||
&mut ts,
|
&mut ts,
|
||||||
|
map.config.driving_side,
|
||||||
vec![
|
vec![
|
||||||
vec![
|
vec![
|
||||||
(vec![north, south], TurnType::Straight, PROTECTED),
|
(vec![north, south], TurnType::Straight, PROTECTED),
|
||||||
@ -341,12 +345,23 @@ const YIELD: bool = false;
|
|||||||
|
|
||||||
fn make_stages(
|
fn make_stages(
|
||||||
ts: &mut ControlTrafficSignal,
|
ts: &mut ControlTrafficSignal,
|
||||||
|
driving_side: DrivingSide,
|
||||||
stage_specs: Vec<Vec<(Vec<RoadID>, TurnType, bool)>>,
|
stage_specs: Vec<Vec<(Vec<RoadID>, TurnType, bool)>>,
|
||||||
) {
|
) {
|
||||||
for specs in stage_specs {
|
for specs in stage_specs {
|
||||||
let mut stage = Stage::new();
|
let mut stage = Stage::new();
|
||||||
|
|
||||||
for (roads, turn_type, protected) in specs.into_iter() {
|
for (roads, mut turn_type, protected) in specs.into_iter() {
|
||||||
|
// The heuristics are written assuming right turns are easy and lefts are hard, so
|
||||||
|
// invert in the UK.
|
||||||
|
if driving_side == DrivingSide::Left {
|
||||||
|
if turn_type == TurnType::Right {
|
||||||
|
turn_type = TurnType::Left;
|
||||||
|
} else if turn_type == TurnType::Left {
|
||||||
|
turn_type = TurnType::Right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for movement in ts.movements.values() {
|
for movement in ts.movements.values() {
|
||||||
if !roads.contains(&movement.id.from.id) || turn_type != movement.turn_type {
|
if !roads.contains(&movement.id.from.id) || turn_type != movement.turn_type {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user