ECLIPTIC jetson/ — the edge box zvision: the camera rig

jetson/ · the edge box

zvision — the camera rig

A ring of cameras becomes one full-circle contact list. There is no camera config file: cameras are declared entirely on the command line, because their mounting bearings are a field calibration, not a code constant.

Modules

ModuleRole
app.pyCLI runner; the broadcast + tracker loop
rig.pyCamera mounts, --camera spec parsing, full-circle merge and overlap dedup, coverage-gap reporting
capture.pyUvcCamera and ThermalCamera (cv2); reopens a camera that wedges in select() at cold boot
detector.pyDetector protocol, FakeDetector, MotionDetector
geometry.pyPixel → bearing through a lens model, bbox → size, constant-bearing collision rule
normalize.pyThe array-free arithmetic — contrast stretch window, track-id assignment, re-baseline guard, camera-stall guard. Exists so the suite runs without numpy
threat.py / threat_protocol.pyThe DriverThreat record and the ZTHREAT wire format
broadcaster.pyUDP sender — multicast and subnet broadcast
fleet_bus.pyGroup / port constants, mirrored from Kotlin
tracker.pyDMX target selection, pan/tilt mapping, slew, idle sound show
dmx.pyDMX transport — FakeDmxSink and OlaDmxSink
dmxpark.pyStandalone universe-zeroing fail-safe, with its own entry point
audio_bus.py$ZAUD listener for the idle sound-reactive show
recorder.pyFrame + weak-label dump for model training
tracklog.pyNMEA breadcrumb CSV recorder, own service
trackserve.pyRead-only HTTP server for those CSVs

The pipeline

_mounts_from_args ─► build_rig ─► MultiDetector
                                      │  per camera: detect() → to_global()
                                      ▼
                                 merge_contacts   (cross-camera overlap dedup)
                                      │
                   ┌────────────────┴────────────────┐
                   ▼                                     ▼
            format_frame ─► ThreatBroadcaster      Tracker.update ─► DmxSink
            (ZTHREAT, 10 Hz default)               (pan/tilt/dimmer)

Declaring cameras

python3 -m zvision -v \
  --camera thermal:/dev/v4l/by-path/thermal:az=0:fov=160:lens=fisheye:name=thermal \
  --camera rgb:/dev/v4l/by-path/stbd-aft:az=120:fov=90:fovref=h:lens=pinhole:name=stbd-aft \
  --camera rgb:/dev/v4l/by-path/port-aft:az=-120:fov=90:fovref=h:lens=pinhole:name=port-aft

az is the camera's bearing off the nose (+right), so az=180 faces astern. On the box these live in ZVISION_ARGS in /etc/default/zvision.

Verbose start-up prints each camera's covered arc and the blind sectors:

     thermal: thermal /dev/v4l/by-path/thermal az=+0° fov=160°d equidistant -> covers -64°..+64°
    stbd-aft: rgb /dev/v4l/by-path/stbd-aft az=+120° fov=90°h rectilinear -> covers +75°..+165°
    port-aft: rgb /dev/v4l/by-path/port-aft az=-120° fov=90°h rectilinear -> covers -165°..-75°
  blind: -74°..-64°, +65°..+75°, +166°..+195°
Why the thermal covers ±64°, not ±80°

By-path names are shortened here; use the real /dev/v4l/by-path/ entries, which survive reboots. --fov-ref defaults to d, and the RGB lenses, quoted as widths, say fovref=h. The Lepton Ultra Wide's quoted 160° is the diagonal — argued from physics in HARDWARE.md and since confirmed by measurement (a true 40.4° target reported at 42.5°; the horizontal reading predicts 32.3°). Both sides of the vehicle now compute ±64° by default, and the tablet's SurroundRing.COVERED_ARCS carries the matching arc. Full detail →

As shipped, zero real cameras

install.sh writes ZVISION_ARGS=--source fake --hz 10. The service deliberately fails to start if that file is missing, rather than broadcasting synthetic contacts unattended.

Fusion

to_global rotates each camera's local bearing by its mount azimuth and namespaces track ids as camera_index × 1000 + local_id (id 0 never latches the tracker light).

merge_contacts ranks by collision, then size and drops any contact within the dedup angle (--merge-deg, default 8°) of an already-kept contact from a different camera — never within one camera, which would erase two people standing together.

Lens models

These matter because bearings drive both the HUD and where a real spotlight points.

ModelProjectionUse for
rectilinearr = tan θAn ordinary lens, e.g. the RGB modules (pinhole in a spec)
equidistantr = θA fisheye — the default for the Lepton Ultra Wide (fisheye in a spec)
equisolid—Other fisheye designs
linear—Legacy

Field tuning

The detection numbers cannot be got right on a bench — they depend on how high the camera ends up mounted, how far away people actually walk, and how much contrast a body has against hot ground at 2am. So they are all reachable from the command line: a flag sets a rig-wide default, and the matching --camera spec key overrides one camera.

FlagSpec keyWhat it doesReach for it when
--min-areaminareaMin blob area, fraction of frameDust / shimmer / shade-cloth make phantom contacts (raise) · people missed at range (lower)
--match-distmatchTrack association distanceIds churn as people walk (raise) · two passers swap ids (lower)
--far-h / --near-hfarh / nearhbbox height → the 0..1 range proxyExpect to change these first — pure guesswork until real bodies stand at real distances
--collision-az-rateazratedeg/s still counted as constant bearing! BRAKE ! too twitchy (lower) · missing real intercepts (raise)
--collision-min-sizeminsizeHow near before collision can tripAlarms firing on distant contacts (raise)
--merge-deg—Cross-camera duplicate collapseOne person shows twice in an overlap (raise) · two close people merge (lower)
—azThat camera's mount bearingMeasure against the vehicle nose — an error here rotates that camera's whole contact set and swings the tracker light onto the wrong person
--fov-reffovrefIs the quoted FOV width or diagonalEdge bearings consistently off

--check before you commit a config

python3 -m zvision --check --min-area 0.008 \
  --camera thermal:/dev/v4l/by-path/thermal:az=0:fov=160:lens=fisheye:name=thermal

Validates the whole configuration, prints the resolved rig and its blind arcs, and exits without opening a camera or touching the network.

Always --check before writing /etc/default/zvision

The unit is Restart=always, so an unvalidated typo becomes a crash loop — miserable to unpick from a laptop in the dust.

Recording training data

python3 -m zvision --record /data/drive-01 --record-hz 1 \
  --camera thermal:/dev/v4l/by-path/thermal:az=0:fov=160:fovref=d:lens=fisheye:name=thermal

Writes frames per camera plus an index.jsonl carrying the pixel boxes the motion detector found — weak labels, so an annotator corrects rather than draws.

  • 1 Hz default — consecutive 10 Hz frames are near-duplicates that waste disk and annotator attention.
  • Small frames go to lossless PNG and large ones to JPEG. The split is by pixel count, not by camera kind, so the 160×120 thermal lands on PNG. (The threshold was originally 128×128, chosen for a sensor believed to be 120×120, which silently JPEG'd the thermal — and JPEG artefacts on a low-contrast 160×120 frame destroy real signal.)
  • 20 GB cap by default, shared across all cameras, so a long night cannot fill the boot disk.
  • Failures are reported once and never interrupt detection.

Footage can only be captured while the rig is on the vehicle; GPU time can be rented any evening — which is why the recorder exists before any model work. The training plan →

USB device identity

Today every camera is pinned by port (/dev/v4l/by-path/…usb-0:2.3:1.0…). Measured 2026-08-09, what identity is actually available:

DeviceSerialAddressable by identity?
PureThermal000b0026-5103-3133-3332-3733…Yes — a real per-unit UID
FTDI / DMXBG03OCDSYes, and already is — olad patches it as 13-BG03OCDS-O-1, so the dongle survives a re-plug into any port
Arducam RGBSN0001No — a firmware constant, identical on every unit of this model
What port-pinning actually buys

The az= binding. A camera spec ties a device to a bearing on the vehicle, and the port is what makes that true. If identical cameras can move ports, a camera's entire contact set silently rotates onto the wrong bearing — wrong threat bearings on the driver's HUD, tracker light on the wrong person — and it fails silently: everything opens, frames flow, nothing errors. For the ring, the port is not a limitation to route around; it is the only identity the hardware offers.

Open follow-ups: move thermal and DMX to by-id (free robustness, no downside); name the ports via udev (/dev/zodiac-cam-front etc.) so a mis-plug shows up as a missing device rather than a working camera pointing the wrong way; add a startup identity check that asserts every spec resolves to a distinct device. And label the cables — the realistic failure is someone unplugging everything to fix something else. No code replaces that.

Converted from
jetson/README.md · ARCHITECTURE.md §6.1, §6.2 · jetson/DEPLOY.md §5, §8 · jetson/TRAINING.md §B2 · tasks/open.md