Commands: full turn as two checked half turns, 'let's go p5' rule, dashboard Command box applies corrections, put it back, pairs of non-task commands asked

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 10:16:29 +09:00
co-authored by Claude Opus 5.5
parent d8b11176fe
commit 8a81979bad
14 changed files with 151 additions and 37 deletions
+5
View File
@@ -978,6 +978,11 @@ def task_parse(body: ParseBody):
from tasks import fetch from tasks import fetch
markers = agv.markers() markers = agv.markers()
got = unread = by = None got = unread = by = None
fixed = brain.self_correct(body.text, markers) if body.text.strip() else body.text # "go to start, no, end": as
if not fixed and body.text.strip(): # by voice (lumi.answer)
return {"action": None, "task": None, "sentence": "–", "read_by": "rules", "problems": [
"Which one did you mean? Please write it again." if fixed is None else "Taken back: nothing to do."]}
body = body.model_copy(update={"text": fixed})
if body.text.strip(): # a mission (docs/17): several steps the fetch / carry can't do if body.text.strip(): # a mission (docs/17): several steps the fetch / carry can't do
got, unread, by = steps.read(body.text, markers, llm=False) got, unread, by = steps.read(body.text, markers, llm=False)
if unread and got and ({s["do"] for s in got} & steps.MISSION_ONLY or steps.is_mission(got)): if unread and got and ({s["do"] for s in got} & steps.MISSION_ONLY or steps.is_mission(got)):
+34 -13
View File
@@ -261,7 +261,7 @@ You can also move. Decide if the visitor asks you to do something:
"go back a little" -> move back 0.5, "move left two metres" -> move left 2, "let's back 1 meter" / "back up one "go back a little" -> move back 0.5, "move left two metres" -> move left 2, "let's back 1 meter" / "back up one
metre" / "1미터 뒤로 가" / whisper's "let's bake one meter" -> move back 1: straight back, no turning). At most 3 metres. metre" / "1미터 뒤로 가" / whisper's "let's bake one meter" -> move back 1: straight back, no turning). At most 3 metres.
- turn <left|right|around> <degrees>: turn the whole body ("turn around" -> turn around 180, - turn <left|right|around> <degrees>: turn the whole body ("turn around" -> turn around 180,
"turn left" -> turn left 90). "turn left" -> turn left 90, "spin around" / "한 바퀴 돌아" -> turn left 360).
- arm <reach|fold|open|close>: stretch your arm forward ("reach out your hand"), fold it back, or open / close - arm <reach|fold|open|close>: stretch your arm forward ("reach out your hand"), fold it back, or open / close
your hand (the gripper: "open your hand", "grab it", "let go"). your hand (the gripper: "open your hand", "grab it", "let go").
- wave: wave your hand ("wave", "shake your hand", "say hi with your hand"). "Hello Lumi!" said to you or "say - wave: wave your hand ("wave", "shake your hand", "say hi with your hand"). "Hello Lumi!" said to you or "say
@@ -505,15 +505,19 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
r"주라|주시면 감사하겠습니다|줬으면 좋겠어요?|주면 좋겠어요?)|요|자|야 ?해요?|면 안 ?돼요?)?\s*[.!?]*$" r"주라|주시면 감사하겠습니다|줬으면 좋겠어요?|주면 좋겠어요?)|요|자|야 ?해요?|면 안 ?돼요?)?\s*[.!?]*$"
r"|^\W*(?:(?:루미야?|lumi|hey lumi)\W*)?(?:point\s+)?([a-z][a-z0-9_]*)\s*(?:으로|로)\s*(?:좀\s*)?" r"|^\W*(?:(?:루미야?|lumi|hey lumi)\W*)?(?:point\s+)?([a-z][a-z0-9_]*)\s*(?:으로|로)\s*(?:좀\s*)?"
r"(?:가십시오|가시겠어요|가시죠|가실래요)\s*[.!?]*$" r"(?:가십시오|가시겠어요|가시죠|가실래요)\s*[.!?]*$"
r"|^\W*(?:(?:hey|hi|okay|ok|so|um+|uh+|alright|please|well|now|lumi)\W+)*(?:go|drive|head)\s+([a-z][a-z0-9_]*)" r"|^\W*(?:(?:hey|hi|okay|ok|so|um+|uh+|alright|please|well|now|lumi|let'?s|lets)\W+)*(?:go|drive|head)\s+"
r"\W*(?:(?:please|now|for me|thanks)\W*)*$"), # whisper drops the "to": "go stage" r"([a-z][a-z0-9_]*)(?:\W+point)?\W*(?:(?:please|now|for me|thanks)\W*)*$"), # whisper drops the "to": "go
# stage"; the owner: "let's go p5 (point)"
("sing", r"\bsing\b|\ba song\b|노래"), ("sing", r"\bsing\b|\ba song\b|노래"),
("look", HEAD_WORDS), # head_target() reads the direction and amount ("look", HEAD_WORDS), # head_target() reads the direction and amount
("wave", r"(?:^|[,.!?]\s*)(?:(?:hey|hi|okay|ok|so|um+|uh+|alright|please|now|lumi|and|then)\W+)*(?:(?:can|could|would|will) you " ("wave", r"(?:^|[,.!?]\s*)(?:(?:hey|hi|okay|ok|so|um+|uh+|alright|please|now|lumi|and|then)\W+)*(?:(?:can|could|would|will) you "
r"(?:please )?|please |let'?s |go ahead and |i'?d like you to |i want you to )?wave\b(?!s)|" r"(?:please )?|please |let'?s |go ahead and |i'?d like you to |i want you to )?wave\b(?!s)|"
r"\bwave (?:at|to|your|hello|hi|bye|goodbye|back|again|for)\b|\bgimme a wave\b|\b(?:why don'?t you|if you (?:could|can|would)|" r"\bwave (?:at|to|your|hello|hi|bye|goodbye|back|again|for)\b|\bgimme a wave\b|\b(?:why don'?t you|if you (?:could|can|would)|"
r"you (?:could|should|can|might)|could you|would you|can you|will you) (?:please |just )?wave\b(?!s)|\bgive (?:(?:them|him|her|us|me|everyone|the \w+) )?" r"you (?:could|should|can|might)|could you|would you|can you|will you) (?:please |just )?wave\b(?!s)|\bgive (?:(?:them|him|her|us|me|everyone|the \w+) )?"
r"a (?:little |quick |big |friendly )?wave\b|\bwave\s?(?:해|좀)|\bshake (?:your |a |my )?hands?\b(?! with\b)|\bsay (?:hi|hello|bye) with your hand\b|손 ?(?:을 |좀 |도 )?흔들|손 ?인사"), r"a (?:little |quick |big |friendly )?wave\b|\b(?:wave|웨이브)\s?(?:해|하고|좀)|\bshake (?:your |a |my )?hands?\b(?! with\b)|\bsay (?:hi|hello|bye) with your hand\b|손 ?(?:을 |좀 |도 )?흔들|손 ?인사"),
("spin", r"\bspin (?:yourself )?(?:all the way |completely |fully )?(?:a)?round\b(?! (?:the|a|an|my|your|and look)\b)"
r"|\bturn (?:yourself )?(?:all the way|completely|fully) (?:a)?round\b|\bdo a (?:full )?(?:360|full turn|full circle|spin)\b|\bturn 360\b|\bspin\s*[.!]*$"
r"|한 ?바퀴 ?(?:빙 ?)?(?:돌|회전)(?![았었던은]|고 ?(?:와|오))|360\s*도\s*(?:돌|회전)(?![았었던은])|빙글 ?빙글 ?돌(?![았었던은])"),
("turn", r"\bturn (a)?round\b|(?:왼쪽|오른쪽)으로 ?(?:\d+(?:\.\d+)? ?도 ?)?도(?:세요|십시오)|\bturn (?:to (?:the |your )?)?(left|right)\b|뒤로 ?돌|돌아 ?봐|" ("turn", r"\bturn (a)?round\b|(?:왼쪽|오른쪽)으로 ?(?:\d+(?:\.\d+)? ?도 ?)?도(?:세요|십시오)|\bturn (?:to (?:the |your )?)?(left|right)\b|뒤로 ?돌|돌아 ?봐|"
r"(?:왼쪽|오른쪽)으로 ?(?:\d+(?:\.\d+)? ?도 ?)?돌"), r"(?:왼쪽|오른쪽)으로 ?(?:\d+(?:\.\d+)? ?도 ?)?돌"),
("make_way", r"\b(can|could|would) you (please )?move( a bit| a little| please)?\s*[?.!]*$|\bmove (aside|out of the way|over)\b|" ("make_way", r"\b(can|could|would) you (please )?move( a bit| a little| please)?\s*[?.!]*$|\bmove (aside|out of the way|over)\b|"
@@ -554,7 +558,7 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
LATER = re.compile(r"^\s*(?:after|once|if|as soon as|before|unless|until)\b(?! (?:that|this|you (?:can|could|don'?t mind|would|" LATER = re.compile(r"^\s*(?:after|once|if|as soon as|before|unless|until)\b(?! (?:that|this|you (?:can|could|don'?t mind|would|"
r"please))\b)|\b(?:later|tomorrow|tonight|next time|in an hour)\b|[가-힣](?<![정화측반전표라장내외평단])면\s(?!안 ?돼)|\byou'?ll (?:find|see)\b|\bat the corner\b|" r"please))\b)|\b(?:later|tomorrow|tonight|next time|in an hour)\b|[가-힣](?<![정화측반전표라장내외평단])면\s(?!안 ?돼|좋겠)|\byou'?ll (?:find|see)\b|\bat the corner\b|"
r"\b(?:he|she|they|my \w+|his \w+|her \w+|our \w+|someone) (?:will|'ll|is going to|are going to)\b|" r"\b(?:he|she|they|my \w+|his \w+|her \w+|our \w+|someone) (?:will|'ll|is going to|are going to)\b|"
r"(?:^|\s)(?:나중에|이따가?|내일)\s", re.I) # "after the talk ends, go to p1", "내가 가라고 하면": not now r"(?:^|\s)(?:나중에|이따가?|내일)\s", re.I) # "after the talk ends, go to p1", "내가 가라고 하면": not now
STOP_ASK = re.compile(r"(?:(?:can|could|would|will) you (?:please |just )?stop(?: (?:now|please|moving|driving|here|there))?|" STOP_ASK = re.compile(r"(?:(?:can|could|would|will) you (?:please |just )?stop(?: (?:now|please|moving|driving|here|there))?|"
@@ -619,10 +623,10 @@ def intent(text, markers=()):
return None if asks or "?" in t else ("look", "away") # "don't look at me", "쳐다보지 마" return None if asks or "?" in t else ("look", "away") # "don't look at me", "쳐다보지 마"
if action != "quiet" and re.search(r"(?<!why )\b(don'?t|do not|never)\b|[가-힣]지 ?마(?:세요|요|라)?(?![가-힣])", t) and action != "stop": if action != "quiet" and re.search(r"(?<!why )\b(don'?t|do not|never)\b|[가-힣]지 ?마(?:세요|요|라)?(?![가-힣])", t) and action != "stop":
return None # "don't go to p1", "손 펴지 마": not an order return None # "don't go to p1", "손 펴지 마": not an order
if asks and action in ("go_home", "go_point", "move", "make_way", "turn", "pick", "put", "move_object", "fetch", "come", if asks and action in ("go_home", "go_point", "move", "make_way", "turn", "spin", "pick", "put", "move_object", "fetch", "come",
"arm", "grip_open", "grip_close", "wave", "look", "lift", "follow", "come_back"): "arm", "grip_open", "grip_close", "wave", "look", "lift", "follow", "come_back"):
return None # "how do you pick up a cup?": a question, not an order return None # "how do you pick up a cup?": a question, not an order
if visitor and action in ("go_home", "go_point", "move", "turn", "come", "wave", "look", "lift", "follow", "come_back"): if visitor and action in ("go_home", "go_point", "move", "turn", "spin", "come", "wave", "look", "lift", "follow", "come_back"):
return None # "can I come closer?": the visitor asks for themselves return None # "can I come closer?": the visitor asks for themselves
if action == "quiet" and re.search(r"\b(?:don'?t|do not|never) stop\b|그만하지 ?마", t): if action == "quiet" and re.search(r"\b(?:don'?t|do not|never) stop\b|그만하지 ?마", t):
return None # "don't stop talking" return None # "don't stop talking"
@@ -653,6 +657,8 @@ def intent(text, markers=()):
return ("search", text) return ("search", text)
if action == "fetch": if action == "fetch":
return ("fetch", text) # parse_fetch() reads the details return ("fetch", text) # parse_fetch() reads the details
if action == "spin": # all the way round: two checked half turns (lumi.move_by)
return ("turn", ("right" if re.search(r"\bright\b|오른쪽", t) else "left") + " 360")
if action == "turn": if action == "turn":
if re.search(r"around|뒤로", t) or not re.search(r"left|right|왼쪽|오른쪽", t): # "왼쪽으로 돌아": left if re.search(r"around|뒤로", t) or not re.search(r"left|right|왼쪽|오른쪽", t): # "왼쪽으로 돌아": left
return ("turn", "around 180") return ("turn", "around 180")
@@ -912,11 +918,18 @@ def place_said(name):
return re.sub(r"[_-]+", " ", name) return re.sub(r"[_-]+", " ", name)
def no_place_say(word, markers): def no_place_say(word, markers, text=""):
"""(en, ko): this map has no place called `word`, and the places it has.""" """(en, ko): this map has no place called `word`, and the places it has. Korean words: the place as said in
`text` ("출구로 가" -> 출구), never the model's English for it."""
known = ", ".join(place_said(m) for m in markers) or "none" known = ", ".join(place_said(m) for m in markers) or "none"
said = re.search(r"([가-힣]+?)\s*(?:으로|로|에|까지)\s*(?:좀\s*)?(?:가|와|이동|돌아)", text or "")
ko = said.group(1) if said else None if word == "that" else place_said(word)
if ko is None:
return (f"I don't have a place called that on this map. I know: {known}.",
f"그런 곳은 이 지도에 없어요. 제가 아는 곳은 {known}이에요.")
final = "가" <= ko[-1] <= "힣" and (ord(ko[-1]) - 0xAC00) % 28
return (f"I don't have a place called {place_said(word)} on this map. I know: {known}.", return (f"I don't have a place called {place_said(word)} on this map. I know: {known}.",
f"이 지도에는 {place_said(word)}라는 곳이 없어요. 제가 아는 곳은 {known}이에요.") f"이 지도에는 {ko}{'이라는' if final else '라는'} 곳이 없어요. 제가 아는 곳은 {known}이에요.")
_GO_WORD = re.compile(r"\b(?:go|drive|move|head|come|return|bring it|take it)(?: back)? to (?:the )?(?:point |marker )?" _GO_WORD = re.compile(r"\b(?:go|drive|move|head|come|return|bring it|take it)(?: back)? to (?:the )?(?:point |marker )?"
@@ -1163,6 +1176,9 @@ RECEIVE_KO = re.compile(
r"(?:드릴게|드릴께|줄게|줄께|드리려고|주려고|드릴 ?거|줄 ?거)(?!.*(?:줘|주세요))|" r"(?:드릴게|드릴께|줄게|줄께|드리려고|주려고|드릴 ?거|줄 ?거)(?!.*(?:줘|주세요))|"
rf"(?:{_THIS_KO}(?:\s*(?:{_COL}))?(?:\s*(?:{_OBJ}))?(?:을|를)?|(?:내|제) 손에 (?:있는|든) (?:거|것|(?:\S+\s+)?\S+))\s*(?:좀\s*)?" rf"(?:{_THIS_KO}(?:\s*(?:{_COL}))?(?:\s*(?:{_OBJ}))?(?:을|를)?|(?:내|제) 손에 (?:있는|든) (?:거|것|(?:\S+\s+)?\S+))\s*(?:좀\s*)?"
r"(?:가져가|들고 ?있어|잡아(?!당)|맡아)", re.I) r"(?:가져가|들고 ?있어|잡아(?!당)|맡아)", re.I)
PAID_Q = re.compile(r"(?<![가-힣])(?:월급|연봉|급여|보너스|월세|세금|전화|문자|메일|연락|칭찬|사랑|상|점수|인기|스트레스|대접|교육|"
r"훈련|충전|수리|검사|업데이트)(?:을|를|은|는|도|이|가)?\s*(?:많이 |잘 |자주 |얼마나 )?받|"
r"^\W*(?:너|넌|너는|루미는?|당신은?)\s.*받(?:아|아요|니|나요|냐|았어|으세요)?\s*\?\s*$") # a question about Lumi
GIVE_EN = re.compile( GIVE_EN = re.compile(
rf"\b(?:give|hand|pass|bring)\s+(?:{_IT}|the \w+|that \w+|this \w+)(?:\s+(?:back|over))?(?:\s+(?:to|for)\s+{_WHO})?(?:\s+(?:here|over here|over there|there|back))*{_TAIL}" rf"\b(?:give|hand|pass|bring)\s+(?:{_IT}|the \w+|that \w+|this \w+)(?:\s+(?:back|over))?(?:\s+(?:to|for)\s+{_WHO})?(?:\s+(?:here|over here|over there|there|back))*{_TAIL}"
rf"|\b(?:give|hand|pass)\s+(?:{_WHO})\s+(?:{_IT}|the \w+|that \w+|that|this \w+|what you(?:'re| are) holding)\b" rf"|\b(?:give|hand|pass)\s+(?:{_WHO})\s+(?:{_IT}|the \w+|that \w+|that|this \w+|what you(?:'re| are) holding)\b"
@@ -1206,12 +1222,17 @@ def hand_request(text, holding, b=None, markers=(), whole=True):
return None # a marker named: a trip, the mission reader's return None # a marker named: a trip, the mission reader's
if whole: if whole:
from assistant import steps from assistant import steps
got = [s["do"] for s in steps.rules(text, markers)[0]] got, unread = steps.rules(text, markers)
got = [s["do"] for s in got]
if len(set(got)) > 1 and got != ["pick", "give"]: # not "give me the cup" (picked first when the hand is empty) if len(set(got)) > 1 and got != ["pick", "give"]: # not "give me the cup" (picked first when the hand is empty)
return None # "take the cup, move back half a metre and hold it" return None # "take the cup, move back half a metre and hold it"
if got and any(intent(u, markers) for u in unread):
return None # "put it down and wave": the mission reader asks, never half done
named = re.search(rf"(?<![a-z])(?:{_OBJ})s?(?![a-z])", t) named = re.search(rf"(?<![a-z])(?:{_OBJ})s?(?![a-z])", t)
if holding and OPEN_HAND.search(t): if holding and OPEN_HAND.search(t):
return ("refuse", REFUSE_OPEN) return ("refuse", REFUSE_OPEN)
if RECEIVE_KO.search(t) and not RECEIVE_EN.search(t) and PAID_Q.search(t):
return None # "너 월급 받아?": about Lumi, nothing handed over
if RECEIVE_EN.search(t) or RECEIVE_KO.search(t): if RECEIVE_EN.search(t) or RECEIVE_KO.search(t):
if holding and re.search(r"\bhold (?:it|that|on)\s*(?:$|[,.!?]|for\b|please\b|there\b)|^\W*(?:그거\s*)?들고 ?있어", t): if holding and re.search(r"\bhold (?:it|that|on)\s*(?:$|[,.!?]|for\b|please\b|there\b)|^\W*(?:그거\s*)?들고 ?있어", t):
return None # "just hold it": keep holding it return None # "just hold it": keep holding it
@@ -1827,10 +1848,10 @@ class Brain:
if action == "go_to": if action == "go_to":
said, target = target, next((mk for mk in markers if mk.lower() == target.lower()), None) said, target = target, next((mk for mk in markers if mk.lower() == target.lower()), None)
if not target and said.lower() not in ("", "none"): if not target and said.lower() not in ("", "none"):
say = place_problem(f"go to {said}", markers) or no_place_say(said, markers) # "go_to kitchen" say = place_problem(f"go to {said}", markers) or no_place_say(said, markers, text) # "go_to kitchen"
if target and not named_place(text, target, markers): if target and not named_place(text, target, markers):
target = None # "take me to the meeting room" -> p1: a guess, not driven target = None # "take me to the meeting room" -> p1: a guess, not driven
say = no_place_say("that", markers) say = no_place_say("that", markers, text)
action = "go_to" if target else "none" action = "go_to" if target else "none"
bare = CALLING.sub("", text) bare = CALLING.sub("", text)
if action in MOTIONS and (QUESTION_START.search(bare) and not (action in ("give", "receive") and if action in MOTIONS and (QUESTION_START.search(bare) and not (action in ("give", "receive") and
+20 -6
View File
@@ -863,14 +863,17 @@ class Lumi:
if action == "move" and not driving.MOVE_MIN_M <= amount <= MAX_MOVE_M: if action == "move" and not driving.MOVE_MIN_M <= amount <= MAX_MOVE_M:
log(f" move {amount:g} m: outside {driving.MOVE_MIN_M:g}..{MAX_MOVE_M:g} m, not driven") log(f" move {amount:g} m: outside {driving.MOVE_MIN_M:g}..{MAX_MOVE_M:g} m, not driven")
return False return False
if action == "move" and direction in ("back", "forward"): # straight with joy_control, checked like a full = action == "turn" and amount >= 360 # all the way round: a 360 deg goal is the start
from tasks import fetch # mission's move: navigation may turn round and if action == "move" and direction in ("back", "forward") or full: # pose to navigation; fetch turns twice 180
log(f" move {direction} {amount:g} m straight") # stops within its own tolerance from tasks import fetch # straight with joy_control, checked like a
self.stay() log(f" {action} {direction} {amount:g} by the task runner") # mission's move: navigation may turn round
self.stay() # and stops within its own tolerance
step = {"do": "turn", "deg": -360.0 if direction == "right" else 360.0} if full else \
{"do": "move", "dir": direction, "m": amount}
try: try:
fetch.run_steps([{"do": "move", "dir": direction, "m": amount}], say=self.fetch_say) fetch.run_steps([step], say=self.fetch_say)
except fetch.FetchError as e: except fetch.FetchError as e:
log(f" move {direction} refused: {e}") log(f" {action} {direction} refused: {e}")
self.fetch_say(str(e), "죄송해요, 지금은 할 수 없어요.") self.fetch_say(str(e), "죄송해요, 지금은 할 수 없어요.")
return False return False
return True return True
@@ -1345,6 +1348,9 @@ class Lumi:
if unread: if unread:
log(f" mission: unread {unread} ({by})") log(f" mission: unread {unread} ({by})")
problem = brain_mod.place_problem(" ".join(unread), self.markers) # "go to booth" with two booths problem = brain_mod.place_problem(" ".join(unread), self.markers) # "go to booth" with two booths
if not problem and not got:
problem = ("Sorry, I can do only one of those at a time. Please ask me one thing at a time.",
"죄송해요, 한 번에 하나씩만 할 수 있어요. 하나씩 말씀해 주세요.")
if not problem and all(brain_mod.intent(u, self.markers) for u in unread): if not problem and all(brain_mod.intent(u, self.markers) for u in unread):
problem = (f"Sorry, I can't do that as part of a task: {', '.join(unread)}. Please ask me one thing at a time.", problem = (f"Sorry, I can't do that as part of a task: {', '.join(unread)}. Please ask me one thing at a time.",
"죄송해요, 그건 작업 중에 함께 할 수 없어요. 하나씩 말씀해 주세요.") "죄송해요, 그건 작업 중에 함께 할 수 없어요. 하나씩 말씀해 주세요.")
@@ -2038,6 +2044,8 @@ class Lumi:
if action == "turn": if action == "turn":
say_en = "Okay, turning around." if d == "around" else f"Okay, turning {d}." say_en = "Okay, turning around." if d == "around" else f"Okay, turning {d}."
say_ko = "네, 뒤로 돌게요." if d == "around" else ("네, 왼쪽으로 돌게요." if d == "left" else "네, 오른쪽으로 돌게요.") say_ko = "네, 뒤로 돌게요." if d == "around" else ("네, 왼쪽으로 돌게요." if d == "left" else "네, 오른쪽으로 돌게요.")
if n == "360":
say_en, say_ko = "Okay, turning all the way around.", "네, 한 바퀴 돌게요."
else: else:
exact = driving.amount(brain_mod._norm(text))[1] # "about 5 centimetres" for "a tiny bit" exact = driving.amount(brain_mod._norm(text))[1] # "about 5 centimetres" for "a tiny bit"
say_en, say_ko = (driving.say_move(d, float(n), exact, lang) for lang in ("en", "ko")) say_en, say_ko = (driving.say_move(d, float(n), exact, lang) for lang in ("en", "ko"))
@@ -2611,6 +2619,8 @@ def talk_fate(text):
return "talk" return "talk"
KO_ORDER = {"보": "봐", "흔들": "흔들어", "돌": "돌아", "올리": "올려", "내리": "내려", "높이": "높여", "낮추": "낮춰"} # "나 보고 손 흔들어": 나 봐
ONE_AT_A_TIME = {"look", "lift", "wave", "turn", "move", "come", "follow", "go_to", "arm", "pick", "put", "move_object"}
NOT_A_STEP = re.compile(r"^\W*(?:(?:please|and|then|also)\s+)*(?:dance|jump|fly|swim|climb|sit(?: down)?|sleep|cook|draw|" NOT_A_STEP = re.compile(r"^\W*(?:(?:please|and|then|also)\s+)*(?:dance|jump|fly|swim|climb|sit(?: down)?|sleep|cook|draw|"
r"sing|clap|spin|bow|kneel|do a (?:dance|flip|trick)|tell|ask|say|show|call|find|look for|search|" r"sing|clap|spin|bow|kneel|do a (?:dance|flip|trick)|tell|ask|say|show|call|find|look for|search|"
r"bring|take|give|hand|put|carry|deliver)\b|.*(?:춤|점프|날아|수영|박수)", re.I) # a part not read: asked r"bring|take|give|hand|put|carry|deliver)\b|.*(?:춤|점프|날아|수영|박수)", re.I) # a part not read: asked
@@ -2631,6 +2641,10 @@ def read_mission(text, markers):
elif unread and got and any((brain_mod.intent(u, markers) or ("",))[0] not in ("", "weather", "search", "fetch") elif unread and got and any((brain_mod.intent(u, markers) or ("",))[0] not in ("", "weather", "search", "fetch")
or NOT_A_STEP.match(u) for u in unread): or NOT_A_STEP.match(u) for u in unread):
return got, unread, by # "go to the stage and wave": no task step, asked, never half done return got, unread, by # "go to the stage and wave": no task step, asked, never half done
elif unread and not got and len(unread) > 1 and sum((brain_mod.intent(u, markers) or brain_mod.intent(
re.sub(r"(보|흔들|돌|올리|내리|높이|낮추)고$", lambda m: KO_ORDER[m.group(1)], u), markers) or ("",))[0] in ONE_AT_A_TIME
for u in unread) > 1:
return got, unread, by # "look at me and wave", "웨이브 하고 나 봐": asked, not the first only
elif unread: elif unread:
return None # "come here, I need help": the old paths (rules, the LLM) answer it return None # "come here, I need help": the old paths (rules, the LLM) answer it
if not got: if not got:
+16
View File
@@ -53,6 +53,7 @@ def _norm(text, markers=()):
t = re.sub(r"\b(mr|mrs|ms|dr|prof)\. ", r"\1 ", wording.durations(brain.unfill(wording.norm(text, markers))) + " ") t = re.sub(r"\b(mr|mrs|ms|dr|prof)\. ", r"\1 ", wording.durations(brain.unfill(wording.norm(text, markers))) + " ")
t = re.sub(r"\b(?:take|pick up|pick|grab)\s?(?:해서|하고)", "집어서", t) # "컵 take해서": mixed t = re.sub(r"\b(?:take|pick up|pick|grab)\s?(?:해서|하고)", "집어서", t) # "컵 take해서": mixed
t = re.sub(r"(?<=[가-힣])고\s*나서(?=[\s,]|$)", "고", t) # "가고 나서" = "가고" t = re.sub(r"(?<=[가-힣])고\s*나서(?=[\s,]|$)", "고", t) # "가고 나서" = "가고"
t = re.sub(r"(?<![가-힣])(집었|잡았)다가(?=[\s,]|$)", lambda m: m.group(1)[0] + "고", t) # "컵 집었다가" = "컵 집고"
for honour, plain in _HON_KO: # "가셔서" = "가서", "받으시고" = "받고" for honour, plain in _HON_KO: # "가셔서" = "가서", "받으시고" = "받고"
t = re.sub(rf"(?<![가-힣]){honour}(?=[\s,.!?]|$)", plain, t) t = re.sub(rf"(?<![가-힣]){honour}(?=[\s,.!?]|$)", plain, t)
return re.sub(r"(?<![가-힣])(간|온|집은|잡은|든|받은|준|놓은|돈|기다린|들른|가신|오신|기다리신|받으신|집으신|잡으신|드신|주신|놓으신|도신)" return re.sub(r"(?<![가-힣])(간|온|집은|잡은|든|받은|준|놓은|돈|기다린|들른|가신|오신|기다리신|받으신|집으신|잡으신|드신|주신|놓으신|도신)"
@@ -169,7 +170,14 @@ def _move(c):
return None return None
_SPIN = re.compile(next(p for a, p in brain.INTENTS if a == "spin"), re.I) # "한 바퀴 돌아", "spin around"
_SPIN_REST = re.compile(r"\b(?:to (?:the |your )?)?(?:left|right)\b|\b(?:once|in place|on the spot)\b|제자리에서|그 ?자리에서|"
r"(?:왼쪽|오른쪽)으로|(?<![가-힣])(?:아|고|아서|았다가|아요|해|하고|해서|아 ?봐)(?![가-힣])|\s+")
def _turn(c): def _turn(c):
if _SPIN.search(c) and not _SPIN_REST.sub("", _SPIN.sub(" ", c)):
return {"do": "turn", "deg": -360.0 if re.search(r"\bright\b|오른쪽", c) else 360.0} # fetch: two half turns
if re.fullmatch(r"turn(?: around)? 180(?: degrees?)?|(?:180\s*도|뒤로)\s*(?:돌아|돌고|돌아서)", c): if re.fullmatch(r"turn(?: around)? 180(?: degrees?)?|(?:180\s*도|뒤로)\s*(?:돌아|돌고|돌아서)", c):
return {"do": "turn", "deg": 180.0} return {"do": "turn", "deg": 180.0}
m = re.fullmatch(r"turn (?:to the |to your )?(left|right|around)(?: by)?(?: {0}(?: degrees?)?)?".format(_NUM), c) m = re.fullmatch(r"turn (?:to the |to your )?(left|right|around)(?: by)?(?: {0}(?: degrees?)?)?".format(_NUM), c)
@@ -726,6 +734,10 @@ def _clause_steps(c, markers, after=None):
r"|이리와|come (?:back )?here|come back|(?:come |go |get )?(?:right |straight )?back (?:here|to me)|" r"|이리와|come (?:back )?here|come back|(?:come |go |get )?(?:right |straight )?back (?:here|to me)|"
r"come (?:right|straight) back(?: here)?", c): r"come (?:right|straight) back(?: here)?", c):
return [{"do": "go", "to": "here"}] return [{"do": "go", "to": "here"}]
if after and after["do"] == "pick" and re.fullmatch(
r"put (?:it|that|this|the \w+) back(?: down| there| where it was| on the table)?|"
r"(?:(?:그거|그걸|컵|그 컵)(?:을|를)? )?(?:(?:다시|제자리에|원래 자리에)\s*)+(?:놔|놓아|놓고|둬|두고|내려놔|내려 ?놓아)\s*(?:줘|요)?", c):
return [{"do": "place", "on": None}] # "take the cup and put it back": picked here, put down here
s = _wait(c, markers, after) s = _wait(c, markers, after)
if s is not None: if s is not None:
return s return s
@@ -1253,6 +1265,8 @@ def _en(s, last=False):
if d == "turn": if d == "turn":
if abs(s["deg"]) == 180: if abs(s["deg"]) == 180:
return "turn around" return "turn around"
if abs(s["deg"]) == 360:
return "turn all the way around" + (" to the right" if s["deg"] < 0 else "")
side = "left" if s["deg"] > 0 else "right" side = "left" if s["deg"] > 0 else "right"
return f"turn {side}" + ("" if abs(s["deg"]) == TURN_DEG else f" {abs(s['deg']):g} degrees") return f"turn {side}" + ("" if abs(s["deg"]) == TURN_DEG else f" {abs(s['deg']):g} degrees")
if d == "pick": if d == "pick":
@@ -1291,6 +1305,8 @@ def _ko(s, last=False):
side = {"forward": "앞으로", "back": "뒤로", "left": "왼쪽으로", "right": "오른쪽으로"}[s["dir"]] side = {"forward": "앞으로", "back": "뒤로", "left": "왼쪽으로", "right": "오른쪽으로"}[s["dir"]]
return f"{side} {s['m']:g}미터 가고" return f"{side} {s['m']:g}미터 가고"
if d == "turn": if d == "turn":
if abs(s["deg"]) == 360:
return "오른쪽으로 한 바퀴 돌고" if s["deg"] < 0 else "한 바퀴 돌고"
return "뒤로 돌고" if abs(s["deg"]) == 180 else ("왼쪽" if s["deg"] > 0 else "오른쪽") + "으로 돌고" return "뒤로 돌고" if abs(s["deg"]) == 180 else ("왼쪽" if s["deg"] > 0 else "오른쪽") + "으로 돌고"
if d == "pick": if d == "pick":
from tasks.fetch import OBJECTS as KO, PREFER_SAID from tasks.fetch import OBJECTS as KO, PREFER_SAID
+3 -1
View File
@@ -1983,7 +1983,9 @@ def _do_step(s, say):
_move(s["dir"], s["m"], holding) _move(s["dir"], s["m"], holding)
elif d == "turn": elif d == "turn":
_step(f"turning {s['deg']:+.0f} deg") _step(f"turning {s['deg']:+.0f} deg")
if not _turn(s["deg"], holding, why="as asked"): n = 2 if abs(s["deg"]) > 180 else 1 # all the way round: a 360 deg goal is the start pose to the base,
for _ in range(n): # so two half turns, each one's arm sweep checked
if not _turn(s["deg"] / n, holding, why="as asked"):
raise FetchError("I can't turn here: my arm would hit something, or I'm on the charger.", raise FetchError("I can't turn here: my arm would hit something, or I'm on the charger.",
"여기서는 돌 수 없어요.") "여기서는 돌 수 없어요.")
elif d == "pick": elif d == "pick":
+2 -2
View File
@@ -165,7 +165,7 @@ for t, want in [("move forward one metre", "action:move forward"), ("go back a l
("move left 2 meters", "action:move left"), ("앞으로 1미터 가", "action:move forward"), ("move left 2 meters", "action:move left"), ("앞으로 1미터 가", "action:move forward"),
("뒤로 조금 가 줘", "action:move back"), ("뒤로 물러나", "action:move back"), ("왼쪽으로 50센티 가", "action:move left"), ("뒤로 조금 가 줘", "action:move back"), ("뒤로 물러나", "action:move back"), ("왼쪽으로 50센티 가", "action:move left"),
("turn around", "action:turn around"), ("turn left", "action:turn left"), ("turn right 45 degrees", "action:turn right"), ("turn around", "action:turn around"), ("turn left", "action:turn left"), ("turn right 45 degrees", "action:turn right"),
("spin around", "action:turn around"), ("한 바퀴 돌아", "action:turn around"), ("왼쪽으로 돌아", "action:turn left"), ("spin around", "action:turn 360"), ("한 바퀴 돌아", "action:turn 360"), ("왼쪽으로 돌아", "action:turn left"),
("come here", "action:come"), ("come to me", "action:come"), ("come closer", "action:come"), ("이리 와", "action:come"), ("come here", "action:come"), ("come to me", "action:come"), ("come closer", "action:come"), ("이리 와", "action:come"),
("여기로 와 줘", "action:come"), ("come over here please", "action:come"), ("여기로 와 줘", "action:come"), ("come over here please", "action:come"),
("go to p3", "action:go_to p3"), ("go to point two", "action:go_to p2"), ("p5로 가", "action:go_to p5"), ("go to p3", "action:go_to p3"), ("go to point two", "action:go_to p2"), ("p5로 가", "action:go_to p5"),
@@ -378,7 +378,7 @@ for t, want, st in [
("그거 이리 내놔", "give", "holding"), ("자 받아라", "receive", "idle"), ("이거 맡아 줘", "receive", "idle"), ("그거 이리 내놔", "give", "holding"), ("자 받아라", "receive", "idle"), ("이거 맡아 줘", "receive", "idle"),
("그만 쳐다봐", "action:look away", "idle"), ("좀 비켜 봐", "action:move back", "idle"), ("뒤로 좀 빠져", "action:move back", "idle"), ("그만 쳐다봐", "action:look away", "idle"), ("좀 비켜 봐", "action:move back", "idle"), ("뒤로 좀 빠져", "action:move back", "idle"),
("사과 하나만 줘", "mission | action:fetch apple", "idle"), ("거기다 놔", "place", "holding"), ("바닥에 내려놔", "place | talk", "holding"), ("사과 하나만 줘", "mission | action:fetch apple", "idle"), ("거기다 놔", "place", "holding"), ("바닥에 내려놔", "place | talk", "holding"),
("손 꽉 쥐어", "action:arm close", "idle"), ("팔 쭉 펴", "action:arm reach", "idle"), ("한 바퀴 돌아 봐", "action:turn around", "idle")]: ("손 꽉 쥐어", "action:arm close", "idle"), ("팔 쭉 펴", "action:arm reach", "idle"), ("한 바퀴 돌아 봐", "action:turn 360", "idle")]:
add("slang", t, want, state=st) add("slang", t, want, state=st)
# ---------- near misses: not a hand-over, not a correction ---------- # ---------- near misses: not a hand-over, not a correction ----------
+29 -1
View File
@@ -130,7 +130,7 @@ for t, want in [("turn left", "action:turn left 90"), ("turn to the right please
("turn around", "action:turn around"), ("could you turn left 30 degrees?", "action:turn left 30"), ("turn around", "action:turn around"), ("could you turn left 30 degrees?", "action:turn left 30"),
("turn right 45 degrees", "action:turn right 45"), ("왼쪽으로 돌아", "action:turn left 90"), ("turn right 45 degrees", "action:turn right 45"), ("왼쪽으로 돌아", "action:turn left 90"),
("오른쪽으로 돌아 줘", "action:turn right 90"), ("뒤로 돌아", "action:turn around"), ("오른쪽으로 돌아 줘", "action:turn right 90"), ("뒤로 돌아", "action:turn around"),
("왼쪽으로 45도 돌아 주세요", "action:turn left 45"), ("한 바퀴 돌아 봐", "action:turn around"), ("왼쪽으로 45도 돌아 주세요", "action:turn left 45"), ("한 바퀴 돌아 봐", "action:turn 360"),
("turn left 하고", "action:turn left | talk")]: ("turn left 하고", "action:turn left | talk")]:
add("turn", t, want) add("turn", t, want)
for t in ["don't turn", "돌지 마", "turn off the light", "turn up the volume", "it's your turn", "turn the page"]: for t in ["don't turn", "돌지 마", "turn off the light", "turn up the volume", "it's your turn", "turn the page"]:
@@ -272,4 +272,32 @@ for t, want in [("can you raise yourself?", "action:lift up"), ("could you get a
("can you pick that up?", "talk | ask"), ("how about turning left", "talk | action:turn left"), ("can you pick that up?", "talk | ask"), ("how about turning left", "talk | action:turn left"),
("would you mind looking at me?", "talk | action:look me")]: ("would you mind looking at me?", "talk | action:look me")]:
add("levels", t, want) add("levels", t, want)
# ---------- leftovers of the second night (2026-10-22) ----------
for t in ["look at me and wave", "look at me, then wave", "wave and look at me", "lift yourself up and wave",
"웨이브 하고 나 봐", "나 보고 손 흔들어", "손 흔들고 나 봐 줘", "키 높이고 손 흔들어", "look at me and 손 흔들어",
"Lumi, look at me and wave please"]:
add("mission_part", t, "talk | ask") # two motions that are no task steps: asked, not the first only
for t in ["put it down and wave", "내려놓고 손 흔들어", "give it to me and wave"]:
add("mission_part", t, "talk | ask", state="holding")
for t in ["spin around", "turn all the way around", "do a 360", "turn 360 degrees", "한 바퀴 돌아", "한 바퀴 돌아 줘",
"제자리에서 한 바퀴 돌아 주세요", "360도 돌아", "빙글빙글 돌아", "Lumi, spin around please", "can you spin around?"]:
add("turn", t, "action:turn 360") # two checked half turns (tasks/fetch.py _do_step)
for t, want in [("오른쪽으로 한 바퀴 돌아", "action:turn right 360"), ("spin around to the right", "action:turn right 360"),
("turn around", "action:turn around 180"), ("뒤로 돌아", "action:turn around 180")]:
add("turn", t, want)
for t in ["공원 한 바퀴 돌았어", "the earth spins around the sun", "how do you spin around?", "can I spin around?",
"어제 한 바퀴 돌았어요"]:
add("turn_not", t, "talk")
for t in ["take the cup and put it back", "pick up the red cup and put it back", "컵 집었다가 제자리에 놔",
"grab the apple and put it back down"]:
add("mission", t, "mission") # picked here, put back here
for t in ["루미야 너 월급 받아?", "너 월급 받아?", "월급 받아요?", "너 전화 받아?", "칭찬 많이 받아?"]:
add("talk", t, "talk") # about Lumi, nothing is handed over
for t in ["컵 가져다 줘", "컵 좀 가져다 주세요", "컵 갖다 줘", "빨간 컵 가져다 줄래?"]:
add("fetch", t, "mission | action:fetch") # picked from the table in front, handed over
for t, want in [("Let's go P5 (point).", "action:go_to p5"), ("Let's go P9.", "action:go_to p9"),
("lets go p3", "action:go_to p3"), ("let's go p10 point", "action:go_to p10"),
("let's go eat", "talk")]:
CASES.append({"intent": "new:go", "text": t, "lang": "en", "state": "idle", "before": None, "expect": want,
"markers": ["home", "dock2", "exit", "final"] + [f"p{i}" for i in range(1, 11)]}) # the owner's map
R.shuffle(CASES) # the report lists them by intent; the order only spreads the LLM's load R.shuffle(CASES) # the report lists them by intent; the order only spreads the LLM's load
+1 -1
View File
@@ -228,7 +228,7 @@ add("turn", "왼쪽으로 돌아", "action:turn left 90")
add("turn", "오른쪽으로 돌아 주세요", "action:turn right 90") add("turn", "오른쪽으로 돌아 주세요", "action:turn right 90")
add("turn", "오른쪽으로 사십오 도 도십시오", "action:turn right 45") add("turn", "오른쪽으로 사십오 도 도십시오", "action:turn right 45")
add("turn", "turn left 해 줘", "action:turn left 90") add("turn", "turn left 해 줘", "action:turn left 90")
add("turn", "한 바퀴 빙 돌아 봐", "action:turn around | ask") # owner set (command_cases): around add("turn", "한 바퀴 빙 돌아 봐", "action:turn 360 | ask") # all the way round: two half turns
add("turn_not", "it's your turn to talk", "talk") add("turn_not", "it's your turn to talk", "talk")
add("turn_not", "turn left at the corner and you'll find the restroom", "talk") add("turn_not", "turn left at the corner and you'll find the restroom", "talk")
+4 -8
View File
@@ -38,14 +38,10 @@ class NoLLM(Exception):
def seen(text): def seen(text):
"""assistant/seeing.answer() takes these words (its own test: tests/test_seeing.py); the camera is not asked.""" """assistant/seeing.answer() takes these words (its own test: tests/test_seeing.py). No frames: it answers "no
t = text.strip() camera" where it would look, None where it leaves the words to the rest ("how far is the stage?")."""
if seeing.HOW_MANY.search(t) and seeing.NOT_IN_VIEW.search(t): seeing._last.update(thing=None, name=None, kind=None)
return False # "how many people work at Cutshion?" return seeing.answer(text.strip(), frames=[]) is not None
return not seeing.ORDER.search(t) and any(rx.search(t) for rx in (
seeing.WEARING, seeing.HOLDING, seeing.SHIRT, seeing.RAISED, seeing.POINTING, seeing.DOING, seeing.SEE_ME,
seeing.HOW_MANY, seeing.BEHIND, seeing.HOW_FAR, seeing.SEE_THING, seeing.THERE_IS, seeing.SEE_THING_KO,
seeing.WHAT_SEE))
def rules(text, state, marks, b): def rules(text, state, marks, b):
+2 -1
View File
@@ -504,7 +504,8 @@ MORE = [
("action:come", "ko", [("elderly", "이리 좀 와 봐"), ("factory", "루미 여기"), ("kid", "루미야 나한테 와"), ("visitor", "이쪽으로 오세요")]), ("action:come", "ko", [("elderly", "이리 좀 와 봐"), ("factory", "루미 여기"), ("kid", "루미야 나한테 와"), ("visitor", "이쪽으로 오세요")]),
("action:turn left", "ko", [("kid", "왼쪽으로 돌아 봐")]), ("action:turn left", "ko", [("kid", "왼쪽으로 돌아 봐")]),
("action:turn right", "ko", [("visitor", "오른쪽으로 회전해")]), ("action:turn right", "ko", [("visitor", "오른쪽으로 회전해")]),
("action:turn around", "ko", [("kid", "한 바퀴 돌아"), ("visitor", "뒤돌아 주세요")]), ("action:turn 360", "ko", [("kid", "한 바퀴 돌아")]),
("action:turn around", "ko", [("visitor", "뒤돌아 주세요")]),
("action:move forward 2", "ko", [("visitor", "앞으로 2미터 가 줘")]), ("action:move forward 2", "ko", [("visitor", "앞으로 2미터 가 줘")]),
("action:move back 1", "ko", [("security", "뒤로 1미터 물러나"), ("cleaner", "1미터 뒤로 가 주세요")]), ("action:move back 1", "ko", [("security", "뒤로 1미터 물러나"), ("cleaner", "1미터 뒤로 가 주세요")]),
("action:move right 1", "ko", [("visitor", "오른쪽으로 1미터 가")]), ("action:move right 1", "ko", [("visitor", "오른쪽으로 1미터 가")]),
+2 -2
View File
@@ -15,7 +15,7 @@ DIALOGUES_COMMANDS = [
D("visitor", "commands", "en", D("visitor", "commands", "en",
T("Back up a little, would you?", "move back"), T("Back up a little, would you?", "move back"),
T("Scoot forward one metre.", "move forward"), T("Scoot forward one metre.", "move forward"),
T("Spin around.", "turn around"), T("Spin around.", "turn 360"),
T("Rotate to your right.", "turn right")), T("Rotate to your right.", "turn right")),
D("engineer", "commands", "en", D("engineer", "commands", "en",
T("Turn your head 200 degrees to the left.", "look left", must=[r"180"], T("Turn your head 200 degrees to the left.", "look left", must=[r"180"],
@@ -39,7 +39,7 @@ DIALOGUES_COMMANDS = [
D("visitor", "commands", "ko", D("visitor", "commands", "ko",
T("뒤로 1미터만 물러나 줘.", "move back"), T("뒤로 1미터만 물러나 줘.", "move back"),
T("앞으로 조금만 와 봐.", "move forward"), T("앞으로 조금만 와 봐.", "move forward"),
T("한 바퀴 빙 돌아 봐.", "turn around"), T("한 바퀴 빙 돌아 봐.", "turn 360"),
T("오른쪽으로 돌아.", "turn right")), T("오른쪽으로 돌아.", "turn right")),
D("factory worker", "commands", "ko", D("factory worker", "commands", "ko",
T("키 좀 높여 봐요.", "lift up"), T("키 좀 높여 봐요.", "lift up"),
+24
View File
@@ -176,6 +176,25 @@ CASES.update({
}) })
# said with a correction inside: brain.self_correct reads it first (lumi.answer) # said with a correction inside: brain.self_correct reads it first (lumi.answer)
# ---- 2026-10-22: a full turn (two checked half turns), put it back after a pick, look / lift / wave are no steps ----
CASES.update({
"한 바퀴 돌고 스테이지로 가": "turn 360 | go stage",
"spin around and then go to the stage": "turn 360 | go stage",
"go to booth two and turn all the way around": "go booth_2 | turn 360",
"스테이지 가서 오른쪽으로 한 바퀴 돌아 줘": "go stage | turn -360",
"go to the end, spin around, then come back": "go end | turn 360 | go here",
"take the cup and put it back": "pick cup | place",
"pick up the red cup and put it back down": "pick red cup | place",
"컵 집었다가 제자리에 놔": "pick cup | place",
"컵 집고 제자리에 다시 놔 줘": "pick cup | place",
"take the cup, go to the stage and put it back": "?",
"look at me and wave": "?",
"웨이브 하고 나 봐": "?",
"나 보고 손 흔들어": "?",
"lift yourself up and wave": "?",
"go to the stage and spin around the table": "?",
})
FIXED = { FIXED = {
"take the cup, go to start, no, end, and give it to James": "pick cup | go end | give James", "take the cup, go to start, no, end, and give it to James": "pick cup | go end | give James",
"go to start, sorry, I mean the stage, then come back": "go stage | go here", "go to start, sorry, I mean the stage, then come back": "go stage | go here",
@@ -186,6 +205,11 @@ FIXED = {
# the read-back (steps.describe) for a few of them # the read-back (steps.describe) for a few of them
READ_BACK = { READ_BACK = {
"turn 360 | go stage": ("Turn all the way around, then go to stage.", "한 바퀴 돌고 stage 위치로 갈게요."),
"go stage | turn -360": ("Go to stage, then turn all the way around to the right.",
"stage 위치로 가고 오른쪽으로 한 바퀴 돌게요."),
"pick cup | place": ("Take the cup, then put it down.", "컵을 집고 테이블에 놓을게요."),
"pick cup | give": ("Take the cup, then hand it over.", "컵을 집고 건네줄게요."), # "컵 가져다 줘"
"pick cup | go booth_2 | give James | go here": "pick cup | go booth_2 | give James | go here":
("Take the cup, go to booth 2, hand it to James, then come back here.", ("Take the cup, go to booth 2, hand it to James, then come back here.",
"컵을 집고 booth 2 위치로 가고 James에게 건네주고 여기로 돌아올게요."), "컵을 집고 booth 2 위치로 가고 James에게 건네주고 여기로 돌아올게요."),
+3
View File
@@ -593,6 +593,9 @@ fetch._sweep_blocked = lambda deg, what: round(fetch._waist_turn() + deg) in blo
fetch.first_side = lambda: -1 # more unmapped things on the right fetch.first_side = lambda: -1 # more unmapped things on the right
fetch._turn = lambda deg, holding=False, why="": base_turns.append((deg, body["lift"])) or deg not in blocked_turns fetch._turn = lambda deg, holding=False, why="": base_turns.append((deg, body["lift"])) or deg not in blocked_turns
blocked_turns = set() blocked_turns = set()
fetch._do_step({"do": "turn", "deg": -360.0}, None) # all the way round: two checked half turns
assert [d for d, _ in base_turns] == [-180.0, -180.0], base_turns
base_turns.clear()
def seen_here(at=None): def seen_here(at=None):
views.append((round(fetch._waist_turn()), round(hp["yaw"]))) views.append((round(fetch._waist_turn()), round(hp["yaw"])))
return "it" if views[-1] == at else None return "it" if views[-1] == at else None
+4
View File
@@ -258,6 +258,10 @@ for text, said, prefer in (("take the smaller cup to p1", "Take the smaller cup
r = server.task_parse(server.ParseBody(text=text)) r = server.task_parse(server.ParseBody(text=text))
assert r["action"] == "fetch" and r["sentence"] == said and r["task"]["prefer"] == prefer, (text, r) assert r["action"] == "fetch" and r["sentence"] == said and r["task"]["prefer"] == prefer, (text, r)
assert server.TaskBody(**r["task"]).model_dump()["prefer"] == prefer # /tasks/fetch keeps it assert server.TaskBody(**r["task"]).model_dump()["prefer"] == prefer # /tasks/fetch keeps it
# a correction inside the typed command is read as by voice (brain.self_correct)
r = server.task_parse(server.ParseBody(text="bring me the cup from p1, no, from p8"))
assert r["action"] == "fetch" and r["task"]["source"] == {"marker": "p8"}, r
assert server.task_parse(server.ParseBody(text="go to p1, never mind"))["problems"] == ["Taken back: nothing to do."]
two = [{**cups[0], "x": -100.0, "y": 600.0, "width_mm": 80.0}, {**cups[0], "x": 120.0, "y": 650.0, "width_mm": 66.0}] two = [{**cups[0], "x": -100.0, "y": 600.0, "width_mm": 80.0}, {**cups[0], "x": 120.0, "y": 650.0, "width_mm": 66.0}]
find = lambda **t: fetch._find({"object": "cup", "colour": None, **t}, two) find = lambda **t: fetch._find({"object": "cup", "colour": None, **t}, two)
assert find() == two[0] and find(prefer="small") == two[1] and find(prefer="big") == two[0] assert find() == two[0] and find(prefer="small") == two[1] and find(prefer="big") == two[0]