:app · the cockpit
Threats and the DRIVER HUD
The tablet consumes ZTHREAT frames from the Jetson and turns them into the one
display in this system with a safety job. Every decision behind that display lives in
core/vision/SurroundRing, with tests — not in the draw code.
Threat sources
| Type | Role |
|---|---|
ThreatSource | threats: StateFlow<List<DriverThreat>> + feedAlive: StateFlow<Boolean> |
NetworkThreatSource | Listens on 239.7.7.20:10120, 1.5 s staleness watchdog |
FakeThreatSource | Three synthetic contacts including a recurring collision |
RoutedThreatSource | Picks live or demo, derives VisionFeed = LIVE / DEMO / ABSENT |
It once defaulted to true and production never overrode it, which put three
fabricated contacts — one flagged as a collision course — on the driver's night HUD
whenever the Jetson died. The default was removed so no call site can forget to
decide; ZodiacApplication passes false, and the compiler enforces it.
An empty-but-live feed is a real all-clear and must never trigger the demo fallback.
VisionFeed is surfaced, not hidden: the HUD status line reads DEMO
explicitly, the surround ring's rim goes dotted, and the passenger “souls detected” card
is dropped entirely unless the feed is LIVE. The word CLEAR may
only appear when the feed is LIVE.
SurroundRing — all the decisions, none of the pixels
core/vision/SurroundRing holds bearing wrap, sector and band classification, angular
clustering with hysteresis, the brake and check-rear rules, and the five-state status precedence.
ui/concepts/SurroundRingCanvas draws it and nothing else.
Bands, not a radius
radiusFraction = 1 - size was rejected as misleading. Radius on a plan view is read
metrically, and apparent thermal size cannot support that: a child at 5 m and
an adult at 12 m have the same apparent size, someone prone or on a bike does not scale the
same way, and apparent size goes as ~1/r so a linear mapping distorts closure rate into apparent
acceleration.
| Band | size | radiusFraction |
|---|---|---|
FAR | < 0.33 | 1.00 |
MID | < 0.66 | 0.66 |
NEAR | else | 0.34 |
Ordinal reads as “nearer than that one, roughly” and stops the metric reading cold. The 0.34 floor also clears the reticle arms (~0.15 R), which the old 0.18 floor did not. Radius is sensor prominence, not distance, and the KDoc says so.
Clustering
Thirty dots tell a driver nothing. Contacts sharing a Band within
CLUSTER_DEG = 15f merge into one mark, so “crowd on the port bow” renders as
one legible thing. MAX_BLIPS = 12 remains as a backstop.
- Collision contacts are never merged — each stays individually drawn.
- Mean bearing is computed circularly (mean of unit vectors), or a group straddling ±180 would average to dead ahead. That is a real case: a crowd behind the vehicle.
memberCount > 1renders heavier, never as a printed number — text is head-down reading.
Hysteresis
blips() re-sorts every frame, so with noisy size estimates the cap
boundary would flicker and marks would pop in and out — more attention-grabbing than any real
signal. An incumbent must fall below a challenger by SWITCH_MARGIN = 0.08f before being
displaced. Ad-hoc id = 0 contacts never latch: they have no stable identity. This
mirrors tracker.py's switch_margin, which solves the same problem for the
DMX head.
Speed-gated braking
That is what art cars are for. Every one of them is a constant-bearing, looming track, so
brakeAdvised would latch continuously while parked or boarding, and the driver would
have fully tuned it out by the time it mattered at 8 km/h on open playa.
BRAKE_MIN_KPH = 5f. Below that the imperative goes quiet — contacts
still draw, and collision blips still render red. Only the instruction is suppressed,
because below a walking pace the driver can stop trivially.
brakeAdvised reads effectiveSpeedKph
(gpsSpeedKph ?: speedKph). That is load-bearing: the gate previously read only the
debug chips' speed, whose sole writer is the control-strip SPD chip, so on a real drive it was
0 forever and neither ! BRAKE ! nor the
! COLLISION COURSE ! banner could ever fire. The rear alert has no speed gate, which is
exactly why the bench verification passed.
DriverAlerts latches both alerts through AlarmLatch (instant attack,
1.5 s release) so a one-frame contact cannot produce a one-frame
warning.
Coverage arcs — the ring must not lie
The rig is one forward ultra-wide thermal, not a closed ring. zvision already
computes blind sectors and publishes them as ZCOVER frames on the threat group
(golden corpus protocol/coverage-protocol-golden.json). A complete rim with an empty rear quadrant would read “nothing behind you” when the
truth is “nothing watching behind you”.
NetworkThreatSource keeps the latest coverage for 5 s;
SurroundRingCoverage draws the rim from it when fresh. The static
COVERED_ARCS = -64f..64f is now only the fallback for an old or silent Jetson, and a
bare ZCOVER means the whole ring is blind.
An uncovered sector must never render identically to a watched-and-clear one. Uncovered arcs draw as a dotted rim rather than a solid one.
The tablet carries ±64°, and zvision's
--fov-ref now defaults to d too, so the Python side computes the same
±64° by default — confirmed by measurement, not just the
physics argument. Live ZCOVER now carries the rig's real coverage, so the constant
only matters as the fallback.
Full detail →
Status line and banner
Evaluated over all threats, not the forward-filtered list.
| Condition | Text | Colour |
|---|---|---|
visionFeed == ABSENT | NO VISION | NightRed |
brakeAdvised(all, speedKph) | ! BRAKE ! n CONTACTS | NightRed |
rearAlert(all) | ! CHECK REAR ! n CONTACTS | NightRed |
visionFeed == DEMO | n CONTACTS DEMO | NightGreen |
| else | n CONTACTS CLEAR | NightGreen |
- The count must never disappear during an alert — losing it at the busiest moment is backwards, and it is what keeps clustering honest.
! CHECK REAR !, not! REAR !: an imperative matching! BRAKE !. A bare noun reads as a fragment at 3am.- A simultaneous forward + rear collision shows
! BRAKE !— braking is the more urgent instruction. - The centre banner is the primary alert channel because it is big and preattentive; the bottom-left status line is secondary. A rear collision gets the status line and no centre banner — a centre-screen flash for something astern is exactly the mistrust-training problem.
- The
ENTERING <street>flash sits where the collision banner draws, so it yields while! COLLISION COURSE !is up (core/ops/OverlayPriority.streetPopupVisible): a collision warning is never covered by navigation.
Z-order
Rear blips land near the bottom of the ring, which is exactly where near forward figures' feet are drawn. Resolved by paint order, not by moving things:
- Perspective grid
- Ring furniture (rim, ticks, coverage, wedge, hull)
- Non-collision blips
- Wireframe figures
- Collision blips — the only thing allowed to punch through a figure
- Reticle, text
A figure occluding its own blip is correct: the figure is the detail view for that contact. A collision mark is never occluded.
Night discipline
- Static furniture is
NightGrid(#00421E) only — neverNightGreen. - No fills except the hull outline and collision blip interiors.
- Nothing in white, yellow or amber. Palette stays green / red / purple.
- The ring must barely raise the steady-state lit area; blips carry the signal.
- Collision blips get a radial spoke drawn outward, so a closing contact is findable by shape, not only by colour — red-on-black at low brightness is not a reliable sole channel.
- The ring is always on. An alarm-only ring is a ring the driver has never learned to read, and the ring's steady presence is the only place sensor health can live. Solid = watching, dotted = blind or demo. An empty healthy ring is information.
- The ring sits inside
burnInScaffoldand inherits pixel-shift; it adds no independent animation.
Known limitations, documented rather than fixed
- Reversing. Art cars back up. In reverse the entire brake / rear logic
inverts and there is no gear signal. Stated in the
SurroundRingKDoc so it becomes a spotter-procedure item rather than a surprise. - Contact coasting. Thermal tracks drop out on occlusion. A person who vanishes at 3 m vanishes from the ring instantly rather than fading. Do not add tablet-side coasting until the Jetson's track-id churn is fixed — coasting by id while the producer churns ids draws one person as two.
- The two views disagree about “how far left”. A forward contact's ring angle is its true bearing, but its figure x uses the 28° perspective magnification, so at az 20° the figure sits at 79 % screen width while the blip is 20° off vertical. Fixing that needs the perspective mapping redone; an ad-hoc fix is explicitly warned against.
- A person walking parallel to the car at matched speed abeam is a textbook constant-bearing track and will flag. That belongs Jetson-side.
All phases of the surround HUD have landed and been verified against real bus traffic. But
nobody has confirmed a #00421E rim and small hollow blips are legible at
night brightness, through dust, by someone actually driving. One evening on-device at
real brightness is the acceptance test. Until then this feature is built but
not accepted.
Converted fromdesign/surround-driver-hud.md · ARCHITECTURE.md §4.7 · docs/AUDIT-2026-08-09.md A1, A2 (private dev repo) · tasks/open.md (private dev repo)