Improve follow and drive speed, reach toward the person, and name and repeat answers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 17:47:01 +09:00
co-authored by Claude Opus 5.5
parent e3fa2d95b3
commit da0f7f66ee
17 changed files with 149 additions and 37 deletions
+9
View File
@@ -117,6 +117,15 @@ assert f == fetch.SPEED_MIN and sent[-1].startswith(f"/api/set_params?max_speed_
assert all(float(c.split("=")[1].split("&")[0]) <= fetch.NAV_SPEED_MPS for c in sent)
f = fetch.set_speed(1.0)
assert sent[-1].startswith(f"/api/set_params?max_speed_linear={fetch.NAV_SPEED_MPS:g}") and f == 1.0
sent.clear() # every navigation move sends the speed first: the base forgets it
real_status = fetch.agv.status # at its restart (0.3 m/s of its own, 2026-10-28)
fetch.agv.status = lambda: {"move_status": "idle"}
fetch.agv.request = lambda cmd, timeout=3.0: sent.append(cmd) or {"status": "FAIL"}
fetch.agv.go("p1")
assert sent == [f"/api/set_params?max_speed_linear={fetch.NAV_SPEED_MPS:g}&max_speed_angular={fetch.NAV_TURN_RADS:g}",
"/api/move?marker=p1"], sent
fetch.agv.status = real_status
fetch.agv.request = lambda cmd, timeout=3.0: sent.append(cmd) or {}
assert driving.say_speed(1, 1.2, True) == "Okay, a bit faster: 120 percent of my normal speed."
assert driving.say_speed(1, fetch.SPEED_MAX, False) == "I'm already at my top speed."
+3
View File
@@ -53,6 +53,9 @@ assert ears.transcribe(AUDIO) == "" and asked == [None, "no prompt"], asked
# the name really said: kept
asked = fake({None: ("Hey Lumi.", "english", 0.9, -0.05), "no prompt": ("Hey, Liumu!", "english", 0.9, -0.8)})
assert ears.transcribe(AUDIO) == "Hey Lumi." and asked == [None, "no prompt"], asked
for plain in ("Луны.", "Думай.", "Lume"): # the name from the clip mic without the prompt (logs/heard 16:18:21)
asked = fake({None: ("Lumi.", "english", 0.9, -0.05), "no prompt": (plain, "russian", 0.5, -0.6)})
assert ears.transcribe(AUDIO) == "Lumi.", plain
# tagged Korean but written in Latin letters (understood() would refuse it): asked in English, the same words kept
asked = fake({None: ("Wait.", "korean", 0.6, -0.01), "en": ("Wait.", "english", None, -0.02)})
assert ears.transcribe(AUDIO) == "Wait." and ears.understood() and asked == [None, "en"], asked
+4
View File
@@ -93,6 +93,9 @@ class World:
self.t = now
def request(self, cmd):
if cmd.startswith("/api/set_params?"): # the base's cap on joy_control: follow raises it to FOLLOW_MAX_MS
self.cap = float(re.search(r"max_speed_linear=([\d.]+)", cmd)[1])
return {"status": "OK"}
m = re.match(r"/api/joy_control\?linear_velocity=(-?[\d.]+)&angular_velocity=(-?[\d.]+)$", cmd)
if not m:
forbid()
@@ -156,6 +159,7 @@ w = World(person=(2.2, 0.4), walk=(0.3, 0.05), walk_s=2.0)
follow.start(w.see, say)
time.sleep(6.0)
assert follow.running()
assert w.cap == follow.FOLLOW_MAX_MS, getattr(w, "cap", None) # else the base's own 0.3 caps it (2026-10-28)
assert follow.stop() and wait_end(0.5)
vs, ws = [c[1] for c in w.cmds], [c[2] for c in w.cmds]
assert max(vs) <= follow.FOLLOW_MAX_MS + 1e-9 and max(vs) > 0.85 * follow.FOLLOW_MAX_MS, max(vs) # capped, and it got there
+8
View File
@@ -150,6 +150,14 @@ if __name__ == "__main__":
b.history = [("what's a lidar?", "ACTION: none -\nA laser scanner.")]
assert b._after({"action": "quiet", "target": ""}, "에이, 거짓말하지 마")["action"] == "none"
assert b.again("one more time") == "same" and b._after({"action": "none", "target": ""}, "again")["action"] == "none"
# "What did you say?" repeats the LAST answer (a seeing one too), not the one before (live 2026-10-28 16:42)
b.history = [("What is in my hand?", "ACTION: none -\nYou're holding a grey remote in your right hand."),
("What is the color of my t-shirt?", "ACTION: none -\nYour t-shirt looks grey.")]
for t in ("What did you say?", "Sorry, what did you say?", "what was that?", "방금 뭐라고 했어?", "뭐라고 하셨어요?"):
assert b.again(t) == "same", t
assert list(b.repeat("What did you say?", "same"))[1:] == ["Your t-shirt looks grey."]
for t in ("What did you say about the arm?", "What do you say?", "what was that song?"):
assert not b.again(t), t
from assistant import driving # "more" right after a look: the head a step further (live 2026-10-23)
looked = driving.last_command([("Look at the left side.", "ACTION: look left")])
for said in ("More again.", "Look at more.", "Look at the left side more.", "more", "a bit more", "again", "더", "조금 더",
+2
View File
@@ -58,6 +58,8 @@ class Base:
if cmd == "/api/move/cancel":
self.status = "canceled" if self.status == "running" else self.status
return {"status": "OK"}
if cmd.startswith("/api/set_params?"): # the speed, sent before every move (robot/agv.py)
return {"status": "OK"}
if cmd == "/api/get_planned_path":
return {"results": {"path": [[self.x + k * 0.05, 0.0] for k in range(int((self.goal - self.x) / 0.05) + 1)]
if self.status == "running" else []}}
+4
View File
@@ -121,6 +121,10 @@ def through_answer():
def main():
bad = 0
for said in sum(qa.KINDS["name"][1].values(), []): # only asked: "nice to meet you" comes from the talk (LLM)
if re.search(r"nice to meet|반가", said, re.I):
bad += 1
print(f"FAIL name answer {said!r}: nobody introduced themselves")
for words, want in KIND.items():
got = qa.kind_of(words)
if got != want:
+27 -8
View File
@@ -177,24 +177,43 @@ assert moved == ["start_trip"]
follow.stop, fetch.stop = real_follow_stop, real_fetch_stop
# ---------- "reach out to me": toward the person; the waist turns to them with Greeter only too (the base stays) ----
assert lumi.reach_turn(None) is None and lumi.reach_turn(10.0) == 0.0
assert lumi.reach_turn(None) is None and lumi.reach_turn(8.0) == 0.0
assert lumi.reach_turn(-35.0) == -35.0 and lumi.reach_turn(35.0) == 35.0
reached = []
real_reach = fetch.reach
fetch.reach = lambda angle=0.0, say=None: reached.append(angle)
# the hand held out 21 deg right of the waist's front (give): the waist turns until the hand, not its front, points
# at the person (live 2026-10-28: turned straight at them, the hand went out beside them)
assert lumi.reach_turn(36.0, -21.0) == 57.0 and lumi.reach_turn(-15.0, -21.0) == 0.0 and lumi.reach_turn(0.0, -21.0) == 21.0
reached, looked = [], []
real_reach, real_bearing = fetch.reach, fetch.give_bearing
fetch.reach = lambda angle=0.0, say=None, look=None: reached.append(angle) or looked.append(look)
fetch.give_bearing = lambda: 0.0
L.fetch_finish = lambda how, **k: moved.append(how)
L.skill_thread, L.voice_trusted = None, False
person = types.SimpleNamespace(angle=35.0)
person = types.SimpleNamespace(angle=35.0, distance=1.0, id=8)
L.vision = types.SimpleNamespace(present=lambda t: False, near_angle=lambda a, d=25: None, only_person=lambda: person)
L.turn_head = lambda yaw=None, pitch=None, force=False: moved.append(("head", yaw))
for patrol, angle, want in ((False, 35.0, [35.0]), (True, 35.0, [35.0]), (False, -40.0, [-40.0]), (False, -12.0, [0.0]),
(True, -12.0, [0.0])):
for patrol, angle, want in ((False, 35.0, [35.0]), (True, 35.0, [35.0]), (False, -40.0, [-40.0]), (False, -8.0, [0.0]),
(True, -8.0, [0.0])):
L.modes.patrol, person.angle = patrol, angle
reached.clear(), said.clear(), moved.clear()
got = L.reach_out(False)
# a waist turn takes the head onto them (fetch._waist_to look); a head turn here raced it (looked away live)
head_cmds = [] if want[0] else [("head", lumi.HEAD_SIGN * angle)]
assert got and reached == want and moved == head_cmds and not said, (patrol, angle, reached, moved, said)
fetch.give_bearing = lambda: -21.0 # the hand right of the front: turned further, the head on them
person.angle = 36.0
reached.clear(), looked.clear()
assert L.reach_out(False) and reached == [57.0] and looked == [36.0], (reached, looked)
person.angle, person.distance = 0.0, 3.0 # far away: come to them first, then reach
came = []
L.vision.present = lambda t: True
L.come_to = lambda t: came.append(t.id) or setattr(t, "distance", 1.1)
reached.clear(), said.clear()
assert L.reach_out(False) and came == [8] and reached == [21.0], (came, reached)
person.distance, L.modes.drive = 3.0, False # far and driving switched off: asked to come, no reach
reached.clear(), said.clear(), came.clear()
assert L.reach_out(False) is None and not reached and not came and said == [lumi.COME_CLOSER_SAY[0]], (said, reached)
L.modes.drive, person.distance = True, 1.0
fetch.give_bearing = lambda: 0.0
L.turn_head = lambda *a, **k: moved.append("head")
L.vision = None # nobody seen, the voice's direction not trusted: ask
reached.clear(), said.clear()
@@ -212,7 +231,7 @@ said.clear(), moved.clear()
assert lumi.Lumi.arm_pose(L, "open") and moved == ["open"] and not said, (moved, said)
lumi.gripper.open_, fetch.check_hand = real_open, real_check
L.fetch_status = lambda: None
fetch.reach = real_reach
fetch.reach, fetch.give_bearing = real_reach, real_bearing
# ---------- the waist back to the front (waist_home): in place, Greeter only too; never with the arm out or a task ----
real = {n: getattr(fetch, n) for n in ("_waist_turn", "state", "_at_pose", "_waist_to")}
+4
View File
@@ -132,6 +132,10 @@ for heard in ("Let's make music.", "What is that?", "We make it.", "Let's.", "It
L.mic = Mic(U(heard))
assert not L.check_wake(), heard # 16:57:00, 17:05:03 live: "(no wake word)"
assert not lumi.call_only("Lumi, what time is it?") and not lumi.call_only("루미야 노래 불러줘")
for call in ("Lumi.", "Lumi?", "Hey, Lumi!", "루미야.", "루미야?", "루미!", "헤이 루미", "하이 루미야", "누미야"): # in a talk:
assert lumi.NAME_ONLY.match(call), call # "Yes?" / "네?" at once, no LLM
for heard in ("How are you?", "Hi.", "안녕하세요.", "루미야 노래 불러줘", "Lumi, wake up."):
assert not lumi.NAME_ONLY.match(heard), heard
assert not lumi.WAKE.search("I wake up at 7 every day") and not lumi.WAKE.search("일어나서 밥 먹었어") # no call
L = fresh() # "How are you?" is answered, not "Yes? How can I help?"
L.mic = Mic(U("How are you?"))