Make closing replies fit each command
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -2088,7 +2088,7 @@ class Lumi:
|
|||||||
ko = brain_mod.object_ko(what[1]) + " " if what[1] else ""
|
ko = brain_mod.object_ko(what[1]) + " " if what[1] else ""
|
||||||
said = (f"Okay, putting {what[0]} back.", f"네, {ko}제자리에 놓을게요.") if back else \
|
said = (f"Okay, putting {what[0]} back.", f"네, {ko}제자리에 놓을게요.") if back else \
|
||||||
(f"Okay, putting {what[0]} down.", f"네, {ko}내려놓을게요.")
|
(f"Okay, putting {what[0]} down.", f"네, {ko}내려놓을게요.")
|
||||||
done = ("Done.", "다 했어요.")
|
done = ("I've put it down.", "내려놓았어요.")
|
||||||
run = lambda: skills.put_down(back=back)
|
run = lambda: skills.put_down(back=back)
|
||||||
else:
|
else:
|
||||||
words = (target or "").lower().split() # the LLM may write "the white cup"
|
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.pick_here(name, colour, say=self.fetch_say)
|
||||||
fetch.held_by_skill({"object": name, "colour": colour})
|
fetch.held_by_skill({"object": name, "colour": colour})
|
||||||
else:
|
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)
|
run = lambda: skills.move_object(name, colour)
|
||||||
if confirm:
|
if confirm:
|
||||||
mouth.say(said[0] if en else said[1])
|
mouth.say(said[0] if en else said[1])
|
||||||
|
|||||||
+14
-6
@@ -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"))
|
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()
|
_adopt()
|
||||||
with _lock:
|
with _lock:
|
||||||
if _busy():
|
if _busy():
|
||||||
@@ -2544,7 +2550,8 @@ def _finish(fn, say):
|
|||||||
return
|
return
|
||||||
_lift_to(LIFT_DRIVE_MM)
|
_lift_to(LIFT_DRIVE_MM)
|
||||||
_set(status="done", step="")
|
_set(status="done", step="")
|
||||||
_say(say, "Done.", "다 했어요.")
|
if end:
|
||||||
|
_say(say, *end)
|
||||||
log("done")
|
log("done")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_fail(e, say)
|
_fail(e, say)
|
||||||
@@ -2555,12 +2562,12 @@ def give(say=None):
|
|||||||
"""Hand the held object to the person in front."""
|
"""Hand the held object to the person in front."""
|
||||||
if "give" not in motion.poses():
|
if "give" not in motion.poses():
|
||||||
raise FetchError("I haven't learned how to hand things over yet.")
|
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):
|
def place(say=None, on=None):
|
||||||
"""Put the held object on the table in front, or on the thing `on` names (brain.place_on)."""
|
"""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
|
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.")
|
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():
|
if then == "give" and "give" not in motion.poses():
|
||||||
raise FetchError("I haven't learned how to hand things over yet.")
|
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):
|
def _carry_to(dest, say, then=None, on=None):
|
||||||
@@ -2700,7 +2707,8 @@ def _run_steps(steps, say):
|
|||||||
else:
|
else:
|
||||||
_lift_to(LIFT_DRIVE_MM)
|
_lift_to(LIFT_DRIVE_MM)
|
||||||
_set(status="done", step="")
|
_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"])
|
log(_state["status"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_fail(e, say)
|
_fail(e, say)
|
||||||
|
|||||||
+1
-1
@@ -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]
|
names = [c[0] for c in calls]
|
||||||
assert st["status"] == "done" and not st["holding"], st
|
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 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
|
# receive: the hand held out, closes when the sensor sees something, the cup is carried on; place after it refused
|
||||||
reset()
|
reset()
|
||||||
hand["front"] = False
|
hand["front"] = False
|
||||||
|
|||||||
Reference in New Issue
Block a user