Commit Graph

1288 Commits

Author SHA1 Message Date
Michael Kirk
2ed916e89f
show parking intent (#362) 2020-10-07 14:16:58 -07:00
Dustin Carlino
0f806b2055 Document the sim crate 2020-10-06 18:25:39 -07:00
Dustin Carlino
a3b7ed18cd Cache the unedited map, for #361 2020-10-06 16:58:48 -07:00
Dustin Carlino
84e50d561d Workaround one case of #361 in an expensive way: temporarily revert
map edits when viewing the "before" version of a trip.
2020-10-06 15:35:11 -07:00
Dustin Carlino
f258c50595 Organize import blocks using https://github.com/dabreegster/organize_rust_imports 2020-10-05 20:29:22 -07:00
Dustin Carlino
27d94945c6 Manually move mod block after the use block, to match what CLion does. 2020-10-05 20:29:22 -07:00
Dustin Carlino
178404bd0e Remove unused RNG stuff from abstutil, and start to think about how to tease it apart a bit 2020-10-05 11:48:29 -07:00
Dustin Carlino
8e49aac42f Make traffic seitan close roads that agents are about to use, causing a
crash. And start to figure out the debugging story.
2020-10-05 08:49:16 -07:00
Dustin Carlino
b7818a52be Capture the reason for cancelled trips, for #312 2020-10-03 15:35:29 -07:00
Dustin Carlino
9ccbf40dba Merge the concept of cancelled and aborted trips, in preparation for storing the reason for cancellation, for #312 2020-10-03 10:41:53 -07:00
Dustin Carlino
ffdedcb0a7 When multiple source lanes can turn left* to multiple destination lanes,
only allow the leftmost source lane to turn to any destination lane. As
a future improvment, need to handle multiple explicitly tagged left turn
lanes, but this gets closer to reality, particularly helping some crazy
maneuvers along Mercer in downtown.

*or right

Also had to update lanes along Madison and fiddle a bit to keep
lakeslice running. Spotted some major traffic signal bottlenecks due to
stage generation falling back, will iterate on that separately.
2020-10-03 09:40:15 -07:00
Dustin Carlino
cfa203a4d3 Add an API call to dump all traffic signals' current state 2020-10-02 21:03:29 -07:00
Dustin Carlino
f73d9da080 Conjure Traffic Seitan, a tool to make byzantine live map edits, to cause chaos and flush out bugs... 2020-10-01 18:24:35 -07:00
Dustin Carlino
fd460a2f43 Fix blackholed buildings with --infinite_parking. Before, they were just
skipped outright. Now they redirect to a reasonably close building that
isn't blackholed. #329

(For context, https://dabreegster.github.io/abstreet/map/index.html#connectivity
explains "blackhole")

I'm increasingly convinced I made the wrong decision to split the
normal/infinite parking implementation. It's low-priority, but I'll try
consolidating them later.
2020-10-01 11:57:30 -07:00
Dustin Carlino
c36f8026f0 Remove the old per-lane delay layer in favor of the new per-agent one 2020-09-30 09:19:24 -07:00
Dustin Carlino
2c63a485cc Undo some uses of impl trait. Originally added for performance in a big
refactor, they complicate the function signatures significantly and have
no observable perf impact, since all of the methods just happen in map
importing.
2020-09-29 15:53:08 -07:00
Dustin Carlino
de4f5c7768
Add a layer to color unzoomed agents based on their current delay, to help debug gridlock. Something like this used to exist as a first-class way to change unzoomed color schemes, but until we have more ideas about showing agent intent on the minimap, just implementing this as a separate layer. (#353) 2020-09-29 11:51:37 -07:00
Dustin Carlino
e1b079900a Don't touch SimFlags in headless at all 2020-09-24 17:10:07 -07:00
Dustin Carlino
c9fbf67989 Rearrange headless API to explicitly apply edits at the same time as
specifying the scenario to run. #325
2020-09-24 13:14:49 -07:00
Dustin Carlino
597ef473f2 Upgrade most dependencies 2020-09-24 09:36:26 -07:00
Dustin Carlino
d77271f9d8 Export trip times to CSV [rebuild] 2020-09-23 13:06:22 -07:00
Dustin Carlino
4a07164394 Add the concept of trip purpose. Seed it from Soundcast data, or assign
it for the prolet robot model. Expose it in the trip info panel.

Total scenario size from 385MB to 412MB, but that's not so bad, and this
seems worth it.
2020-09-19 13:02:36 -07:00
Dustin Carlino
3cc6a8ce12 And finally, a UI to tune offset between two signals! [rebuild] 2020-09-19 11:10:45 -07:00
Michael Kirk
08f330cfad track worker capacity of commercial buildings 2020-09-16 16:43:11 -07:00
Dustin Carlino
e28052c5be Reorganize sim module slightly, pull queries into one place 2020-09-16 10:15:30 -07:00
Dustin Carlino
1331b629aa Track how long cars have been parked in one spot 2020-09-16 09:42:02 -07:00
Dustin Carlino
0fc4c04171 Turn some spammy println's into silenceable alerts 2020-09-15 14:44:36 -07:00
Dustin Carlino
716f1f023f Don't seed parked cars in blackholed buildings 2020-09-15 13:27:56 -07:00
Dustin Carlino
c0e530645b Handle blackholes and reserving 2020-09-15 13:27:56 -07:00
Dustin Carlino
fcc05afda7 Add a flag to use the infinite parking sim. Start to test for real... 2020-09-15 13:27:56 -07:00
Dustin Carlino
a70fa0530a Start a new parking impl for infinite offstreet parking. Unused 2020-09-15 13:27:56 -07:00
Dustin Carlino
6439c026ea Set up the boilerplate for two parking impls 2020-09-15 13:27:56 -07:00
Dustin Carlino
82ea851a4e Make the Go API example track the same people through different cancellation runs, evaluating how much time the 'survivors' are gaining or losing 2020-09-14 18:56:52 -07:00
Dustin Carlino
d68273086b Autosave even the untitled edits!
Possibly when the player explicitly says "discard proposal", we should
actually delete the file.
2020-09-14 14:25:09 -07:00
Dustin Carlino
ce4e429648 Rename edits -> proposals, at least in the UI layer. 2020-09-14 12:52:06 -07:00
Dustin Carlino
faf1379062 Add a new experimental layer to show the distance between every parked car and its owner 2020-09-14 09:18:24 -07:00
Dustin Carlino
037e22e69e Cleanup last few things for left-hand maps. Fixes #311! 2020-09-11 14:17:31 -07:00
Dustin Carlino
d88ccf98b7 Make pedestrians walk on the left side of the sidewalk in the UK. #311 2020-09-11 13:55:26 -07:00
Dustin Carlino
d56d1fd0e3 Show trips affected by congestion capping in the trip table and info
panels
2020-09-11 11:21:39 -07:00
Dustin Carlino
65569c7f56 When a car trip violates a congestion cap, reroute around the problem
instead of aborting the trip.
2020-09-11 11:21:39 -07:00
Dustin Carlino
2895d50a1e
Add tooltips to the agent meters, and stop showing both buses and passengers. Fixes #239 (#323) 2020-09-11 11:08:26 -07:00
Dustin Carlino
f1b1263ee2 Fix congestion capping impl when RESERVE_WHEN_STARTING_TRIP is enabled. It wasn't reseting the counter every hour. 2020-09-10 14:29:06 -07:00
Michael Kirk
c11cecf1ac
log cleanups (#321) 2020-09-10 14:20:35 -07:00
Michael Kirk
f685af47a5
proletariat robot considers resident/worker capacity (#320)
proles: account for work capacity

previously all residents went to work on the map, but if the
neighborhood is mostly residential that meant they were "competing"
heavily for the scarce jobs available on the map.

with this commit, we do a better job of spreading worker/residential
demand to account for what is available, and fill in the gap with
off-map trip origins/desitinations.

e.g. if a neighborhood is mostly residential, we have folks commute off
of map. If a neighborhood is mostly commercial, we have folks commute
into the map.
2020-09-10 14:04:20 -07:00
Dustin Carlino
8cc61aafc8 Add a method to the API to modify a scenario. No callers/tests yet. 2020-09-09 19:52:15 -07:00
Dustin Carlino
1388694eec Flag off the live map edits, since it's going to take lots more work to stabilize this, but git branches are scary to maintain for more than a few days. #312 2020-09-09 15:03:14 -07:00
Dustin Carlino
220f33e2ec Abort cars bound to park on edited lanes. #312 2020-09-09 15:03:14 -07:00
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
Dustin Carlino
d22aa87139 rearrange Building internals for #176. edits can affect building
connections to driving/biking. just store the immutable stuff -- whether
there's parking in the building, the connection to the sidewalk, and the
physical driveway line. compute all the rest dynamically, so it responds
to edits without effort.

shouldn't be major behavior changes yet (besides maybe fixing some bugs
involving edits)
2020-07-31 12:49:33 -07:00
Dustin Carlino
03796fcd66 introduce the tiny walkable shoulder lane type. pathfinding penalty,
rendering adjustments. #176

the SharedSidewalkCorner geometry looks bad, but acceptable for now.
2020-07-30 13:42:36 -07:00
Dustin Carlino
edb1cb87cd Make all vehicles, including buses, start with ~0 length when spawning
from borders and gradually appear. This looks more realistic and lets
more trips succeed, especially buses spawning at short borders.

This fixes #220 in a hopefully simpler way. Extending the geometry of
incoming roads is possible, but it may look visually overwhelming,
because two border intersections could sometimes overlap.
2020-07-28 11:39:57 -07:00