Skip to content

Let vehicles of the cooperative crossing fail - #25

Merged
schreck61 merged 3 commits into
mainfrom
cooperative-failures
Nov 15, 2026
Merged

schreck61 merged 3 commits into
mainfrom
cooperative-failures

Conversation

@schreck61

Copy link
Copy Markdown
Owner

What and why

The safety gaps of the signal-free cooperative crossing are sized for a vehicle that fails, and until now no run showed one. This lets a vehicle fail and shows what follows.

  • Failing. A vehicle stops dead (the failure the fail-safe and mitigated gaps are sized for) or brakes as hard as it can to a stop (the failure the nominal gap is sized for). It can be made to fail by a click, in the box, at the worst moment for crossing traffic, or at random at a set rate.
  • The reaction. Half a second later the manager gives new trajectories to the vehicles the failure endangers. A vehicle that can still stop short of the box loses its crossing; one that can't brakes as hard as it can, or follows the vehicle ahead until it rests behind it. A reaction only holds a vehicle back, and vehicles whose paths stay clear cross as planned.
  • Contact. Vehicles that can't stop in time touch. They stop where they touch, and the speed at which they closed is recorded. This is the one place where vehicles overlap on purpose; GOVERNANCE.md and CONTRIBUTING.md now say so.
  • Recovery. Disabled vehicles are cleared away after a set time, vehicles that stopped in the box are routed out once their way is clear, and the lanes that stay clear are served meanwhile.
  • In the app. A Failures group under the manager's settings, a Failures block under the safety monitors, and marks on the map.
  • A study. examples/failures.rs measures what each gap policy survives and what a failure costs.

The last commit changes the nominal gap's label from "Nominal: latency and actuation (no failures)" to "Nominal: latency and actuation only", since the gap is now documented as sized for a vehicle ahead that brakes hard, not for one that stops dead.

A run in which nothing fails is unchanged: cargo run --release --bin bench all 20 6 prints the same figures on main and on this branch, the cooperative crossing included.

Results

From cargo run --release --example failures -- 400 (one failure per run, 400 runs per case; batches at 16,000 veh/h, first come, first served at 8,000 veh/h):

A vehicle stops dead at the worst moment Crossing contact, batches First come, first served
Fail-safe gaps none none
Mitigated gaps 85%, at up to 21 km/h 54%, at up to 22 km/h
Nominal gaps 96%, at up to 35 km/h 89%, at up to 35 km/h
  • With fail-safe gaps no vehicle on a crossing path touched another in any of the 3,200 failures.
  • A vehicle that brakes hard to a stop was reached by crossing traffic in 5 of 1,600 failures with nominal gaps, at up to 12 km/h, and never with the wider gaps. It was struck from behind 3 times in 4,800 failures, at up to 6 km/h, each time first come, first served.
  • Mid-batch, a vehicle that stopped dead was struck from behind in 86–89% of failures whatever the gap: the following gap in a lane is not sized for that.
  • A disabled vehicle in the box costs about a sixth of the flow while it stands (83–88% served).
  • In all 9,600 runs no vehicle left the trajectory it held, entered the box without one, or overlapped another outside a recorded contact.

The README has the full tables, under What the safety gap is for and Results. docs/insights.md gives the findings in section 8, and docs/cooperative-intersections.md sets them against the design's estimates in section 12.

Checklist

  • cargo test --locked --release passes (zero vehicle overlaps)
  • The code is formatted with cargo fmt --all
  • cargo clippy --locked --release --all-targets -- -D warnings is clean (and for wasm32-unknown-unknown if the app changed)
  • New functionality has tests, and a bug fix has a test that fails without it (see CONTRIBUTING.md)
  • Runs stay deterministic for a given seed
  • README, docs/insights.md and in-app text are updated where results or behavior changed
  • New dependencies, if any, are explained and THIRD_PARTY_LICENSES.md is regenerated (none)
  • I've noted anything I couldn't test (for example a platform I don't have)
  • Every commit is signed off (git commit -s) under the Developer Certificate of Origin

Not tested before opening: Linux and Windows. The tests ran on macOS with Rust 1.99 and 1.100. Several of the new tests check what happens in runs with fixed seeds, which could come out differently on another platform.

By submitting this pull request, I agree that my contribution is dual licensed under MIT OR Apache-2.0, as described in CONTRIBUTING.md.

The safety gaps of the signal-free crossing are sized for a vehicle
that fails, and no run ever showed one. A vehicle can now be made to
fail: it stops dead, the failure the fail-safe and mitigated gaps are
sized for, or brakes as hard as it can to a stop, the failure the
nominal gap is sized for. It fails where it is, at a chosen place, at
random places in the box, or at the worst moment for crossing traffic.

Half a second later (two message latencies and the actuation delay)
the manager reacts with new trajectories. A vehicle that can still stop
short of the box loses its crossing. One that cannot brakes as hard as
it can if the failed vehicle is in a zone on its path, or follows the
vehicle ahead until it rests behind it. A reaction only holds a vehicle
back: one at rest stays at rest, and one that can no longer stop short
of the box is never faster than the trajectory it had. A vehicle that
cannot stop behind the one ahead is expected to come to rest against
it, so the zones it will stand in are held from the failure on.
Vehicles whose paths stay clear cross as planned.

Vehicles that cannot stop in time touch: they stop where they touch,
are disabled too, and the speed at which they closed is recorded.
Disabled vehicles are cleared away after a set time, vehicles that
stopped in the box are routed out once their way is clear, and the
lanes that stay clear are served meanwhile.

The app gets a Failures group (the kind of failure, a tool and two
buttons that make one, how long a disabled vehicle stays and a rate of
random failures), a Failures block under the safety monitors and marks
on the map. examples/failures.rs measures what each gap policy survives
and what a failure costs.

Tests: tests/failures.rs (20 tests), six unit tests in
sim/coop/failures.rs and one in gui/mod.rs, six more tests of the app
in tests/gui.rs and one scripted scene in tests/scripted.rs.

Signed-off-by: Jim Schreckengast <schreck@gmail.com>
README: the feature in the cooperative crossing's table, what the
failures study found (examples/failures.rs, 400 failures per case) and
how to watch one. docs/insights.md adds the findings to section 8, and
docs/cooperative-intersections.md says what was built and what it
measured in section 12.

docs/architecture.md describes the model (section 6.11), the app's
controls and panel (section 9.4), the tests and the scripted settings
that made the new pictures, and has its counts of lines and tests
brought up to date. Statements elsewhere that a failing vehicle makes
untrue are corrected with it: the list of reasons, the table of
random-number streams, what the status overlay shows and what needs a
pointer.

ACCESSIBILITY.md covers the new controls, colors and blinking marks.
ROADMAP.md no longer lists a vehicle stalled in the box as untested.
GOVERNANCE.md and CONTRIBUTING.md name the one exception to the rule
that vehicles never overlap: a vehicle made to fail, where each contact
is recorded with its speed. docs/cooperative.png is retaken because the
left panel gained a group, and packaging/README.md loses a British
spelling.

Signed-off-by: Jim Schreckengast <schreck@gmail.com>
The app's label for the nominal gap read "Nominal: latency and
actuation (no failures)". With failures in the model that is wrong: the
gap is the two message latencies and the actuation delay, sized for a
vehicle ahead that brakes hard to a stop and not for one that stops
dead, and the failures study shows what happens when one does. The
label now reads "Nominal: latency and actuation only", and
docs/architecture.md quotes it so in sections 6.11 and 9.4.

Signed-off-by: Jim Schreckengast <schreck@gmail.com>
@schreck61
schreck61 enabled auto-merge (rebase) November 15, 2026 13:28
@schreck61
schreck61 merged commit ada863f into main Nov 15, 2026
13 checks passed
@schreck61
schreck61 deleted the cooperative-failures branch November 15, 2026 13:41
This was referenced Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant