From b618842ad207cd4bcba7a59ac025deec9dd627b5 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Sun, 18 Nov 2018 17:02:30 -0800 Subject: [PATCH] WIP woops, found a bug with bike_reached_end --- docs/design/code.md | 4 ++++ sim/src/driving.rs | 1 + sim/src/sim.rs | 4 ++-- sim/src/spawn.rs | 3 ++- sim/src/walking.rs | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/design/code.md b/docs/design/code.md index 41098a4cba..c401ea928d 100644 --- a/docs/design/code.md +++ b/docs/design/code.md @@ -118,3 +118,7 @@ necessary to plumb more log context anyway. At some point, geometry was a separate layer from the graph base-layer of map_model. That doesn't work -- we can't even reason about what turns logically exist without operating on cleaned-up geometry. + +## IDs + +Should LaneID have LaneType bundled in for convenience? CarID and VehicleType? diff --git a/sim/src/driving.rs b/sim/src/driving.rs index e7b1878e50..c522459b28 100644 --- a/sim/src/driving.rs +++ b/sim/src/driving.rs @@ -584,6 +584,7 @@ impl DrivingSimState { let mut finished_parking: Vec = Vec::new(); let mut vanished_at_border: Vec = Vec::new(); + // The lane is the where the bike ended, so NOT a sidewalk let mut done_biking: Vec<(CarID, LaneID, Distance)> = Vec::new(); // Apply moves. Since lookahead behavior works, there are no conflicts to resolve, meaning diff --git a/sim/src/sim.rs b/sim/src/sim.rs index 3c2f3aa0bc..1309e5d715 100644 --- a/sim/src/sim.rs +++ b/sim/src/sim.rs @@ -192,10 +192,10 @@ impl Sim { for c in at_border { self.trips_state.car_reached_border(c, self.time); } - for (bike, lane, dist) in done_biking { + for (bike, last_lane, dist) in done_biking { // TODO push an event, backtrace, etc self.spawner - .bike_reached_end(self.time, bike, lane, dist, &mut self.trips_state); + .bike_reached_end(self.time, bike, last_lane, dist, &mut self.trips_state); } self.walking_state.populate_view(&mut view); diff --git a/sim/src/spawn.rs b/sim/src/spawn.rs index 63de8d6bfa..1bc5d14a2e 100644 --- a/sim/src/spawn.rs +++ b/sim/src/spawn.rs @@ -600,11 +600,12 @@ impl Spawner { &mut self, at: Tick, bike: CarID, - lane: LaneID, + last_lane: LaneID, dist: Distance, trips: &mut TripManager, ) { let (trip, ped, walk_to) = trips.bike_reached_end(bike); + // TODO last_lane is not the sidewalk, we need to look that up self.enqueue_command(Command::Walk( at.next(), trip, diff --git a/sim/src/walking.rs b/sim/src/walking.rs index 51b55a349b..eb39a21681 100644 --- a/sim/src/walking.rs +++ b/sim/src/walking.rs @@ -66,6 +66,7 @@ impl SidewalkSpot { } pub fn bike_rack(sidewalk: LaneID, dist_along: Distance) -> SidewalkSpot { + // TODO verify the thing passed in is a sidewalk! SidewalkSpot { connection: SidewalkPOI::BikeRack, sidewalk,