stop crashing in downtown -- change pointless bike trip to walking

This commit is contained in:
Dustin Carlino 2019-11-19 18:33:07 -08:00
parent ba2206d02a
commit 8b76c2d6e6

View File

@ -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 // TODO These trips are just silently erased; they don't even show up as aborted
// trips! Really need to fix the underlying problem. // trips! Really need to fix the underlying problem.
if SidewalkSpot::bike_from_bike_rack(start.sidewalk_pos.lane(), map).is_none() { if SidewalkSpot::bike_from_bike_rack(start.sidewalk_pos.lane(), map).is_none() {
@ -134,7 +139,7 @@ impl TripSpawner {
); );
return; return;
} }
if let DrivingGoal::ParkNear(_) = goal { if let DrivingGoal::ParkNear(b) = goal {
let last_lane = goal.goal_pos(PathConstraints::Bike, map).lane(); let last_lane = goal.goal_pos(PathConstraints::Bike, map).lane();
// If bike_to_sidewalk works, then SidewalkSpot::bike_rack should too. // If bike_to_sidewalk works, then SidewalkSpot::bike_rack should too.
if map if map
@ -148,6 +153,24 @@ impl TripSpawner {
); );
return; 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 { .. } => {} TripSpec::UsingTransit { .. } => {}