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

@ -188,6 +188,7 @@ struct Options {
move_marker_min_area_px: u32,
move_marker_max_candidates: u32,
move_psmoveapi_tracker: bool,
move_light_passive: bool,
move_tracker_exposure_milli: u32,
move_evidence_stream_id: Option<String>,
move_evidence_verse_id: String,
@ -402,11 +403,13 @@ fn serve(options: Options) -> Result<()> {
if let Some(stream) = move_evidence_stream.as_mut() {
stream.rudp_sender = move_evidence_rudp_sender;
}
start_default_move_light_worker(
&options,
Arc::clone(&suppressed_default_move_light_paths),
Arc::clone(&move_hue_program),
);
if !options.move_light_passive {
start_default_move_light_worker(
&options,
Arc::clone(&suppressed_default_move_light_paths),
Arc::clone(&move_hue_program),
);
}
start_move_hue_program_sync_worker(&options, Arc::clone(&move_hue_program));
start_provider_command_ingress(&options, Arc::clone(&move_hue_program))?;
start_odin_provider_lease_worker(&options);
@ -9420,6 +9423,7 @@ impl Options {
move_marker_min_area_px: 4,
move_marker_max_candidates: 64,
move_psmoveapi_tracker: false,
move_light_passive: false,
move_tracker_exposure_milli: 100,
move_evidence_stream_id: None,
move_evidence_verse_id: "mimir-live".to_string(),
@ -9605,6 +9609,7 @@ impl Options {
take_value(&mut args, "--move-marker-max-candidates")?.parse()?
}
"--move-psmoveapi-tracker" => options.move_psmoveapi_tracker = true,
"--move-light-passive" => options.move_light_passive = true,
"--move-tracker-exposure-milli" => {
options.move_tracker_exposure_milli =
take_value(&mut args, "--move-tracker-exposure-milli")?.parse()?

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