Add spatial calibration research and harness

This commit is contained in:
Meta Vens 2026-05-18 13:47:27 +01:00
commit f221ccf8dc
86 changed files with 97488 additions and 4 deletions

102
docs/calibration.md Normal file
View file

@ -0,0 +1,102 @@
# Calibration Harness
This is the first physical-device calibration spine for the expanded spatial rig.
## Objective
Turn connected cameras, microphones, speakers, and near-field sensors into timestamped observations that can be calibrated into one world coordinate system.
## Current Mechanism
The harness uses a repo-local Python environment:
```powershell
& 'C:\Users\Meta\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe' -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r .\requirements-calibration.txt
```
Run discovery:
```powershell
.\.venv\Scripts\python.exe .\scripts\calibration_probe.py discover
```
Capture camera snapshots:
```powershell
.\.venv\Scripts\python.exe .\scripts\calibration_probe.py snapshot --max-index 10
```
Smoke-test input devices:
```powershell
.\.venv\Scripts\python.exe .\scripts\calibration_probe.py audio-smoke --duration 1.0
```
Outputs are written under `calibration/runs/`, which is ignored by git. The manifest files are the disposable lab notebook for the live machine.
## Invariants
- Observations must include device identity, API/backend, timestamp, and confidence or failure reason.
- Calibration files may refer to devices by stable identity where possible, not only by fragile camera index.
- The world model owns truth. Snapshots, audio probes, splat packets, and debug images are evidence.
- Do not assume LeapUVC raw access and Ultraleap tracking coexist.
- Do not assume camera-attached microphones share the camera video clock.
## First Cut
The first useful calibration target is not a full point cloud. It is:
1. identify which video devices can produce frames
2. identify which microphone devices can produce samples
3. capture snapshots from each accessible camera
4. record RMS/peak data from each accessible mic
5. fix driver/backend issues for devices that are attached but inaccessible
## First Probe On This Machine
Run artifacts:
- `calibration/runs/20260518T124230Z-discover/manifest.json`
- `calibration/runs/20260518T124231Z-audio-smoke/manifest.json`
- `calibration/runs/20260518T124257Z-snapshot/manifest.json`
Observed video access:
- `dshow:0` / `msmf:0`: LeapUVC raw stereo IR image, visible as green/magenta packed output.
- `dshow:1` / `msmf:1`: Razer Kiyo-class RGB camera.
- `dshow:2`: second Razer Kiyo-class RGB camera, likely Kiyo Pro.
- PS3 Eye video interfaces are attached but not usable yet. Both `USB\VID_1415&PID_2000&MI_00` devices report Windows problem code `28`, meaning the video-side driver is missing. Their audio interfaces are working through generic USB audio.
Observed audio access over WASAPI at 48 kHz:
- Scarlett Solo USB microphone
- Razer Kiyo Pro microphone
- Razer Kiyo microphone
- both `USB Camera-B4.09.24.1` microphone devices, presumed PS3 Eye audio interfaces
- Scarlett Solo speaker output
## ChArUco Target
A first calibration target has been generated:
```powershell
.\.venv\Scripts\python.exe .\scripts\charuco_calibration.py board
```
Output:
- `calibration/targets/charuco-8x6-dict4x4-100.png`
- `calibration/targets/charuco-8x6-dict4x4-100.json`
Capture intrinsics frames for a camera:
```powershell
.\.venv\Scripts\python.exe .\scripts\charuco_calibration.py capture --api dshow --index 1 --frames 25
```
Solve intrinsics from a capture run:
```powershell
.\.venv\Scripts\python.exe .\scripts\charuco_calibration.py calibrate --images .\calibration\runs\<run-folder>
```