Commit Graph

1262 Commits

Author SHA1 Message Date
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
5aee85f19d Allow colorschemes to optionally color zoomed-in lanes based on OSM road rank. Most schemes don't do this, but one needs to, and maintaining a separate git branch has become annoying.
Should have no behavioral change to existing color schemes.
2020-10-02 08:06:35 -07:00
Dustin Carlino
e8d6525c59 Trim out unrealistic left and right turns. Find cases where multiple
lanes all lead to a single lane via left/right turn, and just keep the
left/rightmost lane.

Sanity checked at Rainier / S Massachusetts, and 23rd / S Massachusetts.
2020-09-30 10:30:01 -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
4e4e11b404 A few documentation adjustments after
5de05a6fe3
2020-09-29 09:21:36 -07:00
Michael Kirk
27b25a71a5
doc typos (#352) 2020-09-28 17:17:22 -07:00
Dustin Carlino
5de05a6fe3 Document map_model crate 2020-09-28 10:43:22 -07:00
Dustin Carlino
371d26f707
Bring in alleyways from OSM! [rebuild] (#351) 2020-09-27 12:20:27 -07:00
Dustin Carlino
84891f8b96 Some map fixes to prepare for alleyways:
- Temporarily workaround snap_cycleways crash in Xi'an
- Fix interpretation of blank turn restrictions. https://www.openstreetmap.org/way/739621435 was missing a right turn, which was causing vehicles to do this crazy loop to go from Madison EB to Lake Wash SB.
- Ignore turn restrictions when they don't match the number of lanes. https://www.openstreetmap.org/way/428090702 and similar need some updating.

Regenerate all data, but give up on lakeslice running fully. Going to
sacrifice that one for a bit to get new roads imported.
2020-09-27 11:21:35 -07:00
Dustin Carlino
4916b10190 Small style cleanups after #346 (Import grouping, simplify Spinner logic) 2020-09-27 10:26:38 -07:00
NoSuchThingAsRandom
0921a4aae5
Pedestrian crossing time (#346)
* Fixed ui being able to select traffic light times that are shorter than the time it takes to walk across the crosswalk

* Fixing operands and renaming

* Fixed spinner out of bounds issue
Traffic light generation now, ensures that there is enough time to cross the crosswalk
And enforces the minimum time duration

* Cargo +nightly fmt

* Request fixes: https://github.com/dabreegster/abstreet/pull/346
Still need some things to clarify:
    Spinner checks on increment/decrement
    Calling enforce_minimum_crosswalk_time inside get_possible_policies, requires the removal or modification of the validation function

* Moved enforce_minimum_crosswalk_time inside get_possible_policies
Now runs stage_time_validation at the end of get_possible_policies and removes invalid policies
Could do the same with the validation function as well?

* Fixing import order

* Fixed ui being able to select traffic light times that are shorter than the time it takes to walk across the crosswalk

* Fixing operands and renaming

* Fixed spinner out of bounds issue
Traffic light generation now, ensures that there is enough time to cross the crosswalk
And enforces the minimum time duration

* Cargo +nightly fmt

* Request fixes: https://github.com/dabreegster/abstreet/pull/346
Still need some things to clarify:
    Spinner checks on increment/decrement
    Calling enforce_minimum_crosswalk_time inside get_possible_policies, requires the removal or modification of the validation function

* Moved enforce_minimum_crosswalk_time inside get_possible_policies
Now runs stage_time_validation at the end of get_possible_policies and removes invalid policies
Could do the same with the validation function as well?

* Fixing import order

* Moving stage validation inside validation function

Co-authored-by: Sam <a>
2020-09-27 10:21:30 -07:00
Dustin Carlino
2ddd9a62ff Cleanups for #346:
- Add Distance::min()/max()
- Bring in log crate everywhere
- Consolidate traffic signal validation
2020-09-26 10:11:08 -07:00
Dustin Carlino
5a3bee0264
A first attempt to snap separately mapped cycleways to main roads. Emit (#348)
an extra KML file during importing to debug; don't bring into the main
map yet. #330

Not regenerating yet
2020-09-25 15:22:47 -07:00
Dustin Carlino
07a8a21fec Cap the busiest road. Not actually working yet, because all the commands
to manage edits are stomping on each other. #325
2020-09-24 12:08:46 -07:00
Dustin Carlino
597ef473f2 Upgrade most dependencies 2020-09-24 09:36:26 -07:00
Dustin Carlino
938dab8e94 Determine border intersections exclusively from roads that cross the
clipping boundary. I don't remember why the more complicated thing came
about. This fixes a weird incoming border in SLU into an unreachable
intersection (which is more accurate) and doesn't seem to cause any
problems to normal or oneshot maps, with or without explicit clips.
2020-09-22 16:06:39 -07:00
Dustin Carlino
8faab3592a Refactor RawMap saving 2020-09-22 15:49:02 -07:00
Michael Kirk
848251fca4
use osm data for actual building height (#340) 2020-09-22 11:59:50 -07:00
Dustin Carlino
3eb51d75a5 Sketch a polygon for bellevue 2020-09-19 13:52:09 -07:00
Dustin Carlino
3cc6a8ce12 And finally, a UI to tune offset between two signals! [rebuild] 2020-09-19 11:10:45 -07:00
Dustin Carlino
15af3846b1 Round driving costs for pathfinding more carefully. When we create
uber-turns (sequences of turns through a few intersections) due to OSM
turn restrictions, we have to be a little careful how we sum up the cost
for the entire sequence, only rounding at the end.
2020-09-18 15:39:35 -07:00
Dustin Carlino
66ee865ad1 Debug uber-turns by showing their cost in the viewer 2020-09-18 14:13:11 -07:00
Michael Kirk
08f330cfad track worker capacity of commercial buildings 2020-09-16 16:43:11 -07:00
Dustin Carlino
fff75fa5ba Yuwen's new changelist UI (except for describing some of the changes in detail) 2020-09-14 17:40:04 -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
037e22e69e Cleanup last few things for left-hand maps. Fixes #311! 2020-09-11 14:17:31 -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
edbc674970 Fix stop sign placement for left-handed maps. #311 2020-09-11 11:03:59 -07:00
Dustin Carlino
9844eeecc8 Improve error messages for old EditIntersections, for #319 2020-09-09 16:01:29 -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
70d2d1115e Store polygon indices as u16, not u64. Maps from 743MB total down to
620MB!
2020-09-04 13:12:06 -07:00
Dustin Carlino
568a64df91 Don't store Rings for Polygons without any holes. Total map size from 751MB to 743MB 2020-09-04 12:18:53 -07:00
Dustin Carlino
38ba8d55f3 Produce proper lanes for left-hand driving by intervening at the LaneSpec layer for #311. Since London looks reasonable, opt it into the screenshot tests 2020-09-04 10:01:06 -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
86958f2e2f Upgrade the old lane-based edit commands when importing edit JSON, for #113 and #224. When there are lane reversals and lane type changes in the original edits, we still can't safely do the upgrade. But this handles most other cases, notably the 3 proposals. 2020-09-03 15:43:21 -07:00
Michael Kirk
b85dd18757
fix broken link (#308) 2020-09-01 22:07:05 -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
93cf9f3b00
Speed up apply_edits. Instead of undo()ing all current commands and then (#299)
apply()ing the new ones, ignore any common prefix between the two
command-lists.
2020-08-28 16:47:27 -07:00
Dustin Carlino
0eb1309ace Add an API to get back all of the map edits so far 2020-08-28 14:09:44 -07:00
Dustin Carlino
d8d2877c14 Fix bike lane importing on Bell St. To prevent this from gridlocking
lakeslice (which is still quite sensitive to tiny changes in demand
data), manually retime a signal.
2020-08-27 20:51:49 -07:00
Dustin Carlino
57b5791f1f Refactor a helper to produce EditCmd::ChangeRoad. Looked at doing the
same for ChangeIntersection, but not sure it's worth it.
2020-08-27 10:25:18 -07:00
Dustin Carlino
e283b8944a Restore the ability to see individually changed lanes. Give up on the
"revert" button for lanes; it was always kind of confusing.
2020-08-27 09:36:00 -07:00
Dustin Carlino
1c98dd55b7 Simplify original_roads by recomputing from OSM data 2020-08-27 09:36:00 -07:00
Dustin Carlino
b6ab06d51a Remove the old EditCmds. Realizing the new ChangeRoad does have some
gaps with detecting changes to individual lanes in the UI, though...
2020-08-27 09:36:00 -07:00
Dustin Carlino
30bfe93b5c Produce the new EditCmd::ChangeRoad in the UI. Tested the scenario that
caused #113 (change lane types, reverse some lane, save edits, load from
scratch) -- now it works!
2020-08-27 09:36:00 -07:00
Dustin Carlino
aacb17297d Introduce a consolidated EditCmd::ChangeRoad. Unused so far, and not
handling backwards compatibility yet. One step towards fixing #113 and
2020-08-27 09:36:00 -07:00
Dustin Carlino
651b4f5ec9 Some code style cleanups after #296 2020-08-27 09:10:39 -07:00
Dustin Carlino
59b14426bb Improve shared left turn lane markings and reorg some docs 2020-08-26 12:35:29 -07:00
Dustin Carlino
75933f686d At last, powered by the tight feedback loop of unit tests, bring in some
two-way cycletracks from OSM!
2020-08-25 16:35:17 -07:00
Dustin Carlino
3d6fb16db1 Finally hit the point where unit testing lane_specs_ltr is necessary... 2020-08-25 15:23:59 -07:00
Dustin Carlino
112a29625f Prepare get_lane_specs_ltr to support two-way cycletracks from OSM...
and bring in fresh OSM, with some of the cycletracks tagged properly
2020-08-25 14:02:17 -07:00
Dustin Carlino
95c43f8e1c Finally replace the underlying storage in Road 2020-08-25 12:08:54 -07:00
Dustin Carlino
6919e4eace Working on kicking the old children out of the house (that is,
map_model). But give in and create an adapter to derive the old thing
from the new thing. The remaining callers are hard to port over to
lanes_ltr.
2020-08-25 12:08:54 -07:00
Dustin Carlino
376cf1292a And more. Now all the deprecated stuff is locked down to map_model, and
it's pretty much related to map construction and edits
2020-08-25 12:08:54 -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
20d81cd453 Start bringing in cycletracks as bike lanes. Stop interpreting :left to
mean the backwards direction. Not handling two-way cycletracks yet.
2020-08-24 11:20:41 -07:00
Dustin Carlino
0ee6bcbfcb Fix intersection geometry in cases where two road edges intersect at
multiple points. This was already handled when the roads went between
the same intersections, but I found a case in Ballard where the roads
are just really close to each other. Screenshot diff empty in Krakow,
but still related to #243
2020-08-24 10:25:08 -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
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
ca8af784c7 Add an explicit version number to the edits schema 2020-08-23 09:22:41 -07:00
Dustin Carlino
8165312426 Start the Dijkstra's impl, forking from the implementation in Zone. No
support for transit or zones yet. Simplify the CH building process now.
2020-08-22 10:22:11 -07:00
Dustin Carlino
5528f19f87 Split pathfinder struct into an enum to make room for a variation that
just does Dijkstra's. This has a few uses:

- When you import with --skip_ch, the resulting map will still work,
  just more slowly
- For congestion capping experiments, we sometimes want to route around
  a zone. Regenerating the contraction hierarchy for every combination
  of zone being open/closed is likely more complex and expensive than
  just falling back to A* for trips that cut through at least one closed
  zone.

Not regenerating yet
2020-08-22 09:54:02 -07:00
Dustin Carlino
3afdb3f7e2 The JSON format for the map edits changes occasionally. Be backwards
compatible with old edits, automatically transforming them to match the
new format. Part of #216 and necessary to work on #234.
2020-08-22 09:14:01 -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
3a10416e26 Organize map edits code a little 2020-08-20 15:34:15 -07:00
Dustin Carlino
2c5bbd3e7e Use alternate language building names and amenities, when available. Fixes #271.
Tested in Shinjuku. No substantial file size increase for any maps.
2020-08-20 10:39:28 -07:00
Dustin Carlino
24a8d4a836 Prepare to support capping the number of vehicles that can pass through
a zone per hour. This is part of support for some kind of congestion
charging experiments. This step just rearranges the data to define the
cap and makes a UI to edit it. Not enforcing the cap yet.
2020-08-19 17:46:40 -07:00
Dustin Carlino
2ebf463635 Handle buildings tagged as parking garages in OSM. 2020-08-19 17:19:54 -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
6749edb2b6 Change language of roads via settings, for #271 2020-08-18 17:32:49 -07:00
Dustin Carlino
2e93fdbf54 Fix parking aisle loops that cross the parking lot polygon. Closes #242 2020-08-18 15:12:12 -07:00
Dustin Carlino
40ddd06194 Improving the on/off ramp geometry by preferring that the "thin" road is
one of the outbound roads. This was motivated by one particular example
in downtown, and per screenshot tests, doesn't have regressions
elsewhere. Also improves a few cases in montlake.
2020-08-17 17:31:21 -07:00
Dustin Carlino
83e84c10af Handle more errors in importer. Got the entirety of Taiwan to import...
but the water polygons are so sad. :(
2020-08-15 09:36:23 -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
c84833feb4 More steps on the multi-signal editor, adapted from the old editor:
- Add a header to the side panel
- Prevent leaving the editor with missing turns
- Apply edits properly when leaving
2020-08-13 15:12:03 -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
843d24b6ed Refactor: OriginalBuilding should just be OsmID. The purpose of
OriginalBuilding was to refer to buildings in a stable way across
different maps and across OSM updates. Recently, OsmID and friends
appeared. The double layer of wrapping is an annoying API.

Not regenerating map data yet; about to do the same thing for
OriginalIntersection
2020-08-13 11:37:06 -07:00
Dustin Carlino
58849d3d15 Small refactor: in most places, we can actually use String as the error type; Box<dyn Error> is only useful when errors of different types are propagated.
Nowhere in abst do we care about handling different errors differently
2020-08-13 07:12:06 -07:00
Dustin Carlino
3b49353df2 gracefully degrade if we cant make TurnGroups for a traffic signal. this
gets SF, Tokyo, and London to import!!!
2020-08-12 11:05:19 -07:00
Dustin Carlino
62bb82886d blaze through all the crazy errors in intersection_polygon, just
recording errors and falling back to circular geometry and not trimming
roads

also filter out highway areas like
https://www.openstreetmap.org/way/132705692, woops!

Manchester and NOLA now import...
2020-08-12 09:36:46 -07:00
Dustin Carlino
a27b029ff6 plumb errors for shifting polylines through more APIs. mostly no-op for
now, just switched everything to must_* variants, but this paves the way
for handling failures.

... except for rendering pedestrian crowds -- I _think_ I saw a crash
from that, and it's easy to have a fallback there
2020-08-12 08:18:10 -07:00
Dustin Carlino
8ce2568280
turn the headless runner into a demo of a JSON API, for #245 (#268)
turn the headless runner into a demo of a JSON API, for #245
2020-08-11 16:44:19 -07:00
Dustin Carlino
312775b491 refactor TurnGroup creators, but keep it stored on traffic signal, so
it's regenerated for edits
2020-08-10 15:39:28 -07:00
Dustin Carlino
c101666c7c finishing the consolidation of docs 2020-08-10 14:56:39 -07:00
Dustin Carlino
f9b41dda30 finally get github pages + mdbook to work, thanks to
https://github.com/rust-lang/mdBook/pull/1248#issuecomment-671528271 and
removing jekyll
2020-08-10 13:49:30 -07:00
Dustin Carlino
31e8c654d2 prototype directional traffic signal demand viz over time 2020-08-10 13:19:47 -07:00
Dustin Carlino
ecd5d86009 handle bus stops right at intersections 2020-08-08 19:32:18 -07:00
Dustin Carlino
8764226765 cutover to using the new stuff for snapping bus stop positions...
seems pretty good for a few examples. not regenerating yet. still lots
of routes skipped because of edge cases, but now it's way more clear
how to work on those smaller problems.
2020-08-08 18:14:08 -07:00
Dustin Carlino
6c525d625d match transit stops to side of the road based on the orientation of the points in the route. don't use this just yet...
not regerating yet either
2020-08-08 17:44:28 -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
84e913a642 fix bus routes where the last bus stop is also on the outbound border
lane

not regenerating yet
2020-08-08 10:11:09 -07:00
Dustin Carlino
eee179ce8a store offset in the permanent signal format 2020-08-08 09:45:59 -07:00
Dustin Carlino
49e8ab3680 try to get seoul to import 2020-08-08 09:32:43 -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