diff --git a/api/server.py b/api/server.py index d6b5895..3a31477 100644 --- a/api/server.py +++ b/api/server.py @@ -978,6 +978,11 @@ def task_parse(body: ParseBody): from tasks import fetch markers = agv.markers() 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 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)): diff --git a/assistant/brain.py b/assistant/brain.py index e3351b9..8346393 100644 --- a/assistant/brain.py +++ b/assistant/brain.py @@ -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 metre" / "1미터 뒤로 가" / whisper's "let's bake one meter" -> move back 1: straight back, no turning). At most 3 metres. - turn : 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 : 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"). - 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"|^\W*(?:(?:루미야?|lumi|hey lumi)\W*)?(?:point\s+)?([a-z][a-z0-9_]*)\s*(?:으로|로)\s*(?:좀\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*(?:(?:please|now|for me|thanks)\W*)*$"), # whisper drops the "to": "go stage" + r"|^\W*(?:(?:hey|hi|okay|ok|so|um+|uh+|alright|please|well|now|lumi|let'?s|lets)\W+)*(?:go|drive|head)\s+" + 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|노래"), ("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 " 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"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|뒤로 ?돌|돌아 ?봐|" 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|" @@ -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|" - r"please))\b)|\b(?:later|tomorrow|tonight|next time|in an hour)\b|[가-힣](? 출구), never the model's English for it.""" 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}.", - 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 )?" @@ -1163,6 +1176,9 @@ RECEIVE_KO = re.compile( r"(?:드릴게|드릴께|줄게|줄께|드리려고|주려고|드릴 ?거|줄 ?거)(?!.*(?:줘|주세요))|" rf"(?:{_THIS_KO}(?:\s*(?:{_COL}))?(?:\s*(?:{_OBJ}))?(?:을|를)?|(?:내|제) 손에 (?:있는|든) (?:거|것|(?:\S+\s+)?\S+))\s*(?:좀\s*)?" r"(?:가져가|들고 ?있어|잡아(?!당)|맡아)", re.I) +PAID_Q = re.compile(r"(? 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" + 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"(? 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" bare = CALLING.sub("", text) if action in MOTIONS and (QUESTION_START.search(bare) and not (action in ("give", "receive") and diff --git a/assistant/lumi.py b/assistant/lumi.py index 04e274b..b7e0460 100644 --- a/assistant/lumi.py +++ b/assistant/lumi.py @@ -863,14 +863,17 @@ class Lumi: 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") return False - if action == "move" and direction in ("back", "forward"): # straight with joy_control, checked like a - from tasks import fetch # mission's move: navigation may turn round and - log(f" move {direction} {amount:g} m straight") # stops within its own tolerance - self.stay() + full = action == "turn" and amount >= 360 # all the way round: a 360 deg goal is the start + if action == "move" and direction in ("back", "forward") or full: # pose to navigation; fetch turns twice 180 + from tasks import fetch # straight with joy_control, checked like a + 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: - 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: - log(f" move {direction} refused: {e}") + log(f" {action} {direction} refused: {e}") self.fetch_say(str(e), "죄송해요, 지금은 할 수 없어요.") return False return True @@ -1345,6 +1348,9 @@ class Lumi: if unread: log(f" mission: unread {unread} ({by})") 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): 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": say_en = "Okay, turning around." if d == "around" else f"Okay, turning {d}." say_ko = "네, 뒤로 돌게요." if d == "around" else ("네, 왼쪽으로 돌게요." if d == "left" else "네, 오른쪽으로 돌게요.") + if n == "360": + say_en, say_ko = "Okay, turning all the way around.", "네, 한 바퀴 돌게요." else: 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")) @@ -2611,6 +2619,8 @@ def talk_fate(text): 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|" 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 @@ -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") 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 + 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: return None # "come here, I need help": the old paths (rules, the LLM) answer it if not got: diff --git a/assistant/steps.py b/assistant/steps.py index d24eed1..cde989f 100644 --- a/assistant/steps.py +++ b/assistant/steps.py @@ -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(?:take|pick up|pick|grab)\s?(?:해서|하고)", "집어서", t) # "컵 take해서": mixed t = re.sub(r"(?<=[가-힣])고\s*나서(?=[\s,]|$)", "고", t) # "가고 나서" = "가고" + t = re.sub(r"(? 0 else "right" return f"turn {side}" + ("" if abs(s["deg"]) == TURN_DEG else f" {abs(s['deg']):g} degrees") if d == "pick": @@ -1291,6 +1305,8 @@ def _ko(s, last=False): side = {"forward": "앞으로", "back": "뒤로", "left": "왼쪽으로", "right": "오른쪽으로"}[s["dir"]] return f"{side} {s['m']:g}미터 가고" 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 "오른쪽") + "으로 돌고" if d == "pick": from tasks.fetch import OBJECTS as KO, PREFER_SAID diff --git a/tasks/fetch.py b/tasks/fetch.py index 00e68b9..7b63254 100644 --- a/tasks/fetch.py +++ b/tasks/fetch.py @@ -1983,9 +1983,11 @@ def _do_step(s, say): _move(s["dir"], s["m"], holding) elif d == "turn": _step(f"turning {s['deg']:+.0f} deg") - if not _turn(s["deg"], holding, why="as asked"): - raise FetchError("I can't turn here: my arm would hit something, or I'm on the charger.", - "여기서는 돌 수 없어요.") + 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.", + "여기서는 돌 수 없어요.") elif d == "pick": if gripper.open_()["closed"]: raise FetchError("My hand does not open.", "손이 안 열려요.") diff --git a/tests/command_cases.py b/tests/command_cases.py index 802e27e..7d5d542 100644 --- a/tests/command_cases.py +++ b/tests/command_cases.py @@ -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"), ("뒤로 조금 가 줘", "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"), - ("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"), ("여기로 와 줘", "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"), @@ -378,7 +378,7 @@ for t, want, st in [ ("그거 이리 내놔", "give", "holding"), ("자 받아라", "receive", "idle"), ("이거 맡아 줘", "receive", "idle"), ("그만 쳐다봐", "action:look away", "idle"), ("좀 비켜 봐", "action:move back", "idle"), ("뒤로 좀 빠져", "action:move back", "idle"), ("사과 하나만 줘", "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) # ---------- near misses: not a hand-over, not a correction ---------- diff --git a/tests/command_cases2.py b/tests/command_cases2.py index 799fc1e..6366637 100644 --- a/tests/command_cases2.py +++ b/tests/command_cases2.py @@ -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 right 45 degrees", "action:turn right 45"), ("왼쪽으로 돌아", "action:turn left 90"), ("오른쪽으로 돌아 줘", "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")]: 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"]: @@ -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"), ("would you mind looking at me?", "talk | action:look me")]: 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 diff --git a/tests/command_cases3.py b/tests/command_cases3.py index 5cee65a..43e713f 100644 --- a/tests/command_cases3.py +++ b/tests/command_cases3.py @@ -228,7 +228,7 @@ add("turn", "왼쪽으로 돌아", "action:turn left 90") add("turn", "오른쪽으로 돌아 주세요", "action:turn right 90") add("turn", "오른쪽으로 사십오 도 도십시오", "action:turn right 45") 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", "turn left at the corner and you'll find the restroom", "talk") diff --git a/tests/command_check.py b/tests/command_check.py index 79853d8..1beeb05 100644 --- a/tests/command_check.py +++ b/tests/command_check.py @@ -38,14 +38,10 @@ class NoLLM(Exception): def seen(text): - """assistant/seeing.answer() takes these words (its own test: tests/test_seeing.py); the camera is not asked.""" - t = text.strip() - if seeing.HOW_MANY.search(t) and seeing.NOT_IN_VIEW.search(t): - return False # "how many people work at Cutshion?" - 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)) + """assistant/seeing.answer() takes these words (its own test: tests/test_seeing.py). No frames: it answers "no + camera" where it would look, None where it leaves the words to the rest ("how far is the stage?").""" + seeing._last.update(thing=None, name=None, kind=None) + return seeing.answer(text.strip(), frames=[]) is not None def rules(text, state, marks, b): diff --git a/tests/conversation_cases_more.py b/tests/conversation_cases_more.py index 267cc2a..d257583 100644 --- a/tests/conversation_cases_more.py +++ b/tests/conversation_cases_more.py @@ -504,7 +504,8 @@ MORE = [ ("action:come", "ko", [("elderly", "이리 좀 와 봐"), ("factory", "루미 여기"), ("kid", "루미야 나한테 와"), ("visitor", "이쪽으로 오세요")]), ("action:turn left", "ko", [("kid", "왼쪽으로 돌아 봐")]), ("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 back 1", "ko", [("security", "뒤로 1미터 물러나"), ("cleaner", "1미터 뒤로 가 주세요")]), ("action:move right 1", "ko", [("visitor", "오른쪽으로 1미터 가")]), diff --git a/tests/dialogues_commands.py b/tests/dialogues_commands.py index ec3377d..aaa9cad 100644 --- a/tests/dialogues_commands.py +++ b/tests/dialogues_commands.py @@ -15,7 +15,7 @@ DIALOGUES_COMMANDS = [ D("visitor", "commands", "en", T("Back up a little, would you?", "move back"), T("Scoot forward one metre.", "move forward"), - T("Spin around.", "turn around"), + T("Spin around.", "turn 360"), T("Rotate to your right.", "turn right")), D("engineer", "commands", "en", T("Turn your head 200 degrees to the left.", "look left", must=[r"180"], @@ -39,7 +39,7 @@ DIALOGUES_COMMANDS = [ D("visitor", "commands", "ko", T("뒤로 1미터만 물러나 줘.", "move back"), T("앞으로 조금만 와 봐.", "move forward"), - T("한 바퀴 빙 돌아 봐.", "turn around"), + T("한 바퀴 빙 돌아 봐.", "turn 360"), T("오른쪽으로 돌아.", "turn right")), D("factory worker", "commands", "ko", T("키 좀 높여 봐요.", "lift up"), diff --git a/tests/steps_cases7.py b/tests/steps_cases7.py index 0b4992c..5210c3c 100644 --- a/tests/steps_cases7.py +++ b/tests/steps_cases7.py @@ -176,6 +176,25 @@ CASES.update({ }) # 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 = { "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", @@ -186,6 +205,11 @@ FIXED = { # the read-back (steps.describe) for a few of them 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": ("Take the cup, go to booth 2, hand it to James, then come back here.", "컵을 집고 booth 2 위치로 가고 James에게 건네주고 여기로 돌아올게요."), diff --git a/tests/test_fetch.py b/tests/test_fetch.py index 3f57e77..b8c0286 100644 --- a/tests/test_fetch.py +++ b/tests/test_fetch.py @@ -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._turn = lambda deg, holding=False, why="": base_turns.append((deg, body["lift"])) or deg not in blocked_turns 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): views.append((round(fetch._waist_turn()), round(hp["yaw"]))) return "it" if views[-1] == at else None diff --git a/tests/test_fetch_place.py b/tests/test_fetch_place.py index edae720..ca52a31 100644 --- a/tests/test_fetch_place.py +++ b/tests/test_fetch_place.py @@ -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)) 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 +# 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}] 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]