Turn to the caller while answering and turn the waist faster

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 18:22:45 +09:00
co-authored by Claude Opus 5.5
parent 060088650b
commit b4ab7c71b1
7 changed files with 20 additions and 10 deletions
+12 -5
View File
@@ -131,7 +131,9 @@ WAKE = re.compile(rf"\b(hi|hey|hello|okay|ok|hai|high|{WAKE_UP_EN})?[\s,.!]*(lum
rf"|^\W*(?:(?:hey|ok|okay|come on)\W+)?(?:{WAKE_UP_EN})\W*$|^\W*(?:(?:자|이제|얼른)\s+)?(?:{WAKE_UP_KO})[\s.!~]*$", re.I) rf"|^\W*(?:(?:hey|ok|okay|come on)\W+)?(?:{WAKE_UP_EN})\W*$|^\W*(?:(?:자|이제|얼른)\s+)?(?:{WAKE_UP_KO})[\s.!~]*$", re.I)
# ^ "Hey Lumi", "Lumi", "wake up (Lumi)", "Lumi, wake up", "루미야", "헤이 루미", "루미야 일어나", "일어나세요"; # ^ "Hey Lumi", "Lumi", "wake up (Lumi)", "Lumi, wake up", "루미야", "헤이 루미", "루미야 일어나", "일어나세요";
# a bare "wake up" / "일어나" only as the whole utterance ("I wake up at 7" is no call) # a bare "wake up" / "일어나" only as the whole utterance ("I wake up at 7" is no call)
WAKE_REPLY = {"en": "Yes? How can I help?", "ko": "네? 무엇을 도와드릴까요?"} WAKE_REPLY = {"en": ["Yes? How can I help?", "I'm here. How can I help?", "Yes, I'm listening.", "Hi! What can I do for you?"],
"ko": ["네? 무엇을 도와드릴까요?", "네, 말씀하세요.", "네, 듣고 있어요.", "안녕하세요! 무엇을 도와드릴까요?"]} # one at random
NAME_REPLY = {"en": ["Yes?", "I'm listening.", "Yes, I'm here."], "ko": ["네?", "네, 말씀하세요.", "네, 듣고 있어요."]} # "Lumi?" in a talk
NAME_ONLY = re.compile(r"^\s*(?:(?:hi|hey|hello|헤이|하이)[\s,]+)?(?:lumi|loomi|rumi|루미|누미)(?:야|아)?[\s,.!?~]*$", re.I) NAME_ONLY = re.compile(r"^\s*(?:(?:hi|hey|hello|헤이|하이)[\s,]+)?(?:lumi|loomi|rumi|루미|누미)(?:야|아)?[\s,.!?~]*$", re.I)
# ^ only the name, also "루미야" / "헤이 루미" (went to the LLM: "안녕하세요! 제 이름 불러 주셔서 기뻐요." after 2.3 s) # ^ only the name, also "루미야" / "헤이 루미" (went to the LLM: "안녕하세요! 제 이름 불러 주셔서 기뻐요." after 2.3 s)
FETCH_STOP = re.compile(r"\b(sto+pp?|stob|halt|freeze|don'?t move)\b|^\W*(?:lumi\W+)?stopped\W*$|스탑|스텁|멈추(?:세요|십시오)|^\W*abort\W*$|\babort (?:the |this |your )?(?:mission|task|trip)\b|\bcancel (?:the |this |your )?(?:mission|task|trip)\b|" FETCH_STOP = re.compile(r"\b(sto+pp?|stob|halt|freeze|don'?t move)\b|^\W*(?:lumi\W+)?stopped\W*$|스탑|스텁|멈추(?:세요|십시오)|^\W*abort\W*$|\babort (?:the |this |your )?(?:mission|task|trip)\b|\bcancel (?:the |this |your )?(?:mission|task|trip)\b|"
@@ -3093,8 +3095,11 @@ class Lumi:
return return
if self.resume_stopped(text): # "Lumi, keep going" after a stop word ended a mission if self.resume_stopped(text): # "Lumi, keep going" after a stop word ended a mission
return return
if NAME_ONLY.match(text): # just "Lumi?": they want attention if NAME_ONLY.match(text): # just "Lumi?": they want attention, the head turns to them
mouth.say("Yes?" if self.lang == "en" else "네?") look = threading.Thread(target=self.look_at_speaker, daemon=True) # while it answers
look.start()
mouth.say(random.choice(NAME_REPLY["en" if self.lang == "en" else "ko"]))
look.join()
self.keep_listening() self.keep_listening()
return return
from tasks import fetch # the way it goes: route(), as the dashboard's Command box from tasks import fetch # the way it goes: route(), as the dashboard's Command box
@@ -3334,9 +3339,11 @@ class Lumi:
self.brain.reset() self.brain.reset()
self.closing_pending = None self.closing_pending = None
command = rest if len(rest) > 2 else text if re.search(r"how are you", text, re.I) else "" # answered command = rest if len(rest) > 2 else text if re.search(r"how are you", text, re.I) else "" # answered
self.look_at_speaker() # as "look at me": the cameras, the voice's side, behind look = threading.Thread(target=self.look_at_speaker, daemon=True) # as "look at me": the cameras, the
look.start() # voice's side, behind; turns while it answers
if not command: # just "Hi Lumi": a short answer, then listen if not command: # just "Hi Lumi": a short answer, then listen
mouth.say(WAKE_REPLY[lang]) mouth.say(random.choice(WAKE_REPLY[lang]))
look.join()
self.voice_until = time.time() + VOICE_SESSION_S self.voice_until = time.time() + VOICE_SESSION_S
self.last_activity, self.prompts = time.time(), 0 self.last_activity, self.prompts = time.time(), 0
if command: # "Hi Lumi, go home": do it at once, no greeting if command: # "Hi Lumi, go home": do it at once, no greeting
+3 -1
View File
@@ -42,7 +42,9 @@ CACHED = ["Hi, I'm Lumi, the assistant robot. How can I help you?", "안녕하
"Sorry, I can't get closer from here.", "How can I help you?", "무엇을 도와드릴까요?", "Sorry, I can't get closer from here.", "How can I help you?", "무엇을 도와드릴까요?",
"Let me check.", "확인해 볼게요.", "Okay, I'll be quiet.", "네, 조용히 할게요.", "Let me check.", "확인해 볼게요.", "Okay, I'll be quiet.", "네, 조용히 할게요.",
"Sorry, I'm not connected to the internet right now, so I can't look that up.", "Sorry, I'm not connected to the internet right now, so I can't look that up.",
"Yes? How can I help?", "네? 무엇을 도와드릴까요?", "Yes? How can I help?", "네? 무엇을 도와드릴까요?", "I'm here. How can I help?", "Yes, I'm listening.",
"Hi! What can I do for you?", "네, 말씀하세요.", "네, 듣고 있어요.", "안녕하세요! 무엇을 도와드릴까요?",
"I'm listening.", "Yes, I'm here.",
"Welcome back! How can I help you?", "다시 오셨네요, 무엇을 도와드릴까요?", "Okay, I'm going to my charging dock.", "네, 충전소로 갈게요."] + [f"Okay, I'm going to p{i}." for i in range(1, 11)] "Welcome back! How can I help you?", "다시 오셨네요, 무엇을 도와드릴까요?", "Okay, I'm going to my charging dock.", "네, 충전소로 갈게요."] + [f"Okay, I'm going to p{i}." for i in range(1, 11)]
_tts = None _tts = None
+1
View File
@@ -76,6 +76,7 @@ Every value here is a constant at the top of its file, with a comment on what it
| File | Name | Default | What it does | | File | Name | Default | What it does |
|---|---|---|---| |---|---|---|---|
| `tasks/fetch.py` | `VIEW_STEPS` | 60°, 120°, 180° | Search: after ahead, both cameras look this far to the busier side step by step, then to the other side | | `tasks/fetch.py` | `VIEW_STEPS` | 60°, 120°, 180° | Search: after ahead, both cameras look this far to the busier side step by step, then to the other side |
| `tasks/fetch.py` | `WAIST_VEL` | 30 % | Speed of the waist's turns (search, reach, "look at me", turning to a caller); the arm sweeps sideways with it, so it stays low |
| `tasks/fetch.py` | `WAIST_SCAN_MAX` | 120° | The waist turns up to this in the search (body limit ±140° absolute), the head turns the rest | | `tasks/fetch.py` | `WAIST_SCAN_MAX` | 120° | The waist turns up to this in the search (body limit ±140° absolute), the head turns the rest |
| `tasks/fetch.py` | `SEARCH_BASE_DEG` | 180°, 90° | Then the base turns towards the busier side, the first of these whose sweep is clear, and all again | | `tasks/fetch.py` | `SEARCH_BASE_DEG` | 180°, 90° | Then the base turns towards the busier side, the first of these whose sweep is clear, and all again |
| `tasks/fetch.py` | `LIFT_TRIES` | 0, 105 mm (`LIFT_RANGE`) | Nothing found: all of it again at the other end | | `tasks/fetch.py` | `LIFT_TRIES` | 0, 105 mm (`LIFT_RANGE`) | Nothing found: all of it again at the other end |
+1 -1
View File
@@ -150,7 +150,7 @@ HEAD_SIDE_DEG = 60.0 # head yaw (+ left) towards the side of a turn, to
HEAD_LOW_PITCH = -5.0 # head pitch for those checks and the search: its lowest, where the camera is calibrated HEAD_LOW_PITCH = -5.0 # head pitch for those checks and the search: its lowest, where the camera is calibrated
HEAD_READS = 4 # head camera frames read per view (10 a second) ... HEAD_READS = 4 # head camera frames read per view (10 a second) ...
HEAD_SAME_MM = 120.0 # ... an object counts when seen at least twice within this distance HEAD_SAME_MM = 120.0 # ... an object counts when seen at least twice within this distance
WAIST_VEL = 20 # % of the waist's speed: the arm sweeps sideways WAIST_VEL = 30 # % of the waist's speed: the arm sweeps sideways
WAIST_STEP_DEG = 10.0 # deg; a waist turn made together with an arm move goes in moves this long: the body API WAIST_STEP_DEG = 10.0 # deg; a waist turn made together with an arm move goes in moves this long: the body API
# cannot stop a moveto, so a STOP ends the turn after the move it is in (_give_turning) # cannot stop a moveto, so a STOP ends the turn after the move it is in (_give_turning)
HEAD_AHEAD = (0.0, head.HEAD_REST_PITCH) # head (yaw, pitch) deg before a drive to a place and after every task: ahead, at rest HEAD_AHEAD = (0.0, head.HEAD_REST_PITCH) # head (yaw, pitch) deg before a drive to a place and after every task: ahead, at rest
+1 -1
View File
@@ -68,7 +68,7 @@ WAIST_STEP_DEG = 8.0 # deg; one body move turns the waist at most this fa
WAIST_FOLLOW_VEL = 50 # speed ratio % of a move that turns the waist (the head in it too). The waist's deg/s at WAIST_FOLLOW_VEL = 50 # speed ratio % of a move that turns the waist (the head in it too). The waist's deg/s at
# this ratio is not measured; estimate ~40 deg/s as the head's (audio/sing.py), about the # this ratio is not measured; estimate ~40 deg/s as the head's (audio/sing.py), about the
# base's own TURN_MAX_RS turn that sweeps the arm the same way. Lower it if the arm swings # base's own TURN_MAX_RS turn that sweeps the arm the same way. Lower it if the arm swings
# too hard (fetch.WAIST_VEL 20 is the search's long turns) # too hard (fetch.WAIST_VEL 30 is the search's long turns)
WAIST_DRIVE_DEG = 15.0 # deg; the base drives forward only with the waist this near the front: navigation does not WAIST_DRIVE_DEG = 15.0 # deg; the base drives forward only with the waist this near the front: navigation does not
# know the arm, blocked() checks it turned (estimate) # know the arm, blocked() checks it turned (estimate)
WAIST_RETRY_S = 1.0 # s; a waist turn found blocked is not tried again for this long (each try probes the map) WAIST_RETRY_S = 1.0 # s; a waist turn found blocked is not tried again for this long (each try probes the map)
+1 -1
View File
@@ -619,7 +619,7 @@ def score_silence(c, old, use_llm):
outcome, said = "silent", "" outcome, said = "silent", ""
else: else:
rest = text[m.end():].strip(" ,.!?") rest = text[m.end():].strip(" ,.!?")
outcome, said, text = ("greet", lumi.WAKE_REPLY["en"], "") if len(rest) <= 2 else ("talk", "", rest) outcome, said, text = ("greet", lumi.WAKE_REPLY["en"][0], "") if len(rest) <= 2 else ("talk", "", rest)
else: else:
outcome, said = "talk", "" outcome, said = "talk", ""
with mock.patch.object(lumi.mouth, "recent_speech", lambda s=30.0: x["lumi_said"] or ""): with mock.patch.object(lumi.mouth, "recent_speech", lambda s=30.0: x["lumi_said"] or ""):
+1 -1
View File
@@ -141,7 +141,7 @@ assert not lumi.WAKE.search("I wake up at 7 every day") and not lumi.WAKE.search
L = fresh() # "How are you?" is answered, not "Yes? How can I help?" L = fresh() # "How are you?" is answered, not "Yes? How can I help?"
L.mic = Mic(U("How are you?")) L.mic = Mic(U("How are you?"))
L.check_wake() L.check_wake()
assert ("answer", "How are you?") in done and lumi.WAKE_REPLY["en"] not in said(), done assert ("answer", "How are you?") in done and not set(lumi.WAKE_REPLY["en"]) & set(said()), done
L = fresh() # "Hi Lumi, go home": done at once L = fresh() # "Hi Lumi, go home": done at once
L.mic = Mic(U("Hi Lumi, go home.")) L.mic = Mic(U("Hi Lumi, go home."))
L.check_wake() L.check_wake()