From 8b76c2d6e69fcbad8423720d6e6c2ff589834366 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Tue, 19 Nov 2019 18:33:07 -0800 Subject: [PATCH] stop crashing in downtown -- change pointless bike trip to walking --- sim/src/make/spawner.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/sim/src/make/spawner.rs b/sim/src/make/spawner.rs index c6b5cc1bf4..72d72770d6 100644 --- a/sim/src/make/spawner.rs +++ b/sim/src/make/spawner.rs @@ -124,7 +124,12 @@ impl TripSpawner { ); } } - TripSpec::UsingBike { start, goal, .. } => { + TripSpec::UsingBike { + start, + goal, + ped_speed, + .. + } => { // TODO These trips are just silently erased; they don't even show up as aborted // trips! Really need to fix the underlying problem. if SidewalkSpot::bike_from_bike_rack(start.sidewalk_pos.lane(), map).is_none() { @@ -134,7 +139,7 @@ impl TripSpawner { ); return; } - if let DrivingGoal::ParkNear(_) = goal { + if let DrivingGoal::ParkNear(b) = goal { let last_lane = goal.goal_pos(PathConstraints::Bike, map).lane(); // If bike_to_sidewalk works, then SidewalkSpot::bike_rack should too. if map @@ -148,6 +153,24 @@ impl TripSpawner { ); return; } + // A bike trip going from one lane to the same lane should... just walk. + if start.sidewalk_pos.lane() == map.get_b(*b).sidewalk() { + println!( + "Bike trip from {:?} to {:?} will just walk; it's the same sidewalk!", + start, goal + ); + self.trips.push(( + start_time, + ped_id, + None, + TripSpec::JustWalking { + start: start.clone(), + goal: SidewalkSpot::building(*b, map), + ped_speed: *ped_speed, + }, + )); + return; + } } } TripSpec::UsingTransit { .. } => {}