Improve side reaches, quick answers and Korean typed commands

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 02:11:27 +09:00
co-authored by Claude Opus 5.5
parent d72eb52f66
commit 3f392343bf
22 changed files with 630 additions and 120 deletions
+57 -27
View File
@@ -8,6 +8,7 @@ leaves to the LLM. Nothing moves; only the embedding server is asked.
.venv/bin/python tests/bank_check.py --blind # tests/blind/train/*.py and tests/blind/r2/train/*.py too
.venv/bin/python tests/bank_check.py -v # print every hit too, not only the wrong ones
.venv/bin/python tests/bank_check.py --blind --rounds r4,r6 --out bank_check_a3.md # some rounds, own report
.venv/bin/python tests/bank_check.py --blind --stress --fast --jobs 4 --rounds r6,r8,r9 # the bank alone, quick
A case reaches the bank when command_check's rules (lumi.route without the bank) leave it to the LLM.
-> logs/bank_check.md
@@ -102,12 +103,13 @@ def judge(expect, got):
ROUNDS = [] # --rounds r1,r2: only these blind rounds (r1 = tests/blind/train)
KNOWN = {}
QUERIES = ROOT / "data" / "bank_check_queries.npz" # the cases' embeddings, kept between runs (a re-run embeds only
# the words it has not seen: minutes instead of an hour)
def _cached_embed():
"""knowledge.embed with the case texts' vectors kept in QUERIES; returns a function that saves them."""
"""knowledge.embed with the case texts' vectors kept in QUERIES; returns the dict of known vectors."""
import numpy as np
from assistant import knowledge
real, known = knowledge.embed, {}
@@ -116,40 +118,34 @@ def _cached_embed():
known = dict(zip(z["texts"].tolist(), z["vecs"]))
except (OSError, ValueError, KeyError):
pass
n0 = len(known)
def embed(texts):
new = [t for t in dict.fromkeys(texts) if t not in known]
if new:
known.update(zip(new, real(new)))
return np.array([known[t] for t in texts])
def save():
if len(known) > n0:
tmp = QUERIES.with_suffix(".tmp.npz")
np.savez(tmp, texts=np.array(list(known)), vecs=np.array(list(known.values())))
tmp.replace(QUERIES)
knowledge.embed = embed
return save
return known
def main(args):
global OUT
if "--rounds" in args:
ROUNDS[:] = args[args.index("--rounds") + 1].split(",")
if "--out" in args:
OUT = OUT.with_name(args[args.index("--out") + 1])
marks = markers()
save_queries = _cached_embed()
stress, verbose = "--stress" in args, "-v" in args
from assistant import steps
def _save_queries(known):
import numpy as np
tmp = QUERIES.with_suffix(".tmp.npz")
np.savez(tmp, texts=np.array(list(known)), vecs=np.array(list(known.values())))
tmp.replace(QUERIES)
def _run(job):
"""One share of the cases: (counts by set, wrong, hits, read times, missed, new query vectors)."""
part, stress, fast, marks = job
known = KNOWN # the embed wrapper's own dict (in a forked job: its copy)
n0 = set(known)
from assistant import detour, steps
steps._ollama = lambda *a: (_ for _ in ()).throw(command_check.NoLLM())
real = intent_bank.read
by = collections.defaultdict(collections.Counter)
wrong, hits, times, missed = [], [], [], []
from assistant import detour
no_stuck = detour.recent
for name, text, expect, state, mk, before, *goal in cases("--blind" in args):
for name, text, expect, state, mk, before, *goal in part:
mk = mk or marks
stuck = {"goal": goal[0]} if state == "stuck" and goal else None # right after a blocked drive
detour.recent = lambda: stuck
@@ -158,9 +154,9 @@ def main(args):
b.history.append(tuple(before))
brain.FORCED_LANG["lang"] = "ko" if brain.HANGUL.search(text) else "en"
intent_bank.read = lambda *a, **k: None # the rules alone first
how = stuck and detour.read(text, mk, stuck["goal"])
try:
ruled = f"detour {how}" if how else command_check.rules(text, state, mk, b)
how = stuck and not fast and detour.read(text, mk, stuck["goal"])
ruled = "llm?" if fast else f"detour {how}" if how else command_check.rules(text, state, mk, b)
except command_check.NoLLM:
ruled = "llm?"
finally:
@@ -185,13 +181,47 @@ def main(args):
else:
by[name][tag] += 1
hits.append(f"- [{name}/{state}] {text!r} -> {g}")
detour.recent = no_stuck
save_queries()
return by, wrong, hits, times, missed, {t: v for t, v in known.items() if t not in n0}
def main(args):
"""--fast: the rules are not run (0.8 s a case): wrong and llm are the same, hit and agree are counted together as
hit. --jobs N: N processes (the embedding server is shared)."""
global OUT
if "--rounds" in args:
ROUNDS[:] = args[args.index("--rounds") + 1].split(",")
if "--out" in args:
OUT = OUT.with_name(args[args.index("--out") + 1])
marks = markers()
global KNOWN
known = KNOWN = _cached_embed()
stress, verbose, fast = "--stress" in args, "-v" in args, "--fast" in args
jobs = int(args[args.index("--jobs") + 1]) if "--jobs" in args else 1
intent_bank._load(), intent_bank._codes() # loaded once, shared by the forked jobs
every = cases("--blind" in args)
parts = [(every[i::jobs], stress, fast, marks) for i in range(jobs)]
if jobs > 1:
import multiprocessing
with multiprocessing.get_context("fork").Pool(jobs) as pool:
done = pool.map(_run, parts)
else:
done = [_run(parts[0])]
by = collections.defaultdict(collections.Counter)
wrong, hits, times, missed = [], [], [], []
for b, w, h, t, m, v in done:
for k, c in b.items():
by[k].update(c)
wrong += w
hits += h
times += t
missed += m
known.update(v)
_save_queries(known)
for c in by.values():
c["cases"] = sum(c.values())
total = sum(by.values(), collections.Counter())
ms = sorted(times)
lines = [f"# Bank check ({time.strftime('%Y-%m-%d %H:%M')}{', stress' if stress else ''})", "",
lines = [f"# Bank check ({time.strftime('%Y-%m-%d %H:%M')}{', stress' if stress else ''}{', fast' if fast else ''})", "",
f"bank: {len(intent_bank.examples())} wordings; read time median {1000 * ms[len(ms) // 2]:.0f} ms, "
f"max {1000 * ms[-1]:.0f} ms over {len(ms)} reads" if ms else "", "",
"hit: the rules left it to the LLM, the bank answered right; agree: the rules answered and the bank "
+2 -1
View File
@@ -799,7 +799,8 @@ def _why_class(r):
return "knocked over: cup wider than ~88 mm (its chord does not pass the hooks' neck)"
return "knocked over (finger landed on the cup)"
w = r.get("why") or r["result"]
for key, name in (("too small", "cup too small (physical)"), ("too big", "cup too big (physical)"),
for key, name in (("too low for me", "table too low for the camera at lift 0 (physical)"),
("too small", "cup too small (physical)"), ("too big", "cup too big (physical)"),
("too thin", "cup too thin (physical)"), ("can't see", "not seen"),
("looked all around", "not seen"), ("still can't reach", "out of reach after every way"),
("way to get close", "no way to get close"), ("not answering", "controller not answering"),
+24
View File
@@ -131,6 +131,30 @@ POS.update({ # night 4, round 2
NEG += ["move forward 4 meters", "앞으로 5미터 가 줘", "grab the paper cup", "종이컵 좀 집어 주세요", "how old is the mayor?",
"사장님 연세가 어떻게 되세요?", "who leads samsung?"]
POS.update({ # night 5: openers, asides, Konglish, 하게체, run-together words, guesses
"safety": ["Is it safe to stand next to you?", "아이들 옆에 있어도 안전합니까?", "너 위험하지 않아?", "are you dangerous for kids?"],
"cameras": ["How many cameras do you have?", "카메라 뭐 쓰세요?", "what camera model do you use?", "카메라 몇 대 있어요?"],
"faces": ["Do you do face recognition?", "얼굴 알아볼 수 있어요?", "can you remember faces?"],
"mics": ["How many microphones do you have?", "마이크 몇 개 있어요?", "how far away can you hear?"],
"tts": ["What text to speech do you use?", "목소리는 뭘로 내세요?", "너 목소리 진짜 사람이야?"],
"stt": ["Which speech recognition do you use?", "음성 인식 뭐 쓰십니까?", "말은 어떻게 알아들으세요?"],
})
POS["age"] += ["궁금한 게, 브로, 너 몇 살이야?", "루미 군, 너 몇 살인가?", "에이지가 몇이야?", "you're about five, right?"]
POS["height"] += ["농사일에 쓸라 카는데, 로봇아, 키가 몇이에요?", "하이트가 얼마야?", "키 how much?", "너 2미터지?"]
POS["maker"] += ["메이커가 어디야?", "LG가 만들었지?", "아야 루미, 어느 회사가 너를 만들었는교?"]
POS["battery_life"] += ["배터리 수명 얼마나 되는가?", "battery life 얼마야?", "하루 종일 가나?"]
NEG += ["내일 며칠이야?", "어제 무슨 요일이었어?", "what's the date tomorrow?", "what day was yesterday?", "크리스마스가 무슨 요일이야?",
"what day is christmas this year?", "다음 주 금요일이 며칠이야?", "몇 시에 문 닫아요?", "what time does the store close?",
"how tall is namsan tower?", "롯데타워 높이가 얼마야?", "BTS 나이가 어떻게 돼?", "how old is the president?", "how heavy is an elephant?",
"코끼리 무게가 얼마야?", "how fast is a cheetah?", "치타 얼마나 빨라?", "핸드폰 배터리 얼마나 가요?", "how long does a phone battery last?",
"who made the iphone?", "who invented robots?", "브라질은 무슨 언어 써?", "what language do they speak in Brazil?",
"what's your mom's name?", "너네 엄마 이름 뭐야?", "what's my name?", "내 나이 맞혀 봐", "몇 살로 보여요?",
"오픈AI 대표 누구야?", "환율 얼마야?", "1달러 얼마야?", "what does JAKA stand for?", "자카 로봇 몇 대 팔렸어?",
"follow me, how tall are you?", "이리 와. 몇 살이야?", "take the cup, then tell me the time", "손 흔들고 몇 시인지 알려 줘",
"what's your name? where's the toilet?", "how are you and what time is it?", "언제?", "how do you know?", "really? how old?",
"그거 몇 킬로야?", "that one, how heavy?", "저 로봇 이름 뭐야?", "옆에 로봇은 몇 살이야?", "what's the name of that robot?"]
def run():
ok = bad = miss = 0
lines = []
+79 -36
View File
@@ -1,50 +1,93 @@
"""Every first utterance (commands: 'text' with no 'before'; dialogues: first turn 'say') of the blind train sets
through quick_answers.kind_of with no history: list the hits for review.
"""The blind train sets through quick_answers.kind_of with no history (the quick lane alone, no rules before it).
python tests/qa_sweep.py # train, r2-r4, r6, r8, r9, r10 train
python tests/qa_sweep.py r9 r10 # only these rounds' train sets
python tests/qa_sweep.py # first words (commands: 'text' with no 'before'; dialogues: first turn
# 'say') of train, r2-r4, r6, r8, r9, r10: the hits, for review
python tests/qa_sweep.py r9 r10 # only these rounds' train sets
python tests/qa_sweep.py --questions r6 r8 r9 # questions_world: want-quick answered at once, and every quick
# answer that misses the case's must / says its must_not (wrong)
python tests/qa_sweep.py --questions -v r9 # ... and the questions left to the LLM
The words are embedded in batches first (the embedding server is shared), then read from memory.
"""
import glob, importlib, sys
import glob, importlib, re, sys
sys.path.insert(0, __file__.rsplit("/tests/", 1)[0])
from assistant import quick_answers as qa
ROUNDS = sys.argv[1:] or ["train", "r2", "r3", "r4", "r6", "r8", "r9", "r10"]
from assistant import knowledge
from assistant import knowledge, quick_answers as qa
QUESTIONS, VERBOSE = "--questions" in sys.argv, "-v" in sys.argv
ROUNDS = [a for a in sys.argv[1:] if not a.startswith("-")] or \
(["r6", "r8", "r9"] if QUESTIONS else ["train", "r2", "r3", "r4", "r6", "r8", "r9", "r10"])
_embed, _known = knowledge.embed, {}
def embed(texts): # one batch for all the first words first, then from memory
def embed(texts): # batches first, then from memory
new = [t for t in dict.fromkeys(texts) if t not in _known]
if new:
_known.update(zip(new, _embed(new)))
return [_known[t] for t in texts]
knowledge.embed = embed
seen = set()
hits = 0
todo = []
for r in ROUNDS:
def pieces(t):
"""The words kind_of may embed for t: the whole, each sentence, after a connective, after the last comma."""
t = qa._tidy(t)
out = [t] + qa.SENTENCES.split(t)
m = qa.CONNECT.match(t)
rest = t[m.end():] if m else t
out += [rest, rest.rpartition(",")[2]]
return [qa._core(p) for p in out if p.strip()]
def sets(r, questions):
for f in sorted(glob.glob("tests/blind/train/*.py" if r == "train" else f"tests/blind/{r}/train/*.py")):
mod = f[:-3].replace("/", ".")
if mod.endswith("__init__") or "questions_world" in mod: # those are scored by blind_check
if f.endswith("__init__.py") or ("questions_world" in f) != questions:
continue
m = importlib.import_module(mod)
texts = []
for c in getattr(m, "CASES", []):
if isinstance(c, dict) and c.get("text") and not c.get("before") and not c.get("ctx"):
texts.append((c["text"], c.get("expect") or c.get("kind")))
for d in getattr(m, "DIALOGUES", []):
t = d.get("turns") or []
if t and t[0].get("say"):
texts.append((t[0]["say"], t[0].get("expect_action")))
for t, e in texts:
if t not in seen:
seen.add(t)
todo.append((t, e, f"{r}/{mod.split('.')[-1]}"))
embed([qa._core(qa._tidy(t)) for t, _, _ in todo])
for t, e, where in todo:
k = qa.kind_of(t)
if k:
hits += 1
print(f"{k:12} {where:22} {t!r} want={e}")
print("texts", len(seen), "quick", hits)
yield f, importlib.import_module(f[:-3].replace("/", "."))
def first_words():
seen, todo = set(), []
for r in ROUNDS:
for f, m in sets(r, False):
texts = [(c["text"], c.get("expect") or c.get("kind")) for c in getattr(m, "CASES", [])
if isinstance(c, dict) and c.get("text") and not c.get("before") and not c.get("ctx")]
texts += [(d["turns"][0]["say"], d["turns"][0].get("expect_action")) for d in getattr(m, "DIALOGUES", [])
if d.get("turns") and d["turns"][0].get("say")]
for t, e in texts:
if t not in seen:
seen.add(t)
todo.append((t, e, f"{r}/{f.rsplit('/', 1)[1][:-3]}"))
embed([p for t, _, _ in todo for p in pieces(t)])
hits = 0
for t, e, where in todo:
k = qa.kind_of(t)
if k:
hits += 1
print(f"{k:12} {where:22} {t!r} want={e}")
print("texts", len(seen), "quick", hits)
def questions():
from tests import company_check
cases = [c for r in ROUNDS for _, m in sets(r, True) for c in m.CASES]
embed([p for c in cases for p in pieces(c["text"])])
want = hit = wrong = 0
for c in cases:
k = qa.kind_of(c["text"])
quick = c["expect"] == "quick"
want += quick
if k is None:
if quick and VERBOSE:
print(f"miss [{c['q']}] {c['text']!r}")
continue
hit += quick
lang = "ko" if c["lang"] == "ko" or re.search(r"[가-힣]", c["text"]) and c["lang"] != "en" else "en"
lines = [qa.clock_words(x, lang) for x in qa.KINDS[k][1][lang]]
probs = sorted({p for x in lines for p in company_check.problems(c, lang, x)})
if c["expect"].startswith("lookup:"):
probs.append(f"want {c['expect']}")
if probs:
wrong += 1
print(f"WRONG [{c['q']}, {c['expect']}] {c['text']!r} -> {k} {probs[:2]}")
print(f"{' '.join(ROUNDS)}: cases {len(cases)}, want quick {want}, answered at once {hit}, wrong quick answers {wrong}")
knowledge.embed = embed
questions() if QUESTIONS else first_words()
+6
View File
@@ -31,6 +31,10 @@ READS = [ # (words, holding, (action, target))
("컵 집으시게", False, ("pick", "cup")),
("fetch me that cup", False, ("fetch", "fetch me that cup")),
("컵 챙겨 와 주세요", False, ("fetch", "컵 챙겨 와 주세요")),
("손 흔들어 줍서", False, ("wave", "")),
("팔 거두시구려", False, ("arm", "fold")),
("손내밀어봐", False, ("arm", "reach")),
("your job now is to fold your arm", False, ("arm", "fold")),
]
NOT = [ # (words, holding, motions it must not be): a side word or a hand word is never a drive / turn / look
("pick up the cup on your left", False, ("turn", "move", "look", "go_to", "wave", "arm")),
@@ -45,6 +49,8 @@ NEVER = [ # no motion at all from the bank
("the cup on your left is mine", False), ("왼쪽에 컵 있어", False), ("you picked the wrong cup", False),
("팔이 어디까지 닿아?", False), ("why are you waving", False), ("아까 악수했잖아", False),
("shake your head", False), ("pick up the pace", False), ("give it up for lumi", False),
("thanks for the wave", False), ("악수해 줘서 고마워요", False), ("close your eyes", False), ("의자 들어 줄래?", False),
("the kids want to wave at you", False), ("can my son shake your hand", False),
]
+2
View File
@@ -329,6 +329,8 @@ READ = [ # the owner's Korean cup / delivery list (2026-10-26 18:40), then mor
("put it on the white table on your right", True, "place right white table"), ("set it down on your left", True, "place left table"),
("excuse me robot, first look me, then follow me", False, "chain"), ("야 루미, 오른쪽 보고 손 흔들어라", False, "chain"),
("hello robot, first turn left, then lower yourself", False, "chain"),
("악수하고 lower yourself 해 주세요", False, "chain"), ("오늘 날짜 알리고 look left 해 주세요", False, "chain"),
("wave 하고 look left 해 줘", False, "chain"),
("컵이랑 같이 p5로 가", False, "fetch cup here>p5 hold"), ("컵 하고 같이 exit 가 줘", False, "fetch cup here>exit hold"),
("컵 가지고 p5에서 기다려", False, "pick cup; go p5; wait"), ("컵 들고 p5에 가 있어", False, "pick cup; go p5; wait"),
("이 컵 p5까지 좀 날라 줘", False, "fetch cup here>p5 hold"), ("컵 좀 p5로 옮겨 줘", False, "fetch cup here>p5 hold"),
+16
View File
@@ -388,4 +388,20 @@ assert not cups()
st = run(fetch.start, TASK)
assert any("backing off" in l for l in st["log"]) and st["status"] == "holding", st["log"]
assert not any("look around" in l.lower() for l in st["log"]), st["log"]
# ---------- X1 round 5: a cup beside Lumi on a table at its side, below both cameras: after the whole search, back
# off, turn to what is near and look ----------
for edge, cup in ((0.42, (0.15, 0.6)), (0.7, (0.15, 0.85))):
setup(None, table=(-0.4, 0.5, edge, edge + 0.8))
room["cups"].append({"id": 1, "map": np.array(cup)})
assert not cups()
st = run(fetch.start, TASK)
assert st["status"] == "holding", st["log"]
print("beside, table", edge, "m:", [l.split(" ", 1)[1] for l in st["log"] if "near me" in l or "front of me" in l])
real_around = fetch._look_around # the whole search sees nothing (waist turns refused)
fetch._look_around = lambda *a, **k: None
setup(None, table=(-0.4, 0.5, 0.7, 1.5))
room["cups"].append({"id": 1, "map": np.array([0.15, 0.85])})
st = run(fetch.start, TASK)
fetch._look_around = real_around
assert st["status"] == "holding" and any("near me at +90 deg" in l for l in st["log"]), st["log"]
print("fetch ways ok")
+4 -2
View File
@@ -15,7 +15,9 @@ def short(s):
if w[0] == "pick":
return {"do": "pick", "object": w[-1], "colour": w[1] if len(w) == 3 else None}
if w[0] == "receive":
return {"do": "receive", "object": w[1], **({"wait_s": steps.WAIT_GIVE_S} if w[-1] == "wait" else {})}
col = w.pop(1) if len(w) > 2 and w[1] in steps.brain.COLOURS.values() else None # "receive red cup wait"
return {"do": "receive", "object": w[1], **({"wait_s": steps.WAIT_GIVE_S} if w[-1] == "wait" else {}),
**({"colour": col} if col else {})}
if w[0] == "wait":
if w[1:2] == ["order"]:
return {"do": "wait", "s": steps.WAIT_ORDER_S, "until": "instruction"}
@@ -101,7 +103,7 @@ STEPS = {
"point one에서 빨간 컵 가져와서 P5에 있는 사람한테 줘": "go p1 | pick red cup | go p5 | give",
"take the banana to the main stage and give it too Mr. Kim": "pick banana | go Main_Stage | give Mr. Kim",
"에구 하얀 컵 집어서 p4로 가져가서 테이블에 놔, 응": "pick white cup | go p4 | place dining table",
"p4에 가서 누가 빨간 컵 주면 받아 가지고 와": "go p4 | receive cup wait | go here",
"p4에 가서 누가 빨간 컵 주면 받아 가지고 와": "go p4 | receive red cup wait | go here",
"p4 가서 십 초 wait 하고 와": "go p4 | wait 10 | go here",
# a new order on the way (lumi.mission_talk reads it with steps.read)
"no, bring it to p4 instead": "go p4",
+18
View File
@@ -27,11 +27,23 @@ KIND = { # words (no talk before) -> kind
"are you a Korean robot?": "country", "어느 나라 로봇이에요?": "country", "what computer do you use?": "computer",
"관절이 몇 개예요?": "dof", "음성 인식 뭐 써요?": "stt", "how fast do you answer?": "reply_time",
"where are you used?": "used_where", "인터넷 써요?": "internet",
# openers, asides, remarks, connectives, stutters, run-together words (night 5)
"hello robot, you name is?": "name", "루미 님, 배터리 수명 얼마나 됩니까?": "battery_life", "누미야 너 몇 살이야": "age",
"실례합니다. 몇 살입니까?": "age", "하나 여쭤봐도 될까요? 너 이름 어떻게 되세요?": "name", "너 살아 있어? ㅎㅎ": "robot",
"Christmas 얼마나 남았어요? 알고 싶어요.": "days_to_christmas", "얘 몇 살일까? 너 몇 살이야?": "age",
"형 비켜 봐, 키가 몇이에요?": "height", "My new friend Lumi, how heavy are you?": "weight", "아 그리고 몇 개 국어 해?": "languages",
"그러면 키가 몇이에요?": "height", "키가 얼— 얼마예요?": "height", "너 너 몇 살이야": "age", "이보게 루미, 지금 몇 시인가?": "time_now",
"누가너를만들었습니까?": "maker", "루미군,오늘무슨요일인가?": "date_today", "키가 얼마인지 알려 주시겠어요?": "height",
"You're Siri, aren't you?": "name", "너 2미터지?": "height", "Samsung made you, right?": "maker", "이번 달 알려 줘.": "date_today",
"에이지가 몇이야?": "age", "스피드가 얼마야?": "speed", "메이커가 어디야?": "maker", "do you have the time?": "time_now",
"아이들 옆에 있어도 안전해?": "safety", "what cameras do you have?": "cameras", "얼굴 인식 돼요?": "faces",
"컴퍼니 오픈 언제예요?": "co_founded", "참, 로봇 양반, 이름이 무슨 뜻이야?": "name_meaning", "Your voice, what program?": "tts",
}
IN_TALK = { # words after TALK -> kind or None
"how old are you?": "age", "who made you?": "maker", "what's your name?": "name",
"how old?": None, "몇 살이에요?": None, "hello": None, "why?": None, "really?": None, "and you?": None,
"who runs it?": None, "how many people work there?": None, "진짜?": None, "왜요?": None, "너는?": None, "무겁습니까?": None, "어떤 로봇이요?": None,
"그럼 몇 살이에요?": None, "and how old?": None, "근데 너 몇 살이야?": "age",
}
NEVER = [ # no talk before: never a quick answer
"can you see me?", "what am I holding?", "what colour is my shirt?", "how old do I look?", "how tall am I?",
@@ -46,6 +58,12 @@ NEVER = [ # no talk before: never a quick answer
"로봇 미국 회사 맞아요?",
"when is your birthday?", "생일이 언제예요?", "완충까지 몇 시간이에요?", "how slow can you drive?", "what are you doing?",
"너 자카 로봇이야?", "can you hear me?", "키 줄여 줘", "Price of the ice cream robot?",
# night 5: other things' facts, commands among sentences or before a comma, fragments
"몇씨야? 아니 몇 살로 보여?", "Is it Samsung? Who made you?", "What's your name? Where's the toilet?", "fold it fold it! your arm!",
"손! 손 내밀어!", "go the souvenir shop, ehh, tell me time", "Turn your head toward me, young robot.", "배터리, 아 아니, 지금 뭐 해?",
"오픈AI 대표 누군가?", "1달러에 원화로 얼만가?", "롯데타워 하이트 얼마야?", "K1 정밀도 어때요?", "PEITIAN 로봇의 가반하중은 얼마입니까?",
"배터리 수명이 몇 년이에요?", "배터리 얼만가?", "do you have time?", "언제?", "How do you know?",
"위험해", "손에 뭐 있어?", "what can your camera see?", "do you recognize me?", "저기 평가 항목, 루미, 오늘 무슨 요일이야?",
]
FACT = {"chatgpt": r"\bno\b|아니", "name": r"lumi|루미", "who": r"lumi|루미", "age": r"\b2\b|two|두 살", "maker": r"cutshion|쿳션",
"height": r"146", "battery_life": r"10", "languages": r"english|영어", "model": r"gemma|젬마",
+25
View File
@@ -121,6 +121,15 @@ for r, b in ((600, 60), (600, -60), (550, 90), (600, -100), (730, 7), (720, 25))
for r, b in ((1000, 0), (950, 40)): # too far for any waist turn: the base has to move
o = around(r, b)
assert all(trusted(fetch.turned(o, d)) is None for d in fetch.waist_for(o)), (r, b)
# the live cases of 2026-10-26 with trusted turns only: from here, after a waist turn, or the base moves (none)
LIVE = (((262, 774, -189), "base"), ((267, 763, -188), "base"), ((260, 722, -186), "base"), # missed at -45 / -30
((300, 621, -191), "waist"), ((-99, 738, -181), "waist"), # missed at -30 / carry line jumped at -30
((-141, 869, -186), "base"), ((-117, 960, -186), "base"), # across the table / far
((-104, 694, -186), "here"), ((-73, 588, -186), "here"), ((-96, 598, -260), "here")) # carried / picked
for (x, y, top), how in LIVE:
o = cup(x, y, top)
got = "here" if trusted(o) else "waist" if any(trusted(fetch.turned(o, d)) for d in fetch.waist_for(o)) else "base"
assert got == how, ((x, y, top), got, how)
body["waist"] = 100.0 # the waist near its limit (140): no turn past it
assert all(body["waist"] + d <= 140.0 for d in fetch.waist_for(around(600, 80)))
body["waist"] = -20.31
@@ -168,6 +177,22 @@ calls.clear()
scene["cup"] = around(600, -70) # the cup was moved away while the waist turned
skills.look = lambda *a, **k: []
assert fetch._waist_reach(task, scene["cup"], None) is None and any(c[0] == "waist" for c in calls)
# ---------- put down: where no joint move from look keeps the cup upright, a straight line to above the spot does
skills._held.clear()
skills._held.update(top_mm=-300.0, yaw=0.0, tips=False, below=40.0)
opts = list(skills.place_options(200.0, 500.0, -300.0, list(LOOK)))
assert opts and all(w[0][0] == "above place (straight)" for w, _ in opts), [w[0][0] for w, _ in opts]
way, ja = opts[0]
assert np.allclose(kinematics.pose(ja)[:3], way[0][1][:3], atol=0.05)
moved = []
real_lin, real_jm, real_place = skills.motion.move_linear, skills.motion.move_joints, skills._do_place
skills.motion.move_linear = lambda **k: moved.append(("line", k["target"]))
skills.motion.move_joints = lambda j, s: moved.append(("joints", j))
skills._do_place = lambda w: moved.append(("down",))
skills.place_turned(way, ja)
assert moved[0] == ("line", way[0][1]) and moved[1] == ("down",), moved
skills.motion.move_linear, skills.motion.move_joints, skills._do_place = real_lin, real_jm, real_place
# ---------- the controller confirms only the chosen plan (a stand-in behind arm.cmd here) ----------
asked, shift = [], {"mm": 0.0}
def controller(name, **a):
+2 -1
View File
@@ -26,7 +26,8 @@ def short(s):
if do == "receive" and w[1:] == ["hand"]:
return {"do": "receive", "object": None, "from_hand": True} # "take this from me": from the person's hand
if do == "receive":
out = {"do": "receive", "object": w[1] if len(w) > 1 and w[1] != "wait" else None}
col = w.pop(1) if len(w) > 2 and w[1] in steps.brain.COLOURS.values() else None # "receive red cup wait"
out = {"do": "receive", "object": w[1] if len(w) > 1 and w[1] != "wait" else None, **({"colour": col} if col else {})}
if "wait" in w:
out["wait_s"] = float(w[-1]) if w[-1] != "wait" else steps.WAIT_GIVE_S
return out
+13
View File
@@ -54,6 +54,10 @@ def main():
("", "부엉이 그거 목 을매나 돌아가노?", ["부엉이"]),
("", "너 그거 할 수 있어?", []),
("", "루미 그거 뭐야?", []),
("", "블루투스 이름은 왜 그렇게 지었나?", ["블루투스"]),
("", "에펠탑의 높이는 얼마예요?", ["에펠탑"]),
("", "너 이름은 뭐야?", []),
("", "루미 이름은 누가 지었어?", []),
("문어는 피가 무슨 색이야?", "심장은 몇 개고?", ["문어", "심장"])]:
b = brain.Brain()
b.history = [(before, "ACTION: none -\n네.")] if before else []
@@ -72,6 +76,15 @@ def main():
assert picked[-1] and all(e[0] in brain.WORLD_EXAMPLES for e in picked[-1]), "world: world examples only"
brain._examples("이름이 뭐예요?")
assert any(e[0] == "name" for e in picked[-1])
import io
import json
from assistant import llm_direct # the model's own empty thought block is never said
def sse(pieces):
return io.BytesIO(b"".join(b"data: " + json.dumps({"content": p}).encode() + b"\n" for p in pieces))
assert list(llm_direct._pieces(sse(["<|channel>", "thought", "\n", "<channel|>", "No, ", "she didn't."]))) == \
["No, ", "she didn't."]
assert list(llm_direct._pieces(sse(["<|channel>thought\n<channel|>Yes."]))) == ["Yes."]
assert list(llm_direct._pieces(sse(["ACTION: none -\n", "Hi."]))) == ["ACTION: none -\n", "Hi."]
print("talk: ok")