live: real-time browser viewer (AICC-client based), sensor-built top-down map shared module, run_live.sh one-command mode
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Real-time mode: starts the bridge + the live browser viewer, then runs the
|
||||
# demo while you watch. Open http://127.0.0.1:8000 in a browser.
|
||||
# Usage: scripts/run_live.sh [demo args...] e.g. --agent scripted
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
BRIDGE_PID=""
|
||||
LIVE_PID=""
|
||||
|
||||
# 1. bridge (reuse an already-running one)
|
||||
if python3 -c 'import socket,sys; s=socket.socket(); sys.exit(0 if s.connect_ex(("127.0.0.1",8765))==0 else 1)'; then
|
||||
echo "[live] bridge already running on 8765"
|
||||
else
|
||||
testbed/.venv/bin/python -m testbed.bridge --port 8765 >/tmp/aicc-bridge.log 2>&1 &
|
||||
BRIDGE_PID=$!
|
||||
sleep 1.5
|
||||
echo "[live] bridge started (pid $BRIDGE_PID)"
|
||||
fi
|
||||
|
||||
# 2. live viewer
|
||||
testbed/.venv/bin/python -m testbed.live --http-port 8000 --ws-port 8001 >/tmp/aicc-live.log 2>&1 &
|
||||
LIVE_PID=$!
|
||||
sleep 1.5
|
||||
echo "[live] viewer up: open http://127.0.0.1:8000 in your browser"
|
||||
|
||||
# 3. demo (foreground; pass through agent args)
|
||||
testbed/.venv/bin/python -m testbed.demo "$@"
|
||||
EXIT=$?
|
||||
|
||||
kill "$LIVE_PID" 2>/dev/null || true
|
||||
if [ -n "$BRIDGE_PID" ]; then kill "$BRIDGE_PID" 2>/dev/null || true; fi
|
||||
exit $EXIT
|
||||
Reference in New Issue
Block a user