Update 2026-04-23 09:55:45

This commit is contained in:
kassam 2026-04-23 09:55:45 +04:00
parent 0df2f2eb11
commit 6b7d6da47c

View File

@ -70,6 +70,36 @@ cd "$SAQR_DIR" || {
} }
echo "[start_saqr] env=$CONDA_ENV cwd=$PWD iface=$DDS_IFACE source=$SAQR_SOURCE stream=$STREAM_PORT" echo "[start_saqr] env=$CONDA_ENV cwd=$PWD iface=$DDS_IFACE source=$SAQR_SOURCE stream=$STREAM_PORT"
# ── Clear competing voice/audio processes ───────────────────────────────────
# The G1 firmware voice service (TtsMaker / PlayStream) goes into a
# "busy" state — returning rc=3104 or silently dropping audio — when
# another process on the robot holds the audio channel. Known offenders
# on this robot: sanad_voice.service, sanad_webserver, marcus_voice,
# and stale saqr bridge/saqr_cli instances left by previous runs.
# Kill them all before starting so the firmware starts from a clean
# state. All commands are best-effort (|| true) and non-interactive
# (sudo -n) so they never block.
echo "[start_saqr] clearing competing voice/audio processes..."
killed=0
for svc in sanad_voice.service sanad_webserver.service marcus_voice.service; do
if sudo -n systemctl stop "$svc" >/dev/null 2>&1; then
echo "[start_saqr] stopped systemd unit: $svc"
killed=1
fi
done
for pattern in sanad_voice sanad_webserver marcus_voice gemini_voice \
'python.*robot\.bridge' 'python.*apps\.saqr_cli'; do
if pkill -f "$pattern" >/dev/null 2>&1; then
echo "[start_saqr] killed: $pattern"
killed=1
fi
done
if [ "$killed" -eq 1 ]; then
# Give the firmware a beat to release the voice RPC service.
sleep 1
fi
echo "[start_saqr] launching bridge..." echo "[start_saqr] launching bridge..."
exec python3 -m robot.bridge \ exec python3 -m robot.bridge \