diff --git a/assistant/lumi.py b/assistant/lumi.py index 7726852..d688d2f 100644 --- a/assistant/lumi.py +++ b/assistant/lumi.py @@ -2088,7 +2088,7 @@ class Lumi: ko = brain_mod.object_ko(what[1]) + " " if what[1] else "" said = (f"Okay, putting {what[0]} back.", f"네, {ko}제자리에 놓을게요.") if back else \ (f"Okay, putting {what[0]} down.", f"네, {ko}내려놓을게요.") - done = ("Done.", "다 했어요.") + done = ("I've put it down.", "내려놓았어요.") run = lambda: skills.put_down(back=back) else: words = (target or "").lower().split() # the LLM may write "the white cup" @@ -2112,7 +2112,7 @@ class Lumi: fetch.pick_here(name, colour, say=self.fetch_say) fetch.held_by_skill({"object": name, "colour": colour}) else: - said, done = (f"Okay, I'll move the {target}.", "네, 옮겨 볼게요."), ("Done.", "다 옮겼어요.") + said, done = (f"Okay, I'll move the {target}.", "네, 옮겨 볼게요."), ("I've moved it.", "다 옮겼어요.") run = lambda: skills.move_object(name, colour) if confirm: mouth.say(said[0] if en else said[1]) diff --git a/tasks/fetch.py b/tasks/fetch.py index 00bddd9..97b3687 100644 --- a/tasks/fetch.py +++ b/tasks/fetch.py @@ -2522,7 +2522,13 @@ def _needs_markers(task): return any(isinstance(task.get(k), dict) and "marker" in task[k] for k in ("source", "dest")) -def _finish(fn, say): +PUT_DOWN_WORDS = ("I've put it down.", "내려놓았어요.") +HANDED_WORDS = ("Here you are.", "여기 있어요.") +END_WORDS = {"go": ("I'm here.", "도착했어요."), "place": PUT_DOWN_WORDS, "give": HANDED_WORDS} # by the last step; + # arm poses, moves, turns and words end without a word (seen / said) + + +def _finish(fn, say, end=None): _adopt() with _lock: if _busy(): @@ -2544,7 +2550,8 @@ def _finish(fn, say): return _lift_to(LIFT_DRIVE_MM) _set(status="done", step="") - _say(say, "Done.", "다 했어요.") + if end: + _say(say, *end) log("done") except Exception as e: _fail(e, say) @@ -2555,12 +2562,12 @@ def give(say=None): """Hand the held object to the person in front.""" if "give" not in motion.poses(): raise FetchError("I haven't learned how to hand things over yet.") - _finish(_give, say) + _finish(_give, say, HANDED_WORDS) def place(say=None, on=None): """Put the held object on the table in front, or on the thing `on` names (brain.place_on).""" - _finish(lambda s: _put_down(s, on), say) + _finish(lambda s: _put_down(s, on), say, PUT_DOWN_WORDS) THEN = (None, "place", "give") # after carry_to: keep holding it, put it on a table there, hand it over @@ -2575,7 +2582,7 @@ def carry_to(dest, then=None, say=None, on=None): raise FetchError(f"After driving I can only {', '.join(t for t in THEN if t)} or keep holding it.") if then == "give" and "give" not in motion.poses(): raise FetchError("I haven't learned how to hand things over yet.") - _finish(lambda s: _carry_to(dest, s, then, on), say) + _finish(lambda s: _carry_to(dest, s, then, on), say, END_WORDS.get(then)) def _carry_to(dest, say, then=None, on=None): @@ -2700,7 +2707,8 @@ def _run_steps(steps, say): else: _lift_to(LIFT_DRIVE_MM) _set(status="done", step="") - _say(say, "Done.", "다 했어요.") + if done and done[-1]["do"] in END_WORDS: + _say(say, *END_WORDS[done[-1]["do"]]) log(_state["status"]) except Exception as e: _fail(e, say) diff --git a/tests/test_fetch.py b/tests/test_fetch.py index 1e0b158..9e59d10 100644 --- a/tests/test_fetch.py +++ b/tests/test_fetch.py @@ -915,7 +915,7 @@ st = run(fetch.run_steps, [P(do="pick", object="apple", colour=None), P(do="move names = [c[0] for c in calls] assert st["status"] == "done" and not st["holding"], st assert names.index("pick") < names.index("go_point") < names.index("joy") < names.index("place"), calls # turn, drive -assert ("joy", "100.000") in calls and "Done." in said, (calls, said) +assert ("joy", "100.000") in calls and said[-1] == "I've put it down.", (calls, said) # the last step's words # receive: the hand held out, closes when the sensor sees something, the cup is carried on; place after it refused reset() hand["front"] = False