Understand requests for the held cup and keep a thin cup counted as held
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -2415,12 +2415,13 @@ REFUSE_OPEN = ("I won't open my hand while I'm holding something: it would fall.
|
||||
_GV = r"(?:give|gib|givv?e?|gi+ve|gve|hand|pass|deliver|bring)"
|
||||
_GIVE_TO = (r"(?:me|us|him|her|them|my \w+|this \w+|that \w+|the \w+(?: \w+)?|(?:the )?(?:left|right) (?:one|person|guy|lady))")
|
||||
GIVE_HELD_EN = re.compile(
|
||||
rf"\b{_GV}\s+(?:{_GIVE_TO}\s+)?(?:{_IT}|that one|this one|the (?:{_OBJ})s?|(?:(?:{_COL})\s+)?(?:{_OBJ})s?|what you(?:'?re| are)? hold(?:ing)?)\b"
|
||||
rf"\b{_GV}\s+(?:{_GIVE_TO}\s+)?(?:{_IT}|that one|this one|the (?:{_OBJ})s?|(?:(?:a|an|one)\s+)?(?:(?:{_COL})\s+)?(?:{_OBJ})s?|what you(?:'?re| are)? hold(?:ing)?)\b"
|
||||
r"(?!\s+(?:a|an|up|try|rest|go|shot|chance|break)\b)"
|
||||
rf"|^\W*(?:that|this|the \w+) one to me\b|\b{_GV}\s+(?:{_IT}\s+)?(?:over|back)\b|\b{_GV}\s+(?:{_IT}\s+)?to\s+(?!the (?:\w+ )?(?:table|chair|desk|floor)\b)\w"
|
||||
rf"|\b{_GV}\s+(?:me|us)\b(?!\s+(?:a|an|some|your|his|her|their|directions|time|space|the (?!(?:{_OBJ})s?\b|thing|one)\w+)\b)"
|
||||
rf"|\b(?:{_GV}|passed|handed)\s+(?:\w+\s+){{0,3}}?to (?:me|us)\b|\b(?:pop|drop|put|release|let go of|place)\b.*\b(?:in|into) my hands?\b|\brelease it to me\b"
|
||||
r"|(?<!your )(?<!my )(?<!the )(?<!a )(?<!his )(?<!her )(?<!our )(?<!ur )\b(?:give|hand|pass|gib|giv)(?: (?:it|me|over|it over|that|it to me))?\s*(?:해|하|좀|부탁|플리즈|가자)|\bgimme\b|\b(?:can|may|could) (?:i|my \w+)(?: please)? (?:have|get|take) (?:it|that|this|the \w+)\b|"
|
||||
rf"\b(?:can|may|could) i(?: please)? (?:have|get|take) (?:a|an|one) (?:(?:{_COL})\s+)?(?:{_OBJ})s?\b|"
|
||||
r"\bi'?d (?:like|love) to (?:have|take) (?:it|that|this)\b|\bi want (?:it|that|this|what you|the (?:\w+ ){1,2}you'?re holding)\b|"
|
||||
r"\bi'?ll take (?:it|that|this)\b(?! from here)|\bwould you mind (?:handing|giving|passing)\b|\blet me (?:have|take|hold) (?:it|that|this)\b|"
|
||||
r"\b(?:that'?s|it'?s) mine\b|^\W*(?:the \w+,?\s+)?to me\b|^\W*over here\b|^\W*(?:okay,? )?(?:and )?now me\W*$", re.I)
|
||||
@@ -2607,8 +2608,8 @@ def held_give(text, markers=()):
|
||||
"""With something in the hand: the words ask to hand it over, to the speaker or someone near ("give it to me",
|
||||
"gib me please", "give it to the lady next to me", "그거 me 줘", "pass 해 줘 그거", "우리 손녀한테 주시오"). Not a
|
||||
condition, a cancel, a past, words to someone else, a trip to a marker ("bring it to James at booth A")."""
|
||||
if re.search(r"^\W*(?:(?:okay|ok|alright|네|그럼|자)\W+)*(?:제가|내가)\s*(?:받을|가져갈)(?:게|께)요?\W*$", CALLING.sub("", text or "")):
|
||||
return True # "제가 가져갈게요": I'll take it (from the hand)
|
||||
if re.search(r"^\W*(?:(?:okay|ok|alright|네|그럼|자)\W+)*(?:(?:제가|내가)\s*)?(?:받을|가져갈)(?:게|께)요?\W*$", CALLING.sub("", text or "")):
|
||||
return True # "제가 가져갈게요", "받을게": I'll take it (from the hand)
|
||||
if re.fullmatch(rf"\W*(?:(?:그거|이거|저거|그걸|이걸)\s+)?(?:우리\s+|저\s+|이\s+)?(?!(?:{ACT_KO})\s)[가-힣]+\s+(?:좀\s+)?(?:(?:그거|이거)\s+)?드려\W*", # not "인사 드려", "전화 드려"
|
||||
CALLING.sub("", wording.ko_plain(text or "")).strip()):
|
||||
return True # "할머니 드려라", "선생님 드리세요": 드리다 gives to the one named
|
||||
|
||||
+8
-2
@@ -1119,7 +1119,8 @@ class Lumi:
|
||||
if target in detour.SAY:
|
||||
self.detour(target, speak=False)
|
||||
elif action == "arm":
|
||||
self.arm_pose(target)
|
||||
if self.arm_pose(target) is None:
|
||||
return "refused" # the reason is said: not the model's words
|
||||
elif action in ("pick", "put", "move_object"):
|
||||
self.object_task(action, target, confirm=False) # the LLM's words already confirmed it
|
||||
elif action == "fetch": # parse the person's own words, never the LLM's
|
||||
@@ -2959,7 +2960,8 @@ class Lumi:
|
||||
if action == "arm":
|
||||
done = {"open": ("Okay, opening my hand.", "네, 손을 펼게요."), "close": ("Okay, closing my hand.", "네, 손을 쥘게요.")}
|
||||
words = None
|
||||
if target in done: # said while the gripper already moves
|
||||
if target in done and not (target == "open" and self.held_now()): # said while the gripper moves; a
|
||||
# refused open (holding) says only why
|
||||
words = threading.Thread(target=mouth.say, args=(done[target][0] if en else done[target][1],), daemon=True)
|
||||
words.start()
|
||||
ok = self.arm_pose(target)
|
||||
@@ -3190,6 +3192,10 @@ class Lumi:
|
||||
return
|
||||
if head_["action"] not in ("none", "end"):
|
||||
limited = self.act(head_["action"], head_["target"])
|
||||
if limited == "refused": # said why: not the model's "okay"
|
||||
gen.close()
|
||||
self.keep_listening()
|
||||
return
|
||||
if head_["action"] in ("look", "lift") and limited in LIMIT_SAY: # at its end: said so, not the model's
|
||||
gen.close() # "okay"
|
||||
said = LIMIT_SAY[limited][self.lang != "en"]
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ TOOL = 1 # set_digital_output type: 0 cabinet, 1 tool (TIO),
|
||||
CLOSE_DO, OPEN_DO = 0, 1 # DO_1, DO_2 (0-based)
|
||||
CLOSED_AI = 400 # AI_1 above this = closed on something (open reads 130-165; an 82 mm metal cup
|
||||
# held in the cup fingers reads ~2200-2300, 2026-10-13)
|
||||
EMPTY_AI = 4000 # closed above this = nothing between the fingers (these fingers empty: 4084-4158; an 84 mm
|
||||
# rim cup held ~4 cm down read 3902, 2026-10-29)
|
||||
EMPTY_AI = 4040 # closed above this = nothing between the fingers (these fingers empty: 4084-4158; an 84 mm
|
||||
# rim cup held 3681-3969, 2026-10-29: the belly closes to 77 mm, that cup is ~78-81 there)
|
||||
AI_OPEN, AI_SHUT = 140.0, 4160.0 # AI_1 fully open / closed on nothing (2026-10-19)
|
||||
# inner gap (mm) between the fingers, (open, closed), measured by the owner (docs/gripper/README.md; the neck and the
|
||||
# straight part "shank" not measured again, the earlier ones kept); the gap is taken as linear in AI_1
|
||||
|
||||
+25
-4
@@ -16,9 +16,15 @@ GIVE_EN = ["give it to me", "give me that", "hand it over", "pass it to me", "gi
|
||||
"givv it over to me", "can I have it?", "I'll take it", "hand me the cup", "give the cup to me",
|
||||
"you give me please", "give it to him", "give it to her", "give it to the lady next to me",
|
||||
"give it to my sister", "pass that to my friend", "hand it to the guy in black", "release it into my hand",
|
||||
"give 해 줘", "hand over 해 주세요", "pass 해 줘", "give me 해 줘", "would you mind handing it to me?"]
|
||||
"give 해 줘", "hand over 해 주세요", "pass 해 줘", "give me 해 줘", "would you mind handing it to me?",
|
||||
"give me a cup", "Give me a cup.", "give me the cup", "give the cup", "give a cup", "give me a red cup",
|
||||
"hand me a cup", "pass me a cup", "can I have the cup", "can I have a cup?", "could I get a cup",
|
||||
"gimme a cup", "giv me a cup", "give me a mug", "pass me the cup"]
|
||||
GIVE_KO = ["줘", "이리 줘", "나 줘", "그거 줘", "그거 me 줘", "나한테 주세요", "저한테 주시겠어요", "이리 주십시오", "건네 줘",
|
||||
"넘겨 줘", "그분 드려", "저 사람한테 건네줘요", "우리 손녀한테 주시오", "나한테 주이소", "그거 이리 주게", "내놔"]
|
||||
"넘겨 줘", "그분 드려", "저 사람한테 건네줘요", "우리 손녀한테 주시오", "나한테 주이소", "그거 이리 주게", "내놔",
|
||||
"컵 줘", "컵 주세요", "그 컵 줘", "컵 건네 줘", "컵 하나 줘", "컵 좀 주실래요?",
|
||||
"give me the 컵", "그 cup 줘"]
|
||||
TAKE_KO = ["받을게", "받을게요", "제가 받을게요", "내가 받을게", "제가 가져갈게요"] # "I'll take it": the whole sentence
|
||||
PUT_DOWN = ["put it on the table", "rest it on the table", "place it down gently", "put it here", "drop it here",
|
||||
"set it down", "lower it onto the table", "테이블에 놔 줘", "여기 올려 주세요", "탁자 위에 놓아 주시겠습니까",
|
||||
"테이블에 put 해", "여기 put 해 줘", "책상 위에 올려 줘"]
|
||||
@@ -49,6 +55,9 @@ def main():
|
||||
text = f"{call}{words}{tail}"
|
||||
if brain.hand_request(text, True, None, MARKERS) != ("give", None):
|
||||
bad.append((text, "give", brain.hand_request(text, True, None, MARKERS)))
|
||||
for call, words in itertools.product(CALLS, TAKE_KO):
|
||||
if brain.hand_request(call + words, True, None, MARKERS) != ("give", None):
|
||||
bad.append((call + words, "give", brain.hand_request(call + words, True, None, MARKERS)))
|
||||
for call, words in itertools.product(CALLS, PUT_DOWN):
|
||||
got = brain.hand_request(call + words, True, None, MARKERS)
|
||||
if not got or got[0] != "place":
|
||||
@@ -71,12 +80,24 @@ def main():
|
||||
any(brain._resolve(m, MARKERS) not in (None, "here")
|
||||
for m in __import__("re").finditer(brain._place_re(MARKERS), brain._norm(brain.give_clause(text)))):
|
||||
bad.append((text, "give, no drive", brain.hand_request(text, True, None, MARKERS)))
|
||||
# the same words held and not, by the route both voice and the dashboard's Command box take (lumi.route): the held
|
||||
# thing handed over; with the hand empty a pick and give stays a pick and give
|
||||
from assistant import lumi
|
||||
for words in ["give me a cup", "Give me a cup.", "give me the cup", "hand me a cup", "pass me the cup",
|
||||
"give me a red cup", "컵 줘", "컵 주세요", "그 컵 줘", "컵 건네 줘", "컵 하나 줘"]:
|
||||
held, empty = lumi.route(words, MARKERS, brain.Brain(), True), lumi.route(words, MARKERS, brain.Brain(), False)
|
||||
if held != ("hand", (("give", None), True)) or empty[0] != "mission" or \
|
||||
[st["do"] for st in empty[1][0]] != ["pick", "give"]:
|
||||
bad.append((words, "held: give; empty: pick, give", (held, empty)))
|
||||
for words in ["give me a hand", "give me a break", "give me a minute", "can I have a look", "can I have a word"]:
|
||||
if brain.held_give(words, MARKERS):
|
||||
bad.append((words, "no hand", brain.hand_request(words, True, None, MARKERS)))
|
||||
for words in ["고개 원위치", "머리 원위치", "head back to centre"]:
|
||||
if brain.intent(words, MARKERS) != ("look", "center"):
|
||||
bad.append((words, "look center", brain.intent(words, MARKERS)))
|
||||
assert not bad, "\n".join(f"{t!r}: want {w}, got {g}" for t, w, g in bad)
|
||||
n = len(CALLS) * len(TAILS) * len(GIVE_EN + GIVE_KO) + len(CALLS) * (len(PUT_DOWN) + len(PUT_BACK)) + \
|
||||
len(REACH) + len(FOLD) + len(NOT_FOLD) + len(NOT_GIVE) + 6
|
||||
n = len(CALLS) * len(TAILS) * len(GIVE_EN + GIVE_KO) + len(CALLS) * (len(TAKE_KO) + len(PUT_DOWN) + len(PUT_BACK)) + \
|
||||
len(REACH) + len(FOLD) + len(NOT_FOLD) + len(NOT_GIVE) + 22
|
||||
print(f"held hand ok ({n} cases)")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user