Add stream proof calibration profile

This commit is contained in:
Meta Vens 2026-06-01 00:10:24 +01:00
commit 1ea8100a7b
15 changed files with 1733 additions and 13 deletions

41
scripts/raven-audio.ps1 Normal file
View file

@ -0,0 +1,41 @@
param(
[string]$TargetHost = "192.168.1.66",
[int]$Port = 5202,
[int]$SampleRate = 48000,
[int]$Channels = 2,
[string]$FfmpegPath = "ffmpeg",
[string]$LogRoot = "C:\Meta\Mimir\logs",
[switch]$DryRun
)
$ErrorActionPreference = "Stop"
New-Item -ItemType Directory -Force -Path $LogRoot | Out-Null
$repo = Split-Path -Parent $PSScriptRoot
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$stdoutLog = Join-Path $LogRoot "raven-realtk-loopback-$timestamp.out.log"
$stderrLog = Join-Path $LogRoot "raven-realtk-loopback-$timestamp.err.log"
$endpoint = "srt://${TargetHost}:${Port}?mode=caller&latency=120000"
$captureScript = Join-Path $repo "scripts\wasapi-loopback-capture.ps1"
$command = "& `"$captureScript`" -Output - -SampleRate $SampleRate -Channels $Channels | & `"$FfmpegPath`" -hide_banner -nostdin -loglevel warning -f f32le -ar $SampleRate -ac $Channels -i pipe:0 -f f32le `"$endpoint`""
Write-Host "Raven Realtek loopback sender:"
Write-Host " target: $endpoint"
Write-Host " format: f32le ${Channels}ch ${SampleRate}Hz"
Write-Host " stdout: $stdoutLog"
Write-Host " stderr: $stderrLog"
if ($DryRun) {
Write-Host $command
exit 0
}
Start-Process `
-FilePath "powershell" `
-ArgumentList @("-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", $command) `
-WindowStyle Hidden `
-RedirectStandardOutput $stdoutLog `
-RedirectStandardError $stderrLog `
-PassThru |
ForEach-Object { Write-Host "Started Raven Realtek loopback sender pid=$($_.Id)" }

View file

@ -72,7 +72,7 @@ if (-not $receiverRunning) {
Start-Sleep -Milliseconds 800
}
$remotePublisher = "nohup python3 /tmp/nightwing_typed_witness_publisher.py --url '$WitnessUrl' --track-eyes --interval 0.12 > /tmp/mimir-nightwing-mvp-witness.log 2>&1 &"
$remotePublisher = 'ps -eo pid=,comm=,args= | awk ''$2=="python3" && $0 ~ /\/tmp\/nightwing_typed_witness_publisher.py/ && $0 ~ /--track-eyes/ {print $1}'' | xargs -r kill; nohup python3 /tmp/nightwing_typed_witness_publisher.py --url ''' + $WitnessUrl + ''' --track-eyes --interval 0.12 > /tmp/mimir-nightwing-mvp-witness.log 2>&1 &'
ssh $NightwingHost $remotePublisher | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Could not start Nightwing typed witness publisher."

View file

@ -0,0 +1,104 @@
param(
[switch]$Headless,
[int]$HeadlessWidth = 1280,
[int]$HeadlessHeight = 720,
[string]$CaptureFrame = "",
[string]$NightwingHost = "nightwing",
[string]$WitnessUrl = "ws://192.168.1.66:8796/eve/periwinkle",
[string]$ConfigPath = "E:\Projects\Mimir\config\mimir-runtime.stream-proof.local.json",
[switch]$DryRun
)
$ErrorActionPreference = "Stop"
$repo = Split-Path -Parent $PSScriptRoot
$logDir = Join-Path $repo "artifacts\runtime\stream-proof"
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
if ($DryRun) {
Write-Host "MIMIR_RUNTIME_CONFIG=$ConfigPath"
Write-Host "Would stage Nightwing witness tools to $NightwingHost and start --track-eyes publisher at $WitnessUrl"
Write-Host "Would launch: dotnet run --project $repo\src\Mimir.App\Mimir.App.csproj"
Write-Host "Raven screen sender: scripts\start-raven-screen-capture-sender.ps1 -TargetHost 192.168.1.66 -Port 5200"
Write-Host "Raven Realtek sender: scripts\raven-audio.ps1 -TargetHost 192.168.1.66 -Port 5202"
exit 0
}
$kiyo = Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match "VID_1532&PID_0E05&MI_00" } | Select-Object -First 1
$leap = Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match "VID_F182&PID_0003&MI_00" } | Select-Object -First 1
if (-not $kiyo) {
throw "Kiyo Pro camera interface is not present. Stream proof needs the Kiyo AR program view."
}
if (-not $leap) {
throw "LeapUVC camera interface is not present. Replug/wake the Leap before launching this profile."
}
$nightwingCheck = ssh $NightwingHost "test -e /dev/video2 -a -e /dev/video3 && command -v python3 >/dev/null && echo ok" 2>$null
if ($LASTEXITCODE -ne 0 -or $nightwingCheck -notmatch "ok") {
throw "Nightwing does not expose /dev/video2 + /dev/video3 with python3 available."
}
scp (Join-Path $repo "tools\nw_eye_cap.py") "${NightwingHost}:/tmp/nw_eye_cap.py" | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Could not stage nw_eye_cap.py on Nightwing."
}
scp (Join-Path $repo "tools\nw_move_hint.py") "${NightwingHost}:/tmp/nw_move_hint.py" | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Could not stage nw_move_hint.py on Nightwing."
}
scp (Join-Path $repo "tools\nightwing_typed_witness_publisher.py") "${NightwingHost}:/tmp/nightwing_typed_witness_publisher.py" | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Could not stage nightwing_typed_witness_publisher.py on Nightwing."
}
$receiverRunning = Get-CimInstance Win32_Process |
Where-Object { $_.CommandLine -match "Mimir.EveSensorReceiver" -and $_.CommandLine -match "--port 8796" } |
Select-Object -First 1
if (-not $receiverRunning) {
$receiverOut = Join-Path $logDir "nightwing-witness-receiver.out.log"
$receiverErr = Join-Path $logDir "nightwing-witness-receiver.err.log"
Start-Process -WindowStyle Hidden -FilePath "dotnet" -ArgumentList @(
"run",
"--no-build",
"--project",
(Join-Path $repo "src\Mimir.EveSensorReceiver\Mimir.EveSensorReceiver.csproj"),
"--",
"--port",
"8796",
"--path",
"/eve/periwinkle",
"--source-id",
"nightwing-witness",
"--type",
"cultmesh-observation"
) -RedirectStandardOutput $receiverOut -RedirectStandardError $receiverErr
Start-Sleep -Milliseconds 800
}
$remotePublisher = 'ps -eo pid=,comm=,args= | awk ''$2=="python3" && $0 ~ /\/tmp\/nightwing_typed_witness_publisher.py/ && $0 ~ /--track-eyes/ {print $1}'' | xargs -r kill; nohup python3 /tmp/nightwing_typed_witness_publisher.py --url ''' + $WitnessUrl + ''' --track-eyes --interval 0.12 > /tmp/mimir-nightwing-stream-proof.log 2>&1 &'
ssh $NightwingHost $remotePublisher | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Could not start Nightwing typed witness publisher."
}
$env:MIMIR_RUNTIME_CONFIG = $ConfigPath
$args = @("run", "--project", (Join-Path $repo "src\Mimir.App\Mimir.App.csproj"))
if ($Headless) {
$args += "--"
$args += "--headless"
$args += "--headless-width"
$args += "$HeadlessWidth"
$args += "--headless-height"
$args += "$HeadlessHeight"
if ($CaptureFrame) {
$args += "--capture-frame"
$args += $CaptureFrame
}
}
Write-Host "MIMIR_RUNTIME_CONFIG=$ConfigPath"
Write-Host "Starting stream proof: Leap + Kiyo Pro + Raven screen/audio, Nightwing Eye/Move witness claims"
Write-Host "Raven senders expected: scripts\start-raven-screen-capture-sender.ps1 -TargetHost 192.168.1.66 -Port 5200"
Write-Host "Raven audio expected: scripts\raven-audio.ps1 -TargetHost 192.168.1.66 -Port 5202"
dotnet @args