Run Nightwing cameras as isolated Muninn observers

This commit is contained in:
Meta Vens 2026-07-12 23:56:39 +01:00
commit 69a9a736ef
2 changed files with 43 additions and 6 deletions

View file

@ -18,7 +18,11 @@ param(
[string] $HidControllerRudpBind = "0.0.0.0:17888",
[string] $HidControllerRudpAdvertise = $(if ($env:MUNINN_HID_CONTROLLER_RUDP_ADVERTISE) { $env:MUNINN_HID_CONTROLLER_RUDP_ADVERTISE } else { "10.77.0.3:17888" }),
[string] $CommandRudpBind = "0.0.0.0:17889",
[string] $CommandRudpAdvertise = "192.168.1.75:17889"
[string] $CommandRudpAdvertise = "192.168.1.75:17889",
[string] $Eye0StorePath = "/home/metacrat/.local/state/gamecult/muninn/muninn-eye0.telemetry.cc",
[string] $Eye0EvidenceStream = "muninn:nightwing:eye-0:move-evidence",
[string] $Eye0RudpBind = "0.0.0.0:17890",
[string] $Eye0RudpAdvertise = "192.168.1.75:17890"
)
$ErrorActionPreference = "Stop"
@ -126,6 +130,9 @@ if (-not [string]::IsNullOrWhiteSpace($HidControllerRudpAdvertise)) {
}
$hidControllerRudpSetBlock = ($hidControllerRudpSetLines -join "`n")
$commandRudpSetBlock = "set -- ""`$@"" --command-rudp-bind $(Quote-ShSingle $CommandRudpBind) --command-rudp-advertise $(Quote-ShSingle $CommandRudpAdvertise)"
$eye0MoveStateSetLines = ($moveStateSpecs | ForEach-Object {
"set -- ""`$@"" --move-state $(Quote-ShSingle $_)"
}) -join "`n"
$remoteScript = @"
set -eu
@ -141,6 +148,9 @@ fi
for pid in `$(pgrep -f '[m]uninn serve .*--host nightwing' 2>/dev/null || true); do
kill "`$pid" 2>/dev/null || true
done
for pid in `$(pgrep -f '[m]uninn serve .*--host nightwing-eye0' 2>/dev/null || true); do
kill "`$pid" 2>/dev/null || true
done
set -- serve \
--store '$StorePath' \
--log-root '$LogRoot' \
@ -159,9 +169,31 @@ CULTNET_RUDP_TRACE=1 CULTMESH_URI_ODIN_RUDP='$OdinCultMeshRudpEndpoint' nohup '$
2> '$LogRoot/muninn-serve.err.log' \
< /dev/null &
echo `$! > '$LogRoot/muninn.pid'
set -- serve \
--store '$Eye0StorePath' \
--log-root '$LogRoot' \
--host nightwing-eye0
$eye0MoveStateSetLines
set -- "`$@" \
--move-light-passive \
--move-evidence-stream '$Eye0EvidenceStream' \
--move-marker-camera 'nightwing-eye-0=/dev/video2' \
--move-psmoveapi-tracker \
--move-tracker-exposure-milli '$MoveTrackerExposureMilli' \
--interval-seconds '$IntervalSeconds' \
--odin-cultmesh-uri '$OdinCultMeshUri' \
--hid-controller-rudp-bind '$Eye0RudpBind' \
--hid-controller-rudp-advertise '$Eye0RudpAdvertise'
CULTNET_RUDP_TRACE=1 CULTMESH_URI_ODIN_RUDP='$OdinCultMeshRudpEndpoint' nohup '$MuninnExe' "`$@" \
> '$LogRoot/muninn-eye0-serve.out.log' \
2> '$LogRoot/muninn-eye0-serve.err.log' \
< /dev/null &
echo `$! > '$LogRoot/muninn-eye0.pid'
sleep 1
muninn_pid="`$(cat '$LogRoot/muninn.pid')"
eye0_pid="`$(cat '$LogRoot/muninn-eye0.pid')"
kill -0 "`$muninn_pid" 2>/dev/null
kill -0 "`$eye0_pid" 2>/dev/null
muninn_cmdline="`$(tr '\0' ' ' < "/proc/`$muninn_pid/cmdline")"
if ! printf '%s\n' "`$muninn_cmdline" | grep -F -- '--host nightwing' >/dev/null 2>&1 ||
! printf '%s\n' "`$muninn_cmdline" | grep -F -- '--idunn-rudp-health $IdunnRudpHealth' >/dev/null 2>&1; then