Commit Graph

1191 Commits

Author SHA1 Message Date
Dustin Carlino
53f35f5de1 Nuke pedestrians walking to deleted cars. #312 2020-09-09 15:03:14 -07:00
Dustin Carlino
39290f899c Handle some of the live changes to parking by deleting parked cars on
edited lanes. #312
2020-09-09 15:03:14 -07:00
Dustin Carlino
61acf25b8e Initialize intersections converted live to traffic signals. #312 2020-09-09 15:03:14 -07:00
Dustin Carlino
d8011a90f4 Handle live edits by just aborting any current trips that cross an
edited road or closed intersection. #312

Along the way, refactor more context plumbing in DrivingSimState.
2020-09-09 15:03:14 -07:00
Dustin Carlino
5be4c2ca84 Add an API to add a new trip in the middle of the simulation. Fixes #313
[rebuild]
2020-09-06 13:53:31 -07:00
Dustin Carlino
193a3b1515 Restructure the trip mode choice in one of the activity models to more clearly branch based on trip distance, for #227 2020-09-04 11:15:17 -07:00
Dustin Carlino
f610c66572 Remove the weird shifting/angle inversions from DrivingSide. First step
of #311. Tested to not break righthand maps.
2020-09-04 10:01:06 -07:00
Dustin Carlino
74aca40c0c
Mechanicallyish rename TurnGroup -> Movement for #197, as decided in (#306)
https://github.com/dabreegster/abstreet/pull/302#discussion_r479571931
2020-08-29 15:18:54 -07:00
Dustin Carlino
a36ef99c06
Rename Phase -> Stage, to be more in line with standard traffic signal (#302)
controller terminology. Part of #197.

Holding off on touching PhaseType and all of the serialized
seattle_traffic_signals format, since this will all change in Kyle's PR
anyway.
2020-08-28 17:19:23 -07:00
Dustin Carlino
f662d9e34f Get rid of PartialEq on all of the Sim structs. It was originally there for a unit test that simulations are deterministic, but that test is long gone. (Determinism is now tested a bit more indirectly, but usefully, by looking for diffs to prebaked results. It could also be done by diffing serialized Sims.) 2020-08-28 14:26:22 -07:00
Michael Kirk
e5620aeb10 configurable "jump to delay" 2020-08-28 13:20:05 -07:00
Dustin Carlino
b6a4657dbb Whittle down more deprecated Road stuff 2020-08-25 12:08:54 -07:00
Dustin Carlino
aa3bd5073b Make some new methods on Road to handle child lanes from left-to-right,
not split by direction. Update many callers, and lock down the
visibility of the old methods.

Tested a few maps manually to make sure there's no behavioral diff. Only
problem right now is the z-order of adjacent lanes covering up half of
the white stripe sometimes. Have some ideas to fix that later, and not
_super_ important in the meantime.
2020-08-25 12:08:54 -07:00
Dustin Carlino
4005adecf8 Refactor: create a Direction enum, in preparation for two-way cycletracks on one side of a road. 2020-08-24 13:30:13 -07:00
Dustin Carlino
0fd40bd04e Explicitly mark buildings with private off-street parking from OSM. 2ebf463635 added parking icons to all buildings with > 10 spots, but this makes the downtown map look ridiculous. The intention was to show the tagged buildings, so just go do that. 2020-08-23 11:09:00 -07:00
Dustin Carlino
70dd9fcad1 Switch to 'reserving' the congestion cap when starting a trip, not when entering the road. In the initial tests, all the drivers rush for a road at once. They all pass the check initially, then violate it when they reach it. It's a little more reasonable to enforce the cap earlier, even though we can't really predict when the car will reach the zone, so the time is a little off. 2020-08-23 09:54:39 -07:00
Dustin Carlino
6250cb8393 Be more specific about access restrictions in info panel. For capped roads, print the value and current counter. 2020-08-23 09:41:12 -07:00
Dustin Carlino
8a05a88f0c Refactor the plumbing of different parts of Sim. More context at
https://old.reddit.com/r/rust/comments/idjcua/passing_all_other_fields_of_a_struct_to_one/.
2020-08-22 21:46:57 -07:00
Dustin Carlino
11832aa606 Record throughput through a traffic signal by direction, expose through
the API (#245), and beef up the Python example.

Impact to prebaked file size is tiny -- for lakeslice, the original
intersection_thruput is 2MB and the new traffic_signal_thruput is 435KB.

[rebuild]
2020-08-22 09:13:16 -07:00
Dustin Carlino
21ab1d7d6f Before starting the driving portion of a trip, check if it'll cross a
zone with a cap that's been exceeded. If so, abort the trip.

This is 90% plumbing... need to rethink how pieces of the simulation are
passed around.
2020-08-20 16:38:45 -07:00
Dustin Carlino
2bfb5d5ac4 Track how many cars are entering zones with caps.
Tested by print debugging and comparing to throughput stats
2020-08-20 16:38:45 -07:00
Dustin Carlino
fa83554eb4 Consolidate code for loading edits from JSON 2020-08-20 16:33:08 -07:00
Dustin Carlino
084b9d74cd Store delay for traffic signals per direction of travel, using a compressed representation of turn groups. No substantial increase in prebaked file size. 2020-08-20 16:21:52 -07:00
Dustin Carlino
f31c4ec7fb New tool to union two scenarios. One use case is manually defining some
new trips, then seeing the impact they'll have on the normal weekday
scenario. So how much externality would be caused by a bunch of new
trips if some building is built?

Demo showing the whole flow: https://youtu.be/adpED0KGQ7Q. Why do those
few trips at the beginning impact some later trips so much? Who knows.
Likely parking spots get gobbled up.
2020-08-19 17:49:39 -07:00
Dustin Carlino
d427893843 Model parking lots with extra un-renderable spots. This fixes #150, lots
without aisles, and #265, multi-story garages.
2020-08-19 17:19:54 -07:00
Dustin Carlino
a6a454d326 Add a tool to import external traffic demand data. The format and way of
calling the tool (not in the importer?) are just experiments right now.
2020-08-17 12:32:09 -07:00
Dustin Carlino
e5f7136f27 parallelize the proletariat robot activity model for #154 [rebuild] 2020-08-16 17:33:12 -07:00
Dustin Carlino
bef3434ac8 adjust the most egregious traffic signals downtown 2020-08-15 18:35:14 -07:00
Dustin Carlino
92d121ecd4 restore lakeslice to former glory, by allowing blocking-the-box at two intersections that're smushed together. had something like this a while ago, but I thought it became unnecessary when working on uber-turns a few weeks ago 2020-08-15 17:52:23 -07:00
Dustin Carlino
5bede4aca2 Start some initial UI for tuning offset of multiple intersections 2020-08-14 20:50:13 -07:00
Dustin Carlino
3f86af0dc0 Add back some primitive control for signal offset at a single
intersection. Interpret the value in the simulation layer again (it was
removed around bb3da1f8eb or so due to
being unused).
2020-08-14 20:50:13 -07:00
Dustin Carlino
e6c1d960ec In traffic=none mode, allow recording (most of) the manually specified
trips as a Scenario to later re-run. This is useful for quickly defining
"test cases" for development, and it's a start to a UI for letting
players specify (and eventually share) traffic patterns they define.
2020-08-14 18:53:39 -07:00
Dustin Carlino
25ee39af89 Prepare to flag-guard an experiment to handle uber-turns differently
when allowing a car to start a turn. It causes
https://github.com/dabreegster/abstreet/pull/276#discussion_r470269394
and also the lakeslice scenario to gridlock (a regression that began a
few weeks ago). But keep the flag on for now, to keep the montlake
scenaro running at least.

https://dabreegster.github.io/abstreet/trafficsim/gridlock.html has
notes about the many different causes and in-progress fixes for
gridlock. This experiment hasn't been explained very well yet, but
roughly it treats a cluster of traffic signals as one, so that once a
vehicle gains access through the first light, they guarantee immediate
access through the entire sequence. This interacts with the "don't block
the box" behavior (don't start a turn if you might get stuck in the
intersection) strangely.

While attempting to get this rollback to work, I also had to manually
redraw the traffic lights for a few manually specified intersections.
They became out-of-date a few weeks ago when I cleaned up the OSM
geometry upstream and the referenced IDs changed, and I hadn't bothered
to re-time the signals. Luckily, with the new multi-signal editor,
redrawing the timing was much easier than originally!

Regenerated all data and lots of bus routes vanished. Plan to get back
to that project soon.
2020-08-14 11:33:25 -07:00
Dustin Carlino
11cefb118a And the same thing for OriginalIntersection
Actually, don't need to regenerate map data. Thanks to the magic of
zero-cost wrapper types, the binary format is the same.
2020-08-13 11:48:13 -07:00
Dustin Carlino
31e8c654d2 prototype directional traffic signal demand viz over time 2020-08-10 13:19:47 -07:00
Dustin Carlino
d1e9e38e82 refactor for #231: use typed OSM IDs everywhere, dedupe URL code
have to regen, the binary format has changed
2020-08-08 16:09:36 -07:00
Dustin Carlino
e35c69f6f3 ezgui Wizard (and its pet Cloneable)
Here lies a weird coroutine experiment
09/20/2018 - 08/07/2020
2020-08-07 14:04:41 -07:00
Dustin Carlino
00e8b8a8c2 work around ballard map crashing from tiny border. i tried valiantly to
extend short borders, but it can't be done in convert_osm clip. has to
happen later when trimming and making intersection geometry. too much of
a headache right now.

west seattle and krakow still broken because of short borders.

also grab fresh osm
2020-08-04 15:25:49 -07:00
Dustin Carlino
bcbf229eb7 rip out all users of the old find_closest_lane for #176.
- this gives offside support to bus/sidewalk matching, getting 11 more
  routes working in krakow
2020-08-03 17:56:58 -07:00
Dustin Carlino
f73516d183 start representing bus spawn rates explicitly 2020-08-03 13:12:02 -07:00
Dustin Carlino
fa0a73053b spawn cars a little farther along borders, to avoid a rendering crash 2020-08-03 11:24:53 -07:00
Dustin Carlino
940d2265c0 spawning buses at 0.01m on a non-border lane can break, because other cars approach, and the buffer distance gets broken. instead, spawn the buses a few lanes away, if needed. fixes #260
now only ~400 agents left in lakeslice by end!
2020-08-03 11:08:21 -07:00
Dustin Carlino
bea6e2edf2 snap bus stop driving positions at least 0.1m away from the start of the
lane, to handle buses spawning at the start

not regenerating everything yet
2020-08-03 09:04:16 -07:00
Dustin Carlino
3cd28cb44f fix buses not starting at a border. they were skipping the first stop, that's why there were so many stranded agents in lakeslice. still some buses failing to spawn, causing some more stranded 2020-08-01 18:53:40 -07:00
Dustin Carlino
c31d876f61 oh no, the new biking_connection is crashing in a few maps, where some of the separated bike trails are still missing. gracefully degrade. this is getting convoluted again, filed #258 to cleanup. 2020-08-01 10:26:44 -07:00
Dustin Carlino
2f76c7ac12 powered by a clear head and fresh blackberries, fix #64 2020-07-31 19:58:44 -07:00
Dustin Carlino
f7df49f512 fix a rendering bug with shifting cars for parking. ALMOST handle parking lane on opposite side of a driving lane, but there's a crash i cant understand, so disabled. #64 2020-07-31 17:39:04 -07:00
Dustin Carlino
ae31739dea almost support off-side parking lanes. only remaining bug is cars
ignoring parking spots if the parking lane is in the opposite direction.
workaround is to reverse the lane. dealing with that bug next though.

part of #64 and #176. fixes #109
2020-07-31 16:23:58 -07:00
Dustin Carlino
d7968713fc don't need to explicitly store parking blackhole redirect, just a bit.
and have a separate bit for bikes. use that to handle bikes going to
borders. finally closes #221, progress on #176.
2020-07-31 15:43:15 -07:00
Dustin Carlino
5c506f726c total overhaul to building<->bike connections for #221 and #176. bikes
will start/stop directly in front of a building driveway, when possible.

still need to handle the case when the bikeable position isn't connected
to most to the graph (for buildings accessible only by footway and for
things around the border)
2020-07-31 14:28:40 -07:00