svc-vision: camera live view, moved from app-flutter's test tool

Camera-agnostic (--camera auto finds any V4L2 capture device and finds it
again after a replug; non-MJPEG cameras are encoded), says when the camera
is unavailable, paced per decision 28. Python, standard library only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
2026-10-12 16:14:03 +09:00
commit d438b516e5
9 changed files with 432 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
---
type: guidelines
---
# Vision guidelines
## 1. Camera-agnostic
- Any V4L2 capture device works. Never hard-code a node such as `/dev/video0`:
numbering follows enumeration order. Take a `/dev/v4l/by-id/` path, or find
the camera at runtime (`--camera auto`).
- Use what the camera offers. MJPEG passes through untouched; anything else is
encoded here. A requested size or rate the camera lacks falls back to its own
default rather than failing.
- UVC control names differ between cameras and kernels. Look them up on the
device; reply that a control is missing rather than guessing.
## 2. One process owns the camera
- V4L2 capture is single-reader. This service opens the device; recording and
inference take frames from it, never from the device.
- UVC controls reset when the camera re-enumerates. Set them on open, not once.
## 3. The tablet link is the constraint
- Every socket to a display is paced (`SO_MAX_PACING_RATE`, project-yukart
decision 28). Unpaced bursts stall the USB link for seconds.
- Latest frame wins. A slow client skips frames; it never gets a queue of old ones.
- Say when there is no camera. A client must be able to tell "unavailable" from
"slow".
## 4. Python, on purpose
- Python 3.10 (the Orin's), standard library only; GStreamer and v4l-utils come
from the host. The exception to Rust for Orin services is decision 29: camera
pipelines and inference live in the Python ecosystem.
- No pip installs on the car Orin until there is a reason; then a venv under
`~/infra/svc-vision/`, never the system Python.
## 5. To be added