#!/usr/bin/env bash # Boot -> Stage 02 flight -> fly the survival pilot, sampling the candidate # REMAINING OB address against the HUD the whole time. # # fly_session.sh with one addition: ob_sample.py runs alongside the pilot, so # the RAM word and the HUD digits come from the same run rather than from two. # The pilot is not optional decoration -- an unattended craft is dead in about a # minute (upstream-baseline.md), and a dead craft produces no transitions, which # is exactly the evidence this test needs. # # NOTE (2026-08-23): launch_mission.sh does not currently finish unattended on a # freshly restored profile -- it reaches the READY ROOM and stops on BRIEFINGS # (docs/re/dynamic-re-state-restore.md). Until that fixed `sleep 28` becomes a # wait for the screen, this script inherits the same stop and the sampler never # starts; drive the last two presses by hand, or fix the launcher first. set -u export HOME=/sylph-home/re SDL_AUDIODRIVER=dummy DISPLAY=:98 export PYTHONPATH=/sylph-home/.local/lib/python3.12/site-packages SD="$(cd "$(dirname "$0")" && pwd)" SECS="${1:-240}" TAG="${2:-ob}" VA="${OB_VA:-0xbdb59668}" SHOTS=/sylph-home/re/shots/$TAG CFG=/tmp/nav-live.json "$SD/launch_mission.sh" fly || { echo "BOOT FAILED"; exit 1; } mkdir -p "$SHOTS" # Sample immediately -- the first reading is the cross-run test and must not # depend on the pilot binding, which can fail on its own. python3 "$SD/ob_sample.py" "$VA" "/tmp/$TAG-ob.csv" "$SHOTS" "$TAG" 25 \ "$(python3 -c "import math;print(max(2,math.ceil($SECS/25)))")" & SAMPLER=$! if python3 "$SD/entities2.py" self 0x130 "$CFG"; then echo "--- config: $(cat "$CFG")" python3 "$SD/pilot.py" "$CFG" "$SECS" || echo "PILOT EXITED $?" else echo "BIND FAILED -- sampling an unattended craft, expect a short run" fi wait $SAMPLER 2>/dev/null echo "--- samples: /tmp/$TAG-ob.csv" cat "/tmp/$TAG-ob.csv" echo "SESSION DONE"