Spaces:
Running
Running
File size: 897 Bytes
f851c34 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/usr/bin/env python3
"""Quick check: can the robot play audio from this laptop?"""
import sys
import time
from reachy_mini import ReachyMini
def main() -> int:
wav = "/home/remi/reachy_mini_apps/reachy_mini/examples/recorded_audio.wav"
print("Connecting to robot...")
with ReachyMini() as r:
mode = r.connection_mode
has_media = hasattr(r, "media") and r.media is not None
print(f"Connection mode: {mode}")
print(f"Has media: {has_media}")
if not has_media:
print("FAIL: no media backend")
return 1
try:
print(f"Playing {wav} ...")
r.media.play_sound(wav)
time.sleep(3)
print("OK: play_sound completed")
return 0
except Exception as e:
print(f"FAIL: {e}")
return 1
if __name__ == "__main__":
sys.exit(main())
|