mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 07:25:47 +03:00
Refine the connectivity check for bus and bike lanes
Down to 12 connectivity problems in Montlake! Now that the dust has settled, manually check the 3 unit tests and confirm the goldenfile diffs.
This commit is contained in:
parent
7af86a9e59
commit
2dd611fd73
@ -6,7 +6,7 @@ use nbez::{Bez3o, BezCurve, Point2d};
|
||||
use geom::{Angle, Distance, Line, PolyLine, Pt2D};
|
||||
|
||||
use crate::raw::RestrictionType;
|
||||
use crate::{Intersection, Lane, LaneID, Map, RoadID, Turn, TurnID, TurnType};
|
||||
use crate::{Intersection, Lane, LaneID, LaneType, Map, RoadID, Turn, TurnID, TurnType};
|
||||
|
||||
/// Generate all driving and walking turns at an intersection, accounting for OSM turn restrictions.
|
||||
pub fn make_all_turns(map: &Map, i: &Intersection) -> Vec<Turn> {
|
||||
@ -137,10 +137,23 @@ pub fn verify_vehicle_connectivity(turns: &Vec<Turn>, i: &Intersection, map: &Ma
|
||||
}
|
||||
|
||||
for turn in turns {
|
||||
if map.get_l(turn.id.src).lane_type == map.get_l(turn.id.dst).lane_type {
|
||||
let src_lt = map.get_l(turn.id.src).lane_type;
|
||||
let dst_lt = map.get_l(turn.id.dst).lane_type;
|
||||
|
||||
if src_lt == dst_lt {
|
||||
incoming_missing.remove(&turn.id.src);
|
||||
outgoing_missing.remove(&turn.id.dst);
|
||||
}
|
||||
|
||||
// But actually, if some of the orphaned lanes are bus or bike lanes, as long as they're
|
||||
// connected to something (even a different type), allow it. There's naturally places where
|
||||
// these dedicated lanes start or end.
|
||||
if src_lt == LaneType::Biking || src_lt == LaneType::Bus {
|
||||
incoming_missing.remove(&turn.id.src);
|
||||
}
|
||||
if dst_lt == LaneType::Biking || dst_lt == LaneType::Bus {
|
||||
outgoing_missing.remove(&turn.id.dst);
|
||||
}
|
||||
}
|
||||
|
||||
if !incoming_missing.is_empty() || !outgoing_missing.is_empty() {
|
||||
|
@ -1,10 +1,10 @@
|
||||
TurnID(Lane #2, Lane #6, Intersection #0) is a SharedSidewalkCorner
|
||||
TurnID(Lane #4, Lane #9, Intersection #0) is a Right
|
||||
TurnID(Lane #3, Lane #9, Intersection #0) is a Right
|
||||
TurnID(Lane #4, Lane #10, Intersection #0) is a Right
|
||||
TurnID(Lane #5, Lane #11, Intersection #0) is a SharedSidewalkCorner
|
||||
TurnID(Lane #6, Lane #2, Intersection #0) is a SharedSidewalkCorner
|
||||
TurnID(Lane #6, Lane #11, Intersection #0) is a Crosswalk
|
||||
TurnID(Lane #7, Lane #0, Intersection #0) is a Right
|
||||
TurnID(Lane #7, Lane #1, Intersection #0) is a Right
|
||||
TurnID(Lane #8, Lane #0, Intersection #0) is a Right
|
||||
TurnID(Lane #11, Lane #5, Intersection #0) is a SharedSidewalkCorner
|
||||
TurnID(Lane #11, Lane #6, Intersection #0) is a Crosswalk
|
||||
|
@ -15,10 +15,8 @@ TurnID(Lane #6, Lane #16, Intersection #0) is a SharedSidewalkCorner
|
||||
TurnID(Lane #7, Lane #3, Intersection #0) is a Straight
|
||||
TurnID(Lane #7, Lane #4, Intersection #0) is a Straight
|
||||
TurnID(Lane #7, Lane #15, Intersection #0) is a Right
|
||||
TurnID(Lane #7, Lane #21, Intersection #0) is a Left
|
||||
TurnID(Lane #8, Lane #3, Intersection #0) is a Straight
|
||||
TurnID(Lane #8, Lane #4, Intersection #0) is a Straight
|
||||
TurnID(Lane #8, Lane #21, Intersection #0) is a Left
|
||||
TurnID(Lane #9, Lane #20, Intersection #0) is a Left
|
||||
TurnID(Lane #9, Lane #21, Intersection #0) is a Left
|
||||
TurnID(Lane #12, Lane #6, Intersection #0) is a Crosswalk
|
||||
|
@ -10,6 +10,9 @@ TurnID(Lane #6, Lane #19, Intersection #0) is a Left
|
||||
TurnID(Lane #7, Lane #1, Intersection #0) is a Straight
|
||||
TurnID(Lane #7, Lane #2, Intersection #0) is a Straight
|
||||
TurnID(Lane #7, Lane #3, Intersection #0) is a Straight
|
||||
TurnID(Lane #7, Lane #17, Intersection #0) is a Left
|
||||
TurnID(Lane #7, Lane #18, Intersection #0) is a Left
|
||||
TurnID(Lane #7, Lane #19, Intersection #0) is a Left
|
||||
TurnID(Lane #8, Lane #1, Intersection #0) is a Straight
|
||||
TurnID(Lane #8, Lane #2, Intersection #0) is a Straight
|
||||
TurnID(Lane #8, Lane #3, Intersection #0) is a Straight
|
||||
|
@ -225,7 +225,7 @@ fn test_lane_changing(map: &Map) -> Result<()> {
|
||||
// This time limit was determined by watching the scenario manually. This test prevents the
|
||||
// time from regressing, which would probably indicate something breaking related to lane
|
||||
// selection.
|
||||
let limit = Duration::minutes(8) + Duration::seconds(10.0);
|
||||
let limit = Duration::minutes(8) + Duration::seconds(40.0);
|
||||
if sim.time() > Time::START_OF_DAY + limit {
|
||||
panic!(
|
||||
"Lane-changing scenario took {} to complete; it should be under {}",
|
||||
|
Loading…
Reference in New Issue
Block a user