Commit Graph

1495 Commits

Author SHA1 Message Date
Dustin Carlino
0edc0cb279 Fix the Dijkstra pathfinding, by using DiGraph, which is serializable 2021-07-10 17:14:10 -07:00
Dustin Carlino
2d16f5d878 Get the crazy pathfinding revamp to work
- initialization order
- reusing node ordering and applying edits

Importing, editing the map, and the basic scenario seem OK! --skip_ch
breaks, because of the lack of serialization
2021-07-10 17:14:10 -07:00
Dustin Carlino
c5369a10f4 Invert the structure of CH-vs-dijkstra pathfinding. Use a generic
"engine" that just operates on raw usize IDs. Embed that enum in each of
the particular pathfinders. This way, we don't have to keep duplicating
logic to delegate requests, handle one-step edge cases, etc. And it also
sets us up to more easily try out other CH implementations like osm_ch,
without having to move around tons of code.

Still use fast_path's InputGraph as the "universal" format, for now.

This is a huge change... got map_model compiling at least. Some stubbed
out stuff.
2021-07-10 17:14:10 -07:00
Dustin Carlino
74500a24dd Refactor pedestrian pathfinding, sharing input graphs between CH/dijkstra 2021-07-10 17:14:10 -07:00
Dustin Carlino
830c683009 Refactor vehicle pathfinding. Share input graphs between CH/dijkstra
impl.
2021-07-10 17:14:10 -07:00
Dustin Carlino
fe64501e6d Fix pedestrian speeds on inclines. Those walking contraflow on a
sidewalk were using the wrong incline!

Not regenerating data yet (need to regenerate all maps)
2021-07-10 17:14:10 -07:00
Dustin Carlino
da704b4546 Extend the parking thought bubbles to handle people climbing steep hills.
(And some clippy fixes)
2021-07-10 17:14:10 -07:00
Dustin Carlino
4aa971e34e Add a new importer mode to do Raw->Map in parallel. Occasionally useful
now that my faster machine works again.

Running importer jobs in parallel is actually super hard, because
there's async stuff thrown in there now to download files.
2021-07-06 16:21:42 -07:00
Dustin Carlino
964cc23df8 Improve 3-way signal timing by explicitly specifying crosswalks. This
fixes a very dramatic problem in the Green Lake map.

Regenerating everything...

Also added total trip time to the prebaked summary, to get a quick sense
if a change net helps or hurts and have a record in version control.
2021-07-06 14:37:50 -07:00
Dustin Carlino
f37e71236f Some fixups to the regenerated data from the past two commits:
- handle when the equiv_pos of a driveway gets too close to the edge of
  another lane
- make the updater workflow handle files from S3 that're a bit older
- remove pathfinding_avoiding_roads
- strip out old vehicle capping from map edit JSON, then fix up
  proposals
- delete old capping API example
- temporarily give up on phinney; it starts gridlocking
- add broadmoor proposal link in-game
2021-07-05 17:51:40 -07:00
Dustin Carlino
a0dcc255c3 Rip out all congestion capping code. #325
This collaboration is abandoned, the code slows down refactoring, and
if we started this idea again today, it'd be better to do it from
scratch anyway.

Regenerating everything.
2021-07-05 11:15:31 -07:00
Dustin Carlino
4d4cbdf525 Fix equiv_pos. Tested visually on curvy roads and by watching cars slide
into/out of parallel parking.

Not regenerating anything yet...
2021-07-05 11:02:27 -07:00
Dustin Carlino
6039063d28 Add a debug tool to dump JSON for different objects and open up with an external viewer. [rebuild] [release]
And fix some clippy problems
2021-07-04 15:32:49 -07:00
Dustin Carlino
382d890ac6 Switch to updated fast_paths 2021-07-04 14:34:20 -07:00
Dustin Carlino
0211094689 Create static blockages for off-side driveway exits. Verified correct
for all combinations of on/off-side exits and cutting across lanes by
using the static blockage visualizer.
2021-07-04 14:34:20 -07:00
Dustin Carlino
95ffa62218 Fix the unparking position. When we exit a driveway in EITHER direction,
we need to adjust the start position to account for the vehicle's
length.

Also add a very convenient debug tool to understand positions along
lanes.

This probably breaks static blockages; I'll check into that next.
2021-07-04 14:34:20 -07:00
Dustin Carlino
57feeada59 Allow vehicles to exit driveways onto the opposite side of the road. #555
- Adding an internal alt_start to PathRequest
- Using it for contraction hierarchy queries only (the Dijkstra
  implementation now diverges!)
- Figuring out which start position was used

TODO:

- Fix the unparking position
- Make sure the simulation inserts static blockages
- Carefully check the same start/end road case
- Evaluate impact on gridlock / cancelled trips
2021-07-04 14:34:20 -07:00
Dustin Carlino
efaf6085e4 Prepare for exiting driveways on the off-side by switching to
specialized PathRequest constructors
2021-06-30 12:35:22 -07:00
Dustin Carlino
137e9a0c2c Fix up some places affected by the f64 serialization:
- offstreet_parking_length in importer config
- backwards compatibility for map edits
- fixing up the baked-in proposals
- working around a few PolyLine bugs that happen with the new rounding
- Don't regenerate actdev scenarios yet -- the upstream JSON format is
  out of date, will have to fix separately.
2021-06-30 06:35:42 -07:00
Dustin Carlino
f57278e9cd Enable the new walking turn algorithm for consolidated intersections
only. It has much simpler logic and produces correct results for these
intersections, but it has degradations in some cases -- so limit where
we use it.

But in the meantime, this makes realistic crosswalks over Aurora,
fixing crazy walking detours there.

Not regenerating yet.
2021-06-24 12:41:38 -07:00
Dustin Carlino
190ee4b08f Fix the path v2->v1 and opportunistic lane-changing costs to heavily penalize cars from using bus lanes.
This doesn't avoid the aforementioned lane-changing crash, but by manual
inspection, it's keeping cars out of bus lanes.
2021-06-22 17:47:05 -07:00
Dustin Carlino
48076a4c5b Better stop sign placement -- degenerate roads shouldn't get them. Not
sure why this wasn't done before.

Regenerated all maps... but this happens to expose some lane-changing crashes.
2021-06-22 17:05:18 -07:00
Dustin Carlino
e08ddba241 Bring in fresh Seattle OSM data with the new cycletrack mapped around
Green Lake, and fix some missing support for bidi cycletracks.
2021-06-22 08:31:16 -07:00
Dustin Carlino
ae3d4e2363 Fix loading edits that change the number of lanes in a road. We need to compare the old version of the road in the edits with the basemap, NOT the edited version of the road. #597 2021-06-20 10:06:38 -07:00
Dustin Carlino
1e43d929e5 Implement dynamic lane-changing in a simple way:
- only triggered when a vehicle becomes Queued
- Only one adjacent lane, no contraflow (crossing the road's center
  line)
- Don't return to the original lane after passing
- Using a static blockage in the old lane (so other vehicles will wait
  too much)
- Only using the new lane to determine position (so visually a car will
  clip a bike as they pass)

Haven't regenerated prebaked data. #382
2021-06-19 12:35:19 -07:00
Dustin Carlino
0bcf01fd05 Avoid crashing in recalculate_intersection_polygon due to polylines not
containing some points. Happens at i524 in Arboretum and in the West
Seattle proposal.

I don't understand yet why this is possible in the first place, but
crashing is pretty bad in the meantime.
2021-06-19 11:29:01 -07:00
Dustin Carlino
8f199177f5 Upgrade to Rust 1.53
- arrays are now iterable directly
- switch to using BTree{Set,Map}::retain!
- a round of clippy
- regenerate scenarios and prebaked data; not sure why, but there's a
  diff
2021-06-17 23:04:35 -07:00
Rémi Lauzier
1a4b997818 Fix some clippy warnings 2021-06-16 16:21:35 -07:00
Dustin Carlino
cbce654800 Prepare to have vehicles exiting driveways block any intermediate lanes. #555
This is just wiring together all of the state transitions. Haven't
decided how to internally implement this in Queue yet.
2021-06-16 16:02:17 -07:00
Rémi Lauzier
dd050ea425 Update some dependency 2021-06-16 15:51:03 -07:00
Dustin Carlino
321e7cd0ee Allow exiting a driveway onto any lane (in the same road direction). #555
- Support this at the pathfinding level, when transforming v2->v1
- Adjust how the vehicle's body is rendered as it exits a driveway onto
  a farther lane

No support yet for blocking any intermediate lanes; vehicles may clip
through each other without any conflict. Planning to add that
separately.

Regenerating all scenarios and prebaked data...
2021-06-16 15:46:09 -07:00
Dustin Carlino
76aba75082 Update links to docs after some reorg in the other repo 2021-06-12 13:38:38 -07:00
Dustin Carlino
43d6ba80c5 Fix all_walking_costs_from by properly accounting for the distance between sidewalk endpoints and building paths. 2021-06-11 10:10:41 -07:00
Trevor Nederlof
4e150dcab0
Generalized connectivity to use Spot and added BorderIsochrone (#668) 2021-06-11 10:06:53 -07:00
Dustin Carlino
972f5b0187 Lower the priority of service roads when placing stop signs
Regenerate all data. Wallingford started gridlocking due to this change;
plowing ahead and will follow up and fix it.
2021-06-11 09:40:44 -07:00
Dustin Carlino
18ff0eefc0 Store Turns per Intersection, instead of a massive BTreeMap. #368
Minimal file size savings, but substantial runtime improvement!
2021-06-11 09:40:44 -07:00
Dustin Carlino
d2ecab44a7 Be sure to validate signals before committing the results, since GMNS imports aren't validated upfront. #626 2021-06-02 11:40:54 -07:00
Dustin Carlino
5127a82b54 Import Tehran 2021-06-01 10:19:06 -07:00
Dustin Carlino
d014098f59 Fix an extremely naive implementation of calculating average angle,
which was causing bizarre turn lane arrows in Tempe.
2021-06-01 09:52:40 -07:00
Dustin Carlino
5aa00955f9 Clean up the timer.parallelize API, getting rid of the weird enum to
toggle how many CPUs to thrash. We always use all of them, except for
one case, where a separately named method is more clear. Also make that
variation use all but 1 CPU, instead of just half.
2021-05-27 17:47:22 -07:00
Dustin Carlino
cf6b2f6db7 Rewrite the heuristics for stop signs. Similar to traffic signals, only
count incoming roads when figuring out if an intersection is degenerate.
Also make link roads (on/off ramps) lower priority than the main part of
the road.

Regenerated everything.

(and fixing up the cloud scripts)
2021-05-27 15:37:46 -07:00
Dustin Carlino
8ceaf296eb Allow u-turns at merged intersections when the turn lane is explicitly tagged in OSM. This makes the infamous U-turn from Montlake to 520 WB work! The inferred signal timing isn't great, but ah well.
Not regenerating yet
2021-05-27 10:09:22 -07:00
Dustin Carlino
455399b90e Collapse degenerate intersections between cycle+footpaths. At various
times in the past, I've also tried doing this for other roads, but wound
up reverting for reasons only git remembers. But it seems like an
obvious win for bike paths; especially around Seattle, the ways are
split because of all of this raised curb data we're ignoring anyway.

Tested manually around Montlake.

Finally regenerating all data... Only Phinney breaks. One for tomorrow.
2021-05-26 22:27:29 -07:00
Dustin Carlino
3a68e5677f Allow all vehicles to use bus-only lanes that also happen to be turn lanes. #555
There are some caveats with the implementation commented inside.
Verified manually in Montlake -- down to just 122 cancelled turns!

Still not regenerating...
2021-05-26 19:13:14 -07:00
Dustin Carlino
6f0e01c511 Fix a critical bug with pathfinding v2: when calculating allowed
movements, make sure that a vehicle can access BOTH the source and
destination lane of a turn. #555

Without this fix, a turn from a bus lane to a driving lane is allowed
for cars at the pathfinding v2 level, but then it fails when converting
into v1 lanes.

(Next step: actually allow this for combination bus/turn lanes)

Not regenerating data yet
2021-05-26 15:39:34 -07:00
Dustin Carlino
4bd79cabbf Upload regenerated map data and address turn restriction PR feedback 2021-05-25 20:24:11 -07:00
Dustin Carlino
2dd611fd73 Refine the connectivity check for bus and bike lanes
Down to 12 connectivity problems in Montlake! Now that the dust has
settled, manually check the 3 unit tests and confirm the goldenfile
diffs.
2021-05-25 20:24:11 -07:00
Dustin Carlino
7af86a9e59 Interpreting turn:lanes tagging more carefully.
And fix an absolutely infurriatingly bad typo from the previous commit.

Now both the multiple_left_turn_lanes and divided_highway_split test
maps look great!
2021-05-25 20:24:11 -07:00
Dustin Carlino
c95a0b0f64 Handle another case for creating multiple left/right turns at an intersection. Use the new validation for connectivity at an intersection and give up on using OSM turn restrictions in some cases.
39 problems in Montlake down to 33, but regressions on some of the LCing unit tests...
2021-05-25 20:24:11 -07:00
Dustin Carlino
62af2fef8c Introduce a new method to check for connectivity problems between vehicle lanes at an intersection, and start tracking the number of problems across a map. 2021-05-25 20:24:11 -07:00