From f8ff563c3e26d93769ec0c0c42fc2c5c9786f83f Mon Sep 17 00:00:00 2001 From: Cutshion Date: Fri, 20 Nov 2026 12:10:58 +0900 Subject: [PATCH] Added voice section Co-Authored-By: Claude Opus 5.5 --- api/server.py | 26 ++++++++++++++++++++++++-- tasks/wave_lines.py | 22 +++++++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/api/server.py b/api/server.py index c0401e6..240b5b4 100644 --- a/api/server.py +++ b/api/server.py @@ -528,13 +528,35 @@ def body_move(body: BodyBody): (round(p, 2) for p in head.status())))} +def _wave_hello(): + """One line of wave_lines.ASKED in English or Korean (picked at random, as Wave greet does), said in the background + once the hand is up; skipped when Lumi is already speaking.""" + from tasks import wave_lines + line = random.choice(wave_lines.ASKED)[random.randrange(2)] + + def run(): + if not _voice_lock.acquire(blocking=False): + return + try: + from audio import mouth + mouth.say(line) + except Exception as e: + print(f"wave hello: say failed: {e!r}", flush=True) + finally: + _voice_lock.release() + _bg(run) + + @app.post("/arm/wave", tags=["arm"], summary="Wave, checked first (manipulation/wave.py): look -> wave_out -> " - "wave_start, the swings, stays at wave_start") + "wave_start, the swings, stays at wave_start; with Greeter or " + "Patrol on Lumi says hello (EN or KO) as the hand comes up") def arm_wave(): robot_free(manual=True) + m = read_modes() + talk = m["greeter"] or m["patrol"] # owner 2026-11-20: a hello out loud only with Greeter or Patrol on _waving.set() try: - wave.wave() + wave.wave(on_up=_wave_hello if talk else None) except wave.WaveError as e: raise HTTPException(409, e.args[0]) except motion.MotionError as e: diff --git a/tasks/wave_lines.py b/tasks/wave_lines.py index 42d670c..97a2d01 100644 --- a/tasks/wave_lines.py +++ b/tasks/wave_lines.py @@ -1,5 +1,6 @@ """What Lumi says while it waves back at someone (tasks/wave_greet.py), (English, Korean). One language per wave, -picked at random: a passer-by's language is not known. The lines fit a hello and a goodbye alike.""" +picked at random: a passer-by's language is not known. The lines fit a hello and a goodbye alike. +ASKED is for the WAVE button (api/server.py /arm/wave), said only with Greeter or Patrol on.""" # the first wave of someone new: Lumi introduces itself (once, until they leave the view) INTRO = [ @@ -72,3 +73,22 @@ LONG = [ ("Even my battery is waving goodbye now.", "이제 제 배터리도 손 흔들고 있어요."), ("Alright, alright! Hello, hello, hello!", "알았어요, 알았어요! 안녕, 안녕, 안녕하세요!"), ] + +# the WAVE button in the app (api/server.py /arm/wave): nobody waved first, Lumi just says hello to whoever is there +ASKED = [ + ("Hello everyone!", "여러분, 안녕하세요!"), + ("Hi! I'm Lumi. Nice to see you!", "안녕하세요! 루미예요. 반가워요!"), + ("Hello there! Have a great day!", "안녕하세요! 좋은 하루 보내세요!"), + ("Hi hi! Lumi says hello!", "안녕, 안녕! 루미가 인사해요!"), + ("Hello! Welcome to Cutshion!", "안녕하세요! 컷션에 오신 걸 환영해요!"), + ("Hi! A big wave from Lumi!", "안녕하세요! 루미가 크게 손 흔들어요!"), + ("Hello, friends! How are you today?", "친구들, 안녕하세요! 오늘 기분 어때요?"), + ("Hi there! Sending you a friendly hello!", "안녕하세요! 반갑게 인사 드려요!"), + ("Hello! It's a good day to say hi!", "안녕하세요! 인사하기 좋은 날이에요!"), + ("Hi! I'm waving just for you!", "안녕하세요! 여러분을 위해 손 흔들어요!"), + ("Hello! Lumi is here and happy to see you!", "안녕하세요! 루미가 여기 있어요, 만나서 기뻐요!"), + ("Hey! Smile, Lumi is waving!", "안녕하세요! 웃어요, 루미가 손 흔들고 있어요!"), + ("Hi! Thanks for stopping by!", "안녕하세요! 들러 주셔서 고마워요!"), + ("Hello! Wishing you a wonderful day!", "안녕하세요! 멋진 하루 되세요!"), + ("Hi everyone! Lumi at your service!", "여러분 안녕하세요! 무엇이든 도와드릴게요!"), +]