From 122e7dec0c31a00f01c0e2987e7830005ae07ce2 Mon Sep 17 00:00:00 2001 From: Cutshion Date: Tue, 27 Oct 2026 07:09:37 +0900 Subject: [PATCH] Improve quick answers and keep the held name after a failed move Co-Authored-By: Claude Opus 5.5 --- assistant/bank_words/facts.py | 18 ++++++++++++++++++ assistant/bank_words/questions.py | 15 +++++++++++++++ assistant/quick_answers.py | 15 +++++++++------ tasks/fetch.py | 13 +++++-------- tests/qa_eval.py | 30 ++++++++++++++++++++++++++++-- tests/test_quick_answers.py | 8 ++++++-- tests/test_reach.py | 8 ++++++++ 7 files changed, 89 insertions(+), 18 deletions(-) diff --git a/assistant/bank_words/facts.py b/assistant/bank_words/facts.py index f6b4659..c4383e5 100644 --- a/assistant/bank_words/facts.py +++ b/assistant/bank_words/facts.py @@ -510,3 +510,21 @@ QUICK_KINDS["faces"] = ([ QUICK["no"] += ["what can your camera see", "what do you see with your camera", "카메라로 뭐 보여", "카메라에 뭐 보여요", "카메라 켜 줘", "camera on", "카메라 돌아가고 있어요", "do you recognize me", "나 알아봐", "내 얼굴 기억해", "remember my face", "카메라 고장 났어", "is your camera on", "카메라 켜져 있어요"] + +# night 5: the wheeled base (how Lumi moves) +QUICK_KINDS["wheels"] = ([ + "do you have wheels", "how many wheels do you have", "how do you move", "how do you get around", "do you roll or walk", + "what's your base", "what kind of base do you have", "how do you drive", "are you on wheels", "what moves you around", + "what motors do you have", "is it a differential drive", "wheels?", "how many wheel you have", + "바퀴 있어", "바퀴 있어요", "바퀴 있니", "바퀴 있습니까", "바퀴 있노", "바퀴 몇 개야", "바퀴 몇 개예요", "바퀴 몇 개입니까", "바퀴가 몇 개고", + "바퀴로 움직여", "바퀴로 움직여요", "바퀴로 다니세요", "바퀴로 가는 거야", "어떻게 움직여", "어떻게 움직여요", "어떻게 움직이세요", + "어떻게 움직입니까", "어떻게 다녀요", "어떻게 이동해요", "이동은 어떻게 해", "뭘로 움직여", "뭘로 다니노", "어떻게 움직이노", + "베이스는 어떻게 생겼어요", "모터 몇 개예요", "구동 방식이 뭐예요", "wheel 몇 개야", "너 바퀴 달렸어", +], {"en": ["I drive on a wheeled base: two drive wheels with hub motors, a differential drive. I can't walk; I roll, normally at 0.6 m per second.", + "On wheels: my base has two drive wheels with hub motors. It finds its way with a lidar map and can climb a step of up to 1.5 cm."], + "ko": ["저는 바퀴 달린 베이스로 움직여요. 허브 모터가 달린 구동 바퀴 두 개로 가는 차동 구동 방식이에요. 걷지는 못하고, 보통 초속 0.6m로 다녀요.", + "바퀴로 다녀요. 베이스에 허브 모터 구동 바퀴가 두 개 있고, 라이다 지도로 길을 찾아요. 1.5cm 정도의 턱은 넘을 수 있어요."]}) +QUICK["cameras"] = ["do you have eyes", "where are your eyes", "what are your eyes", "how many eyes do you have", "눈이 어디야", "눈 어디 있어요", + "눈 있어", "눈 있어요", "눈이 몇 개야", "눈은 뭐예요", "눈 대신 뭐 있어요", "eyes 어디야"] +QUICK["no"] += ["what are you made of", "뭘로 만들어졌어", "재질이 뭐예요", "무슨 재료로 만들었어요", "what material are you", + "close your eyes", "눈 감아", "open your eyes", "눈 떠"] diff --git a/assistant/bank_words/questions.py b/assistant/bank_words/questions.py index c5da91d..638def3 100644 --- a/assistant/bank_words/questions.py +++ b/assistant/bank_words/questions.py @@ -777,3 +777,18 @@ QUICK["tts"] += ["what speech synthesis do you use", "what voice synthesis do yo QUICK["no"] += ["can you open the window", "open the window", "창문 열어 줘", "창문 열 수 있어", "turn on the internet", "인터넷 켜 줘", "connect to the wifi", "와이파이 연결해 줘", "여기 안전해", "is it safe here", "이 동네 안전해요", "is this area safe", "바닥 안전해", "is the floor safe"] +QUICK["tts"] += ["do you have a speaker", "where is your speaker", "where's your mouth", "do you have a mouth", "how do you talk without a mouth", + "스피커 어디 있어요", "스피커 있어", "스피커 있어요", "입이 어디야", "입 있어", "소리는 어디서 나와요", "목소리 어디서 나와"] +QUICK["computer"] += ["where is your brain", "where's your brain", "where is your computer", "brain where", "뇌가 어디야", "두뇌는 어디 있어요", + "컴퓨터 어디 들어 있어", "컴퓨터는 어디에 있어요"] +# round 8 (own new phrasings: body and abilities kinds) +QUICK["navigation"] = QUICK.get("navigation", []) + ["how do you find your way around", "how do you get around the room", "how do you know your way", "어떻게 길을 알아요", + "길은 어떻게 아세요", "길 안 잃어버려"] +QUICK["obstacles"] = QUICK.get("obstacles", []) + _ko(["사람 있으면 멈춰", "앞에 사람 있으면 서", "사람 나타나면 멈춰", "뭐가 막고 있으면 멈춰"], ["", "요", "?", "요?", "니", "나요"]) + [ + "do you stop for people", "will you stop if someone is in the way", "do you stop when someone walks in front of you"] +QUICK["grow"] = QUICK.get("grow", []) + ["can you raise your body", "can you lift your body", "can your body go up", "몸 올라가요", "몸통 올릴 수 있어요", "상체 올라가요"] +QUICK["teach"] = QUICK.get("teach", []) + ["can i teach you something new", "can i teach you", "can people teach you things", "can you be taught", "내가 가르쳐 줄 수 있어", + "가르쳐 주면 배워요", "가르치면 배울 수 있으세요"] +QUICK["no"] += ["여기 어느 나라야", "여기 어느 나라예요", "이 나라 어디야", "what country is this", "which country are we in", "where are we", + "what does cutshion mean", "쿳션이 무슨 뜻이야", "쿳션 뜻이 뭐예요", "cutshion 이름 뜻", "추석 며칠 남았어", "설날 며칠 남았어요", + "how many days until new year", "how many days to chuseok", "생일까지 며칠 남았어"] diff --git a/assistant/quick_answers.py b/assistant/quick_answers.py index d7a1d9a..1ae61d0 100644 --- a/assistant/quick_answers.py +++ b/assistant/quick_answers.py @@ -86,7 +86,7 @@ KINDS = { "저는 쿳션이라는 한국 로봇 회사에서 왔어요."]}), "height": ([ "how tall are you", "what's your height", "what is your height", "how tall is lumi", "how tall is this robot", - "how high are you", "your height?", "hau tall are you", "how tall r u", "how tall can you get", + "how high are you", "your height?", "hau tall are you", "how tall r u", "how tall are you in centimeters", "키가 몇이야", "키가 몇이에요", "키 얼마야", "키가 얼마나 돼요", "너 키 몇이야", "키 몇 센티예요", "이 로봇 키가 얼마예요", "키가 몇 센치고", "키 얼마나 크노", "얼마나 커요", "키 몇이에요", "your 키 몇이야", @@ -293,12 +293,13 @@ EVENT_TIME = re.compile(r"\b(?:what time|what day|which day|what date) (?:does|d OTHER_FIRM = re.compile(r"\b(?:openai|google|samsung|apple|lg|microsoft|tesla|nvidia|hyundai|naver|kakao|meta|amazon|sony)\b|" r"오픈 ?ai|오픈에이아이|구글|삼성|애플|엘지|마이크로소프트|테슬라|엔비디아|현대|네이버|카카오|메타|아마존|소니", re.I) OTHER_ROBOT = re.compile(r"\b(?:jaka|jacka|k1[wl]?|kargo|peitian|tusk)\b|자카|작카|节卡|페이톈|페이티엔|터스크|" - r"\b(?:that|the other|other|another|those) robots?\b|(?:저|그|옆에|옆의|옆|다른) ?로봇", re.I) + r"\b(?:that|the other|other|another|those) robots?\b|(?:저|그|옆에|옆의|옆집|옆|다른) ?로봇", re.I) OTHER_DAY = re.compile(r"\b(?:tomorrow|yesterday|next (?:week|month|year|monday|tuesday|wednesday|thursday|friday|saturday|sunday)|" r"last (?:week|month|year))\b|내일|어제|모레|그저께|글피|다음 ?주|지난 ?주|다음 ?달|지난 ?달|내년|" r"(?:크리스마스|성탄절?)(?:가|는|이|은)? ?(?:무슨|몇) ?요일|\b(?:what|which) day (?:is|was|will be) christmas\b", re.I) NAMES_LUMI = re.compile(r"\b(?:you|your|yourself|u|ur|lumi)\b|(?:^|\s)(?:너|넌|니|네|당신|루미|본인|자기)", re.I) +NEEDS = {"days_to_christmas": r"크리스마스|성탄|christmas|xmas|x-mas|산타|santa"} # a kind only when its word is said ("추석 며칠 남았어?") _bank = None _named = None _exact_kinds = None @@ -360,7 +361,7 @@ REMARK = re.compile(r"(?:(?:어+|아+|음+|um+|uh+)\s+)?(?:quick question|just ( r"(?:하나 ?|뭐 ?하나 ?|질문 ?하나 ?)?(?:여쭤|여쭈어|물어) ?(?:봐|바|보)도 ?(?:될까요|돼요|되나요|됩니까|될까|돼)|" r"질문 ?(?:하나 ?)?(?:해도 ?(?:될까요|돼요|되나요)|있어요|있습니다|있는데요?)|궁금한 ?게 ?있(?:는데요?|어요|습니다)|" r"하나 ?묻겠습니다|실례합니다|실례지만|(?:may|can|could) i ask (?:you )?(?:something|a question)|" - r"i have a question|one question)", re.I) + r"i have a question|one question|(?:오|아|와|oh|wow)? ?(?:그래|그렇구나|그렇군요|정말|진짜|really|i see|대박|wow|cool|nice))", re.I) # a sentence that only asks to be told or says why: "Christmas 얼마나 남았어요? 알고 싶어요." SENTENCES = re.compile(r"(?<=[??!])\s*|(?<=\.)\s+") @@ -432,7 +433,8 @@ def guarded(text, history=()): if re.search(r"충전\S*\s*(?:\S+\s+)?(?:얼마나|몇\s*시간|몇\s*분)\s*(?:\S+\s+)?걸|완충|충전\s*시간|" r"\bhow long\b.*\b(?:to (?:re)?charge|(?:charging|recharging|a (?:full )?charge) takes?)\b|\bcharg\w* time\b", t, re.I): return "charging time" # "충전하는 데 얼마나 걸려?": not known (the LLM says so), not the battery life - if REQUEST.search(t) or re.search(r"(?:시지요|시죠|십시오|하시오|가시게|오시게|하시게|라 마|원위치)\W*$", t): + if REQUEST.search(t) or re.search(r"(? kind "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", + "컴퍼니 오픈 언제예요?": "co_founded", "참, 로봇 양반, 이름이 무슨 뜻이야?": "name_meaning", "Your voice, what program?": "tts", "들어 있는 인공지능 무엇인지 알려 주십시오": "model", + "실례합니다. 네 이름 무엇인지 알려 주십시오": "name", "바퀴 몇 개야?": "wheels", "do you have eyes?": "cameras", + "스피커 어디 있어요?": "tts", "Is it safe for kids to be near you?": "safety", } IN_TALK = { # words after TALK -> kind or None "how old are you?": "age", "who made you?": "maker", "what's your name?": "name", @@ -63,7 +65,9 @@ NEVER = [ # no talk before: never a quick answer "손! 손 내밀어!", "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?", "저기 평가 항목, 루미, 오늘 무슨 요일이야?", + "위험해", "손에 뭐 있어?", "what can your camera see?", "do you recognize me?", "저기 평가 항목, 루미, 오늘 무슨 요일이야?", "홀로 가십시오", "근데 너 몇 살이야? 아 됐고, 검정 머그컵 잡으시지요", + "Lumi, could you turn your head ten degrees down?", "이 로봇 마 저한테 손 쫌 주실래요? 알겄제", "내일 며칠이야?", "오늘 미세먼지 어때?", + "충전하는 데 얼마나 걸려?", "이거 몇 살짜리 장난감이야?", ] 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|젬마", diff --git a/tests/test_reach.py b/tests/test_reach.py index 8c5f471..c3f898e 100644 --- a/tests/test_reach.py +++ b/tests/test_reach.py @@ -193,6 +193,14 @@ 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 live puts of 2026-10-26 18:51-18:56 (lift 0, cup top -186 on a table at -336): put down at (-43, 618) with no +# turn, as live; (-349, 647) beside it and the far table point (-213, 797) are out of reach from where it stood +skills._held.update(top_mm=-186.0, yaw=0.0, tips=False, below=40.0) +got = next(skills.place_options(-43.0, 618.0, -183.0, list(LOOK)), None) +assert got and abs(skills.yaw_of(got[0][1][1])) < 1, got +for xy in ((-349.0, 647.0), (-213.0, 797.0)): + assert next(skills.place_options(*xy, -183.0, list(LOOK)), None) is None, xy + # ---------- the controller confirms only the chosen plan (a stand-in behind arm.cmd here) ---------- asked, shift = [], {"mm": 0.0} def controller(name, **a):