Labs · runs in page

The two-lane figure-8

A road that hands you perfect safety for free — and then takes it back the instant anything changes speed. One figure-8, two lanes of exactly equal length, and three ways of arbitrating the crossing, two of which this road rejects for reasons you can read off the geometry.

Built with
Python · ROS 2 · tracklib · CONLab virtual track

Two cars, one figure-8, two lanes. The centerline is a Bernoulli lemniscate scaled to 8.16 × 3.85 metres — the footprint of the CONLab lab floor, and not a number chosen for this write-up: it is the geometry of a track the hardware system actually drove.

The lane pair is a constant ±0.6 m offset of that centerline. Each lane comes out 20.9759 m long. So does the other one. And so does the centerline.

The figure-8 centerline with both offset lanes, their three arc lengths printed in the legend, and the four crossing nodes marked.

The road, with all three arc lengths measured: 20.9760 / 20.9759 / 20.9759 m.

That is not a coincidence and not a rounding artifact — it is the property that makes this road worth building a lab around. A lemniscate’s net turning is zero. Offsetting a curve outward adds arc length in proportion to how much it turns left and removes it in proportion to how much it turns right; on a closed curve whose turning integrates to zero, the two cancel exactly. A circle does not have this property. A figure-8 does.

What equal lane lengths buy you

Put one car in each lane at the same speed. Define their relative phase as the difference in arc-length along their respective lanes.

Because the lanes are the same length, that phase never changes. Not “changes slowly” — it is constant, forever, exactly. Two cars launched 2 m apart in phase are 2 m apart in phase after one lap, after a hundred laps, after an hour.

Which means collision-freedom on this road is decided entirely by one scalar chosen at t = 0, and then never again. There is no controller in that sentence. You pick a number before anything moves, and the geometry enforces it for the rest of time.

The inversion: aligned start is the worst case

The instinct is that lining the cars up is the tidy, safe thing to do. On this road it is the single worst choice available.

Both lanes reach both crossings at the same arc-lengths — s = 0.000 m and s = 12.128 m. That is by construction, not by luck: the arc-length origin was placed on a crossing precisely so the two lanes’ nodes coincide, which makes the conflict phase exactly 0 rather than something you have to go and measure. Two cars at equal phase therefore arrive at a crossing together, every lap, forever.

Measured, with no arbitration and no filter of any kind: one collision, at t = 4.38 s — the two bodies meeting at (0, +0.84), which is the crossing itself.The project ledger quotes 4.1 s for this event. That figure is the arm with the command-level brake ON; the truly bare arm makes contact at 4.38 s and the run terminates 0.2 s later. Keep the two arms’ timings apart.

The bare road at the conflict phase — no arbitration, no filter. The two cars converge from opposite lobes onto the upper crossing.The recording ends at t = 3.15 s, about 1.1 s before the contact: the scene stream in this run’s bag holds 184 of the 460 recorded poses and stops at 3.30 s. So the clip shows the approach, not the impact. Re-recording it is open work, and the caption says what the frames actually contain rather than what the run measured.

And phase 0 is the unique conflict. A shared collision site needs the same site on both lanes, and equal node arc-lengths make that true at exactly one phase. So the road has a single bad number in a continuum of good ones — a much more interesting thing than “sometimes they crash”.

Further apart in phase is not further apart in space

Here the geometry stops being friendly. Walk the phase out from 0 and measure the run’s own minimum pair gap over 60 s:

phase offset bare road with the reactive brake
±0.75 m 0.003–0.010 m 0.51–0.53 m
±1.0 m 0.209–0.219 m 0.698–0.700 m
±2.0 m 0.99–1.00 m 1.09–1.11 m
±5.0 m 2.13–2.19 m 2.13–2.19 m
±10.488 m (antipodal) 0.848 m 0.848 m

It grows monotonically out to ±5 m — and then it shrinks. The safest stagger is nowhere near the largest one, because on a lemniscate the two halves of the track fold back on each other. Put a car exactly half a lap away and you have put it on the other lobe, passing close.

Two panels: minimum pair gap against phase offset, showing the failing band on the left and the fold-back with its peak at plus or minus five metres on the right.

Minimum pair gap against starting phase. Left: the failing band, and the three arms that delete it. Right: the fold-back, peaking at ±5 m — the antipodal point is worse.

The junction is one region, not four points

There are four crossing events on this road: two cross-lane crossings at (0, ±0.8397), and each lane crossing its own path at (±0.859, 0).

The four sites sit inside a diamond 1.718 m across — under three car lengths. Whatever arbitrates this road is not managing four independent intersections. It is managing one compact region in which everything happens at once.

The four crossing nodes with coordinates and kinds, the diamond they form dimensioned, and one vehicle drawn to scale beside it.

The four crossings, and one car drawn to scale. The whole junction is 1.718 × 1.679 m.

The self-crossings deserve a sentence, because they cost two failed runs to learn. The track library originally carried only the two cross-lane nodes; each lane crossing itself was noted in a docstring and deferred as “what two cars sharing a lane would need”. Two cars per lane is N = 4, which is the last section. Until the road named those sites, two lane-mates 6.45 m apart in arc could collide with the scorer still reporting the junction clear — correctly, since as far as the road was concerned nothing there was a junction.

A road that crosses itself and does not say so is not a smaller road; it is a wrong one.

Why any of this needs a controller at all

Everything above holds provided nothing ever changes speed.

That proviso is false the moment a car brakes, is commanded to stop, or runs a different speed profile. Phase invariance is a consequence of equal lane lengths and equal speeds; break the second and the fleet begins to walk along the ladder of phases — including through the one that kills it.

And the failing band is narrower than a car: 0.5 m out of a 20.976 m lane once a reactive brake is present. You cannot avoid a 0.5 m target by driving carefully. You avoid it by knowing where you are relative to a peer, which is a coordination problem, not a control problem.


Give decentralization its best fair shot

Every agent reactive, braking for what it sees. No arbitration.

The brake works. What it cannot do is see a lateral conflict. Measured on the filter directly: a peer 1.0 m directly ahead brakes the ego to 0.312 m/s and 1.5 m ahead to 0.938 m/s — while a peer 0.8 m perpendicular, 1.5 m perpendicular, or closing diagonally produces no intervention at all. Peers are static circles at their current position and the rollout is 1.0 s / 1.25 m, so the brake fires only for something already on the ego’s path. It is a longitudinal mechanism. A crossing is a lateral conflict.

But “reactive braking fails” is not the honest headline. The brake shrinks the catastrophe band 2.4× — 1.2 m wide down to 0.5 m — and changes the residue’s failure mode from contact to gridlock. Whenever arrivals are staggered, the later car finds the earlier one on its path and does brake. Both band edges are bracketed by passes, so both are measured widths rather than the ladder running out of points.

The cone that looks the wrong way

If an agent only sees peers within a forward cone, how wide must that cone be for braking to still save it? Derive the half-angle from the requirement rather than tuning it to an outcome:

half-angle contiguous warning before the commit instant
30–38° 0.00 s
40° and wider 1.88 s

The mechanism is an inversion. The peer is dead ahead at t = 2.7 s with 4 m of gap, and then sweeps back out to 39.5° off-axis by the instant braking stops being enough — so a 30° cone is blind for the last 0.60 s before the decision, precisely while the gap closes to zero.

The visibility cone drawn at the commit instant, beside plots of peer bearing and gap against time.

A forward cone loses a crossing peer exactly when the conflict becomes urgent. The later you can afford to decide, the wider the cone you need.

This is why real intersections carry right-of-way conventions: no forward cone is looking the right way when it matters. And 40° sits inside a plausible attentive-driver cone, so the decentralized case keeps its fair best shot.


Hand the whole problem to a coordinator

Now remove reactive braking entirely. Agents obey GO and STOP and nothing else; all the decision-making load moves to an arbitrating layer. Same road, same tracker, same scenario grammar, same spine — one flag changed. That substitutability is the actual showpiece: these are not two codebases, they are two answers bolted to an unchanged seam.

Four cars — two per lane — on the CONLab hardware geometry, at the conflict phase, for 60 s:

laps completed 3.81 – 4.17
longest hold 3.0 s of a 20 s budget
minimum pair gap 0.52 m
collisions 0
junction never co-occupied — missed by 0.46 m of arc / 1.39 s

Four cars, 60 s, region admission. The crossings are never co-occupied.

The sharper result: the road sorts three architectures

Described completely — with each lane’s self-crossing named as the node it is — this road distinguishes three ways of arbitrating it, and rejects two of them for reasons readable off the geometry:

architecture on this road
per-agent right-of-way rule Refuses to build. Its deadlock-freedom argument requires consecutive junctions to be further apart than its detection radius. Here they are 1.201 m apart against a 3.4 m radius.
central coordinator, per node Runs. But it decides each node alone, so two lane-mates — one in each crossing — are each nearest at their own node, and nobody asks about the pair. They pass within 0.305 m of a 0.671 m two-body reach.
fleet-wide region admission Arbitrates it, at N = 2 and at N = 4.

The first row is worth dwelling on. Nothing about that rule changed — it had cleared this same crossing a day earlier with one car per lane. What changed is that the road learned to describe itself, and the completed description violates a precondition the rule had always carried. The runner refuses to build the scenario and prints why:

$ vt_run.py --scenario s9_two_lane_eight_guarded

ValueError: approach_m=3.4 m must be shorter than
the smallest gap between consecutive junctions on
this route (1.201 m), or two junctions can be live
at once and the deadlock-freedom argument fails

A layer that declines to run on a road it cannot guarantee is a better artifact than one that runs and is quietly unsound. That this is visible is a property of the spine, not a lucky catch.

The capacity number

The instinct for a junction is to serve one car at a time. Measure whether you can afford to. Each lane’s junction footprint — the arc it spends inside the region — is 6.32 m of a 20.98 m lane, 30.2%. And it does not shrink as the road grows: 24.1% at size 5.0, 20.1% at 6.0. The footprint is set by the cars’ physical reach and the angles at which the lanes cross; growing the track only lengthens the lap between the crossings.

So at the size the hardware actually is, four cars demand 121% of a junction served one at a time. Serialized admission is over capacity before a single command is issued.

The road flows anyway, and the reason is readable off it before any run. Scan every junction stretch against every other and two pairs come out compatible — both diagonal, held apart by the 1.200 m lane offset. Cars cross together, and only crosswise. The concurrency budget is a pairing, not a count, which is exactly why a policy that admits by conflict rather than by capacity is necessary here rather than merely tidy.

Two panels over the same four junction stretches: left shows the compatible diagonal pair admitted together, right shows the conflicting same-lane pair refused.

Left: the compatible diagonal pair, 1.200 m apart, admitted together. Right: the conflicting pair — deliberately the same-lane one (0.009 m), because that is the conflict a per-node authority cannot see.

What the layer actually is

An arrival-ordered queue per region. Walk it front to back, admitting every stretch that conflicts with nothing already admitted. A queued car drives to its stretch’s entry and stops there; an admitted car keeps its place until its body is clear of the far end.

It keeps state, and that is deliberate. An earlier reservation-based attempt was measured, traced and dropped: it gridlocked on a mutual hold between two private claim tables, because a lane-mate was invisible to one arbiter and each built its table over a different population. With a single writer that failure is impossible by construction. And arrival order cannot be expressed without memory — a stable order is precisely what lets two compatible stretches stay admitted together instead of swapping under each other.

Liveness is the dropped design’s lesson, kept. An admitted car that has not yet entered must close 0.05 m on its stretch within 1.0 s or lose its admission and requeue at the back. A car already inside is never revoked.

The phase ladder, all five arms

arm failing band closest approach near phase 0
bare road |p| ≤ 0.60 m contact
reactive brake |p| ≤ 0.25 m contact / 0.02–0.14 m
decentralized rule none in 24 phases 0.475–0.499 m
central coordinator none in 24 phases 1.775–1.817 m
region admission none in nine phases 0.578–0.634 m

The band goes to zero, and the phase stops mattering. A 5.6 cm spread across a region where the unarbitrated arm ranges from contact to 0.7 m. That is a controller holding a clearance rather than reacting to a geometry — and it is what makes the opening guarantee, safety decided by one scalar at t = 0, unnecessary rather than merely lucky.


Trade-offs — what was chosen, and what it costs

How should the junction be arbitrated?

chose
Fleet-wide region admission
over
Per-agent right-of-way rule · Central coordinator, per node · Reservation tables per agent
costs
A single stateful writer — the one component that is not per-agent, and the one that cannot be run redundantly.

The road itself rejects the alternatives: the per-agent rule’s deadlock-freedom precondition is violated by 1.201 m junction spacing, and a per-node authority is structurally blind to a pair of lane-mates in different crossings. Region admission is what remains once the road is described completely.

Model the junction as points, or as a region?

chose
One region with per-lane stretches
over
Four independent node crossings
costs
Admission must run a conflict scan over stretches rather than a counter over nodes.

The four crossing sites fit inside a 1.718 m diamond — under three car lengths. They were never independent intersections. Treating them as one region is also what makes the capacity result expressible: 121% demand served only because two diagonal stretches are compatible.

Let the arbiter keep state?

chose
Yes — a single writer with an arrival-ordered queue
over
Stateless per-tick recomputation · Per-agent private claim tables
costs
Requires an explicit liveness rule; an admitted car that stalls must be revoked and requeued.

Arrival order cannot be expressed without memory, and the private-table variant was measured into a mutual-hold gridlock. One writer makes that failure impossible by construction rather than by care.

Findings — what broke, and what changed because of it

Two lane-mates 6.45 m apart in arc collided while the scorer reported the junction clearfixed

cause
Each lane crosses its own path at (±0.859, 0) and the track graph did not say so — only the two cross-lane nodes existed
fix
Named all four crossings in the track library: four nodes, eight edges. The lanes did not move (2.1e-06 m over the whole lane)
ref
tracklib.two_lane_eight

Nothing in the stack could have caught this. A region has no transit to admit, the per-agent rule skips same-track peers by design, and the follower measures the arc gap. The scorer was right: as far as the road was concerned, nothing there was a junction.

A car inside two crossings at once was force-admitted past the conflict check, and collidedfixed

cause
A transit was modelled as a node, but with the self-crossings named a lane's windows overlap in arc
fix
Merged into two stretches per lane, 3.18 m and 3.16 m, one admission each

A transit is a stretch, not a node. The fix is the reason the capacity result is expressible at all — you cannot measure a footprint against a point.

The central coordinator looked architecturally expensive: 1.80 m of clearance against the rule's 0.48 m, and 1.55–2.31 s of stall against 0.24–0.99 sfixed

cause
It declared no hold line, so a yielder stopped wherever it happened to be — the hold line was conflated with the detection radius
fix
Derived the hold line per agent and node; the arms are now the same controller to within a lap count

Measured before the fix, this reads as “centralization is expensive”. It is not that at all — the central arm now laps slightly more than the rule. An architectural cost that dissolves under a bug fix was never architectural.

Every contact count recorded before the scorer fix was wrong — collisions appeared to taper (14 → 9 → 3 → 1) as phase grewfixed

cause
The colliding pose was deleted before scoring, so a colliding run never ended; it kept driving and kept crashing
fix
Snapshot poses before the plant reset. Re-cut, every colliding run is exactly one contact

The apparent taper was really how quickly a run fell into deadlock after the crash that should have ended it — two regimes read as one continuum. The instrument reproduced the error it was built to catch.

The cold-open recording was believed to end on the collision frame; it ends 1.1 s of simulated time before itopen

cause
The bag's scene stream holds 184 of the run's 460 poses and stops at 3.30 s, while the contact is measured at 4.38 s — so the recording never contained the event
fix
None yet. The caption was corrected to describe the frames rather than the run

The clip had been trimmed 92 frames to 88 to cut the post-reset teleport that makes a collision read as its own opposite — a real hazard, correctly handled. What the trim could not reveal is that the frames being trimmed stopped short of the event. A recording that is short is indistinguishable from a recording that is complete, unless something outside it knows when the run ended.

On a single-node road, where region admission can win nothing, its holds bunch a lane: minimum pair gap 0.07 m against the central arm's 0.25 mopen

cause
Unknown
fix
None yet

Recorded because a lab page that only reports its wins is not evidence. The two numbers are also not the same quantity — the central arm’s 0.25 m is its spawn spacing, never closed further, while this is a real event at t = 6.8 s between lane-mates. It sits on the competence floor rather than at the junction.

What this is preparation for

This is the validation road for the virtual track — the scenario grammar, the headless runner, the CLI, the scoring sidecars — and the substrate for motion-planning and decision-making experiments that come after. The road is chosen to make a coordination problem unavoidable and legible at a size that fits a real lab floor.

← All labs