Stop words stop every motion without the wake word and before every echo filter; give me a hand / shake hands / 악수 reach out, busy cleared by stop; look phrasings, more / again / 더 step further, act before speaking; own-voice echoes no longer asked again

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 16:59:30 +09:00
co-authored by Claude Opus 5.5
parent 6177e5eef3
commit 6f2113c15a
11 changed files with 470 additions and 37 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ for t in ["I'll be back", "I'm behind you", "I'll be right back"]:
for t in ["can you fly?", "jump", "jump for me!", "dance for me", "can you dance?", "climb the stairs", "open the door",
"make me a coffee", "lift this table", "pick up that chair", "go upstairs", "do a backflip", "run!", "sit down",
"날아 봐", "점프해", "춤 춰 줘", "커피 타 줘", "계단 올라가", "문 열어 줘", "이 책상 들어 봐", "앉아", "pick up my phone",
"take my laptop", "carry me", "give me a hug", "shake hands with me", "throw the cup", "kick the ball",
"take my laptop", "carry me", "give me a hug", "throw the cup", "kick the ball",
"pick me up", "날 안아 줘", "공 차 봐", "이 의자 옮겨 줘", "pick up the box", "bring me a pizza"]:
both("cannot", [t], "talk | ask | unclear")
+1 -1
View File
@@ -168,7 +168,7 @@ for t in ["wave", "wave at them", "wave your hand", "wave hello", "give them a w
"say hi with your hand", "손 흔들어", "손 흔들어 줄래?", "손 인사 해 줘", "손 좀 흔들어 주세요", "애들한테 손 흔들어 줘",
"wave 해 줘", "손 wave 해 봐"]:
add("wave", t, "action:wave")
for t in ["do you know how to wave?", "손 흔들 줄 알아?", "I saw you wave yesterday", "the wave was nice", "shake hands with me",
for t in ["do you know how to wave?", "손 흔들 줄 알아?", "I saw you wave yesterday", "the wave was nice",
"a new wave of visitors is coming"]:
add("wave_not", t, "talk")
for t in ["bye bye", "bye-bye!", "바이바이", "빠이빠이", "잘 가", "okay, bye!", "see you, Lumi"]:
+23 -2
View File
@@ -10,7 +10,7 @@ import re
import sys
from pathlib import Path
from assistant import brain, lumi, seeing
from assistant import brain, lumi, seeing, web
from tests.conversation_check import NOW, rules_route
from tests.followup_cases import CASES
from vision import scene
@@ -57,7 +57,9 @@ def route(b, text, frames):
if h["action"] == "search":
return "search", b.search_query(h["target"])
if h["action"] != "none":
return f"act:{h['action']} {h['target']}" if h["action"] != "weather" else "weather", h["target"]
if h["action"] == "weather": # the place kept, the day in the words
return "weather", h["target"] or f"weather {b.weather_place('', text)} {text}"
return f"act:{h['action']} {h['target']}", h["target"]
return "llm", ""
@@ -147,4 +149,23 @@ if __name__ == "__main__":
b.history = [("what's a lidar?", "ACTION: none -\nA laser scanner.")]
assert b._after({"action": "quiet", "target": ""}, "에이, 거짓말하지 마")["action"] == "none"
assert b.again("one more time") == "same" and b._after({"action": "none", "target": ""}, "again")["action"] == "none"
from assistant import driving # "more" right after a look: the head a step further (live 2026-10-23)
looked = driving.last_command([("Look at the left side.", "ACTION: look left")])
for said in ("More again.", "Look at more.", "Look at the left side more.", "more", "a bit more", "again", "더", "조금 더",
"한 번 더", "좀 더 봐", "왼쪽으로 더", "look more to the left"):
assert driving.read(driving.clean(brain._norm(said)), looked) == ("look", "left small"), said
assert driving.read("look right", looked) is None and driving.read("i want more", looked, True) is None
assert driving.read("오른쪽으로 더", looked) == ("look", "right small")
# the weather asked, then the day moved (live 2026-10-23 15:37: "내일 어때요?" and "다음 주 월요일 어때요?" were
# searched, "날씨 어때요?" then gave today's weather): the weather again, the day and place kept
b = brain.Brain()
b.history = [("오늘 부산 날씨 어때요? (the weather)", "흐려요.")]
b.last_lookup, b.weather_at = b.history[0][0], "Busan"
for t in ("내일 어때요?", "다음 주 월요일 어때요?", "And Friday?", "how about the day after?", "모레는요?"):
for said in ("none", "search"):
assert b._after({"action": said, "target": t}, t) == {"action": "weather", "target": ""}, (t, said)
assert b._after({"action": "none", "target": ""}, "what about Daegu tomorrow?") == {"action": "weather", "target": "Daegu"}
assert b._after({"action": "none", "target": ""}, "Thanks, see you tomorrow!")["action"] == "none"
b.history = [("다음 주 월요일 어때요?", "다음 주 월요일은 10월 26일이에요.")]
assert b.weather_on("날씨 어때요?") == web.asked_day("다음 주 월요일")
print("followup ok")
+13
View File
@@ -43,6 +43,12 @@ CASES.update({ # any wording of the body commands, English, Korean and mixed (
"정면 봐": ("look", "center"), "고개 살짝 왼쪽으로": ("look", "left small"), "고개 좀 위로 살짝 들어 봐": ("look", "up small"),
"고개 오른쪽으로 30도 돌려": ("look", "right 30"), "turn your head left 120": ("look", "left 120"),
"look behind you": ("look", "left 180"), "뒤를 봐": ("look", "left 180"), "뒤 돌아봐": ("look", "left 180"), "now 오른쪽 봐!": ("look", "right"),
# up / down as said or heard live (2026-10-23: "Look at the bellow.", "Look it up." went to the LLM)
"Look at up.": ("look", "up"), "look at the up": ("look", "up"), "look upward": ("look", "up"), "look above": ("look", "up"),
"Look it up.": ("look", "up"), "Look at down.": ("look", "down"), "look downwards": ("look", "down"),
"Look at the bellow.": ("look", "down"), "look below": ("look", "down"), "위 봐": ("look", "up"), "업 봐": ("look", "up"),
"다운 봐": ("look", "down"), "밑에 봐": ("look", "down"), "아래 봐 줘": ("look", "down"),
"look it up for me": None, "Can you look it up?": None, "Look up the news.": ("search", "Look up the news."),
"look up the weather in Paris": ("weather", "Paris"),
"부산 날씨 알려줘": ("weather", "Busan"),
"제주도 날씨는?": ("weather", "Jeju City"),
@@ -124,6 +130,13 @@ assert brain.head_goal("right 200", 0, 0) == (-180.0, 0, "yaw")
assert brain.head_goal("up 50", 0, 0) == (0, 35.0, "pitch")
assert brain.head_goal("left small", 10, 0) == (25.0, 0, None)
assert brain.head_goal("down", 20, 10) == (20, -5, None)
assert brain.head_goal("left", 40, 0) == (55.0, 0, None) and brain.head_goal("right", -40, 0) == (-55.0, 0, None) # "look left"
assert brain.head_goal("up", 0, 20) == (0, 30.0, None) and brain.head_goal("left", -40, 0) == (40, 0, None) # again: further
for said, want in {"Look at the left side.": "left", "Look at the right side.": "right", "Lumi, look at the left side.": "left",
"look on your left": "left", "Look at the front.": "center", "look left more": "left small",
"look more to the right": "right small", "왼쪽 좀 봐 줘": "left", "오른쪽 봐": "right", "왼쪽 봐": "left",
"왼쪽 더 봐": "left small", "오른쪽 조금 더 봐 줘": "right small"}.items(): # live 2026-10-23: went to the LLM
assert brain.intent(said, ["p1", "p2", "home"]) == ("look", want), (said, brain.intent(said))
assert brain.lift_goal("up 50", 80) == (105.0, True)
assert brain.lift_goal("down small", 50) == (20.0, False)
assert brain.lift_goal("up", 0) == (105.0, False)
+60
View File
@@ -0,0 +1,60 @@
"""The live sequence of 2026-10-23 15:21-15:23, replayed with fakes: "give me a hand" / handshake words with an empty
hand are arm reach (the rules, not the LLM's "I can't shake hands"), and a reach whose body move hangs ends at once on
STOP, so the next "give me your hand" starts instead of "I'm busy with another task". No robot.
.venv/bin/python tests/test_reach_live.py
"""
import tempfile
import threading
import time
from pathlib import Path
from assistant import brain
from tasks import fetch
MARKERS = ["home", "p1"]
REACH = ["Let's give me a hand.", "Let's give me your hand.", "Give me your hand.", "give me a hand", "손 줘",
"손 내밀어", "루미야 손 줘", "Lumi, 손 줘", "hand 줘", "손 좀 줘", "shake hands with me", "let's shake hands",
"shake my hand", "give me a handshake", "악수하자", "악수해 줘", "나랑 악수할래?"]
NOT_REACH = ["give me a hand with this", "can you lend me a hand?", "give me a hand to lift this", "I shook hands with him",
"don't shake hands", "악수하지 마", "어제 악수했어", "the handshake was nice", "give me a break"]
bad = [(t, brain.intent(t, MARKERS)) for t in REACH if brain.intent(t, MARKERS) != ("arm", "reach")]
bad += [(t, brain.intent(t, MARKERS)) for t in NOT_REACH if brain.intent(t, MARKERS) == ("arm", "reach")]
bad += [(t, "held rule") for t in REACH if brain.hand_request(t, False, None, MARKERS)] # empty hand: never a give
assert not bad, bad
# ---------- the stuck reach: the body API does not answer a head move ----------
tmp = Path(tempfile.mkdtemp())
fetch.STATE_FILE = tmp / "lumi_task.json"
hung = threading.Event() # never set: the body API's moveto hangs
fetch.head.moveto = lambda pos, **kw: hung.wait(30)
fetch.head.status = lambda: [0.0, 0.0, -22.0, 0.0]
fetch.camview.want = lambda name: None
fetch.skills.cancel = fetch.agv.cancel = lambda: None
fetch.motion.poses = lambda: {"give": [0] * 6, "look": [0] * 6}
fetch.head_ahead = lambda: None
moved = []
fetch._turn = lambda deg, **kw: (fetch._head_to(-30.0, 0.0), True)[1] # the turn's head check (head_hits) hangs
fetch._pose = lambda name: moved.append(name)
fetch._person_point = lambda: ((0.0, 600.0, 0.0), 100.0)
fetch._reach_to_hand = lambda *a: moved.append("hand")
fetch.reach(-22.7)
time.sleep(0.3)
assert fetch._busy() and fetch.state()["status"] == "running"
try:
fetch.reach(-22.0) # said again while it really runs: busy is right
raise AssertionError("a second reach started")
except fetch.FetchError as e:
assert "busy" in e.args[0]
t = time.time()
fetch.end() # "stop" / a new command
assert time.time() - t < 1.0 and not fetch._busy(), "stop waited for the hung body call"
assert fetch.state()["status"] == "stopped" and moved == []
hung.set() # the body answers again
fetch.reach(0.0) # the next "give me your hand": starts, not "busy"
fetch._thread.join(2)
assert moved == ["give", "hand"] and fetch.state()["status"] == "done", (moved, fetch.state()["status"])
print(f"reach live ok ({len(REACH) + len(NOT_REACH)} wordings, stop during a hung body move)")
+179
View File
@@ -0,0 +1,179 @@
"""Self-check of stop words heard while Lumi moves, replaying the owner's live test of 2026-10-23 15:02-15:21
(logs/lumi_console.log): "Stop." on a drive to a marker went on ("heard 'Stop.' (no wake word)"), "Stop, 루미."
only paused the drive and turned the base toward the voice, a one-word "Stop." / "멈춰." while Lumi talked was not a
stop. Fake mic, speech-to-text and base; nothing reaches the robot: python tests/test_stop_live.py"""
import threading
import time
from assistant import lumi
from tasks import fetch, follow
M = ["home", "dock2"] + [f"p{i}" for i in range(1, 11)]
done = []
base = {"move_status": "idle"}
# the robot: every call that could move or stop something is recorded, never sent
lumi.agv.cancel = lambda: done.append("agv cancel")
lumi.agv.status = lambda: dict(base)
lumi.agv.turn_by = lambda a: done.append("TURN") # find_caller's turn toward the voice
lumi.agv.go_point = lambda *a: done.append("GO") or (True, "")
lumi.skills.cancel = lambda: done.append("skills cancel")
lumi.motion.stop = lambda: done.append("arm stop")
follow.stop = lambda: done.append("follow stop")
fetch.stop = lambda: done.append("fetch stop")
fetch.state = lambda: {"status": "idle"}
lumi.mouth.say = lambda text, **k: done.append(("say", text))
lumi.mouth.own_voice = lambda u: False
lumi.mouth.recent_speech = lambda s: ""
lumi.doa.load_calib = lambda: {"fitted": False}
lumi.doa.estimate = lambda mics, cal: (0.0, 0.0, 0.0)
lumi.ears.heard_lang = lambda lang: lang
class U: # one utterance from audio/mic.py
def __init__(self, text, seconds=0.8, during_speech=False):
self.mono, self.mics, self.seconds, self.during_speech, self.source = text, None, seconds, during_speech, "clip"
lumi.ears.transcribe = lambda mono: mono # the fake utterance carries what whisper heard
class Mic:
def __init__(self, *utts):
self.q = list(utts)
def next(self, timeout):
return self.q.pop(0) if self.q else None
class Brain:
def reset(self):
pass
def fresh(*utts, trip=True):
L = lumi.Lumi.__new__(lumi.Lumi)
L.markers, L.lang, L.current, L.vision, L.pending_text = M, "en", None, None, None
L.mic, L.brain, L.chain_stop = Mic(*utts), Brain(), threading.Event()
L.patrol = lumi.Patrol(["p5"], once=True) if trip else None
if trip:
L.patrol.moving = True
L.voice_until = L.quiet_until = 0.0
L.last_activity, L.closing_pending, L._yaw, L._yaw_time = time.time(), None, 0.0, time.time()
L.fetch_say = lambda en, ko: done.append(("say", en))
L.answer = lambda text: done.append(("answer", text))
done.clear()
base["move_status"] = "running" if trip else "idle"
return L
def stopped(L):
return "agv cancel" in done and "arm stop" in done and L.patrol is None and ("say", "Okay, I stopped.") in done
# 15:10:13 "Let's go P5." -> patrol -> p5; then "Stop looming." / "Stop." / "Stop it." (no wake word): drove on
for heard in ("Stop looming.", "Stop.", "Stop it.", "멈춰.", "스톱!", "그만.", "Stop, stop."):
L = fresh(U(heard))
assert L.check_wake() and stopped(L), (heard, done)
# 15:21:23 "Stop, 루미." on a drive: only "drive paused", then a base turn toward the voice and "drive on" later
L = fresh(U("Stop, 루미."))
assert L.check_wake() and stopped(L) and "TURN" not in done and "GO" not in done, done
# said while Lumi talks on the trip (clip mic, during_speech): a stop word still stops; other words are left alone
L = fresh(U("Stop.", during_speech=True))
assert L.check_wake() and stopped(L), done
L = fresh(U("Lumi, go home.", during_speech=True))
assert not L.check_wake() and "agv cancel" not in done, done
# a drive the dashboard or the base started (no trip of the assistant's own) is stopped too
L = fresh(U("Stop."), trip=False)
base["move_status"] = "running"
assert L.check_wake() and "agv cancel" in done, done
# nothing moves: "stop it" between visitors is not answered; "Hi Lumi" on a drive still pauses and talks
L = fresh(U("Stop it."), trip=False)
assert not L.check_wake() and not done, done
L = fresh(U("Hi Lumi."))
assert L.check_wake() and "agv cancel" in done and L.patrol is not None and ("say", "Okay, I stopped.") not in done, done
L = fresh(U("It stopped."))
assert not L.check_wake() and "agv cancel" not in done, done
# one-word stop while Lumi talks (barge-in): "Stop." was a closing word (talk ended, the drive went on), "멈춰." ignored
lumi.ears.understood = lambda *a: True
for heard in ("Stop.", "멈춰.", "스탑", "Stop it."):
L = fresh(U(heard, during_speech=True))
assert L.barge_in() and "agv cancel" in done and "arm stop" in done and L.pending_text == heard, (heard, done)
assert lumi.route(heard, M, L.brain)[0] == "stop", heard # answered next: stop_all
L = fresh(U("I see.", during_speech=True))
lumi.brain_mod.is_backchannel = lambda t: True
L.barge_in()
assert "agv cancel" not in done, done
# "come here": the main loop waits on the drive; "stop" from anyone ends it, other words are answered after it
class Track:
id, distance, angle = 5, 3.0, 0.0
class Vision:
present = lambda self, t: True
lumi.agv.pose = lambda: (0.0, 0.0, 0.0)
lumi.head.status = lambda: [0, 0, 0, 0]
lumi.nav.person_on_map = lambda *a: (3.0, 0.0)
lumi.nav.approach = lambda *a: (2.0, 0.0, 0.0)
L = fresh(U("Stop!"), trip=False)
L.vision, L.modes, L.turn_head = Vision(), type("Modes", (), {"drive": True})(), lambda *a: None
base["move_status"] = "running"
t = time.time()
L.come_to(Track())
assert stopped(L) and time.time() - t < 3, done
L = fresh(U("What is your name?"), trip=False)
L.vision, L.modes, L.turn_head = Vision(), type("Modes", (), {"drive": True})(), lambda *a: None
base["move_status"] = "running"
threading.Timer(1.0, lambda: base.update(move_status="succeeded")).start()
L.come_to(Track())
assert "agv cancel" not in done and L.pending_text == "What is your name?", done
# right after Lumi said "Okay, I stopped.", "Stop." is no echo of it (own_echo counts "stop" in "stopped")
lumi.mouth.recent_speech = lambda s: "Okay, I stopped. Let's go to p5."
L = fresh(U("Stop."), trip=False)
L.vision, L.modes, L.turn_head = Vision(), type("Modes", (), {"drive": True})(), lambda *a: None
base["move_status"] = "running"
L.come_to(Track())
assert stopped(L), done
head_u = U("Stop.")
head_u.source = "head"
lumi.ears.listen = lambda **k: ("Stop.", head_u)
L = fresh(trip=False)
L.warm_llm, L.interrupted, L.who_spoke, L.mission_hold = lambda: None, lambda: False, lambda u: None, None
L.follow_filter = lambda text, u: False
assert L.talk_turn() and ("answer", "Stop.") in done, done
# a stop word passes every echo filter: mouth.own_voice, own_echo, the ECHO_LIKELY gate (barge-in, talk_turn, check_wake)
lumi.mouth.own_voice = lambda u: True
lumi.mouth.last_echo = 0.9
for heard in ("Stop.", "멈춰.", "Stop it."):
L = fresh(U(heard, during_speech=True))
assert L.barge_in() and "agv cancel" in done and L.pending_text == heard, (heard, done)
L = fresh(U(heard, during_speech=True))
assert L.check_wake() and stopped(L), (heard, done)
L = fresh(trip=False)
L.warm_llm, L.interrupted, L.who_spoke, L.mission_hold = lambda: None, lambda: False, lambda u: None, None
L.follow_filter = lambda text, u: False
assert L.talk_turn() and ("answer", "Stop.") in done, done
L = fresh(U("Okay, I'm going to p5.", during_speech=True)) # Lumi's own sentence: still ignored
assert not L.barge_in() and "agv cancel" not in done, done
lumi.mouth.own_voice, lumi.mouth.last_echo = (lambda u: False), 0.0
lumi.mouth.recent_speech = lambda s: ""
# whisper's slips of the stop words, and talk about stopping that orders nothing
for t in ("스탑.", "Stob.", "Stopp!", "Lumi stopped.", "멈추세요.", "Stop looming.", "Stop, 루미."):
assert lumi.stop_order(t, M), t
for t in ("It stopped.", "The bus stop is there.", "Don't stop.", "계속 가.", "Why did you stopped?", "My laptop freezes."):
assert not lumi.stop_order(t, M), t
assert follow.stop_word("스탑")
print("ok")