Keep words said after Lumi's own voice, search wider for callers and follow round blocked turns
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,7 @@ def near(a, b, tol=1.0):
|
||||
fetch._clear()
|
||||
assert not fetch.aiming()
|
||||
heads = []
|
||||
lumi.head.turn = lambda yaw, pitch=None: heads.append(round(yaw))
|
||||
lumi.head.turn = lambda yaw, pitch=None, **k: heads.append(round(yaw))
|
||||
L = lumi.Lumi.__new__(lumi.Lumi)
|
||||
L.turn_head(20)
|
||||
time.sleep(0.2)
|
||||
|
||||
@@ -137,6 +137,11 @@ _mouth._recent[:] = [(time.time() - 20, "Yes?"), (time.time() - 4, "Go to p10, w
|
||||
from assistant.lumi import ANSWER_ECHO_S, Lumi as _Lumi
|
||||
assert not _Lumi.own_echo("Yes. Yes.", ANSWER_ECHO_S) and _Lumi.own_echo("Yes. Yes.")
|
||||
assert _Lumi.own_echo("Is that right?", ANSWER_ECHO_S)
|
||||
# the clip mic heard the end of Lumi's answer and the order in one utterance: the order is kept (2026-10-30)
|
||||
_mouth._recent[:] = [(time.time() - 2, "Yes, I can see you about 1.8 metres away.")]
|
||||
assert _Lumi.after_own_voice("Yes, I can see you about 1.8 metres away. Let's come here.") == "Let's come here."
|
||||
assert _Lumi.after_own_voice("I can see you about 1.8 metres away.") is None # all Lumi's: dropped
|
||||
assert _Lumi.after_own_voice("Let's come here.") is None # no echo to cut
|
||||
_mouth._recent.clear()
|
||||
# ---------- questions about what Lumi is doing: answered from the state, not by the LLM ----------
|
||||
from assistant.lumi import STATUS_Q
|
||||
|
||||
+31
-1
@@ -126,7 +126,7 @@ class World:
|
||||
d, a = self.sight(self.person_at())
|
||||
self.dist.append(d)
|
||||
a -= body.pos[1] # lumi.Vision gives waist-frame angles
|
||||
if self.fov and abs(a - body.pos[2]) > HALF_FOV:
|
||||
if self.fov and abs((a - body.pos[2] + 180.0) % 360.0 - 180.0) > HALF_FOV:
|
||||
return None
|
||||
return d, a, 0.0, self.look
|
||||
|
||||
@@ -675,6 +675,36 @@ yaws = [m[4] for m in body.moves if m[1] == "follow head"]
|
||||
assert yaws and all(y > 0 for y in yaws[1:]), yaws
|
||||
print("right behind: one side")
|
||||
|
||||
# right behind beside a wall (live 2026-10-30): the arm blocked turning left, the base turns right round to them
|
||||
# (head ahead, out of view a while), never back the blocked way; blocked both ways: it stops and says so
|
||||
blocked_dir = [1.0]
|
||||
fetch.turn_hits = lambda d: (-5.08, 11.54) if d * blocked_dir[0] > 0 or not blocked_dir[0] else None
|
||||
said.clear()
|
||||
body.pos = [50.0, 0.0, 180.0, follow.HEAD_PITCH] # "look at the back side": the head right behind
|
||||
head._call = real_body
|
||||
w = World(person=(1.3 * math.cos(math.radians(186.0)), 1.3 * math.sin(math.radians(186.0))), fov=True)
|
||||
follow.start(w.see, say)
|
||||
t = time.time()
|
||||
while time.time() - t < 15.0 and not (abs(w.sight(w.person_at())[1]) < follow.TURN_DEAD_DEG + 1.0 and w.cmds
|
||||
and w.cmds[-1][2] == 0.0):
|
||||
time.sleep(0.05)
|
||||
follow.stop()
|
||||
assert wait_end(3.0) and not said, said
|
||||
head._call = body.call
|
||||
turn = math.degrees(w.th)
|
||||
assert -200.0 < turn < -150.0, turn # round to the right
|
||||
assert max(c[2] for c in w.cmds) < 0.1, max(c[2] for c in w.cmds) # never back toward the wall
|
||||
assert abs(w.sight(w.person_at())[1]) < follow.TURN_DEAD_DEG + 1.0, w.sight(w.person_at())
|
||||
print(f"right behind, left blocked: turned {turn:.0f} deg the other way, facing them")
|
||||
blocked_dir[0] = 0.0 # both ways blocked
|
||||
body.pos = [50.0, 0.0, 180.0, follow.HEAD_PITCH]
|
||||
w = World(person=(1.3 * math.cos(math.radians(186.0)), 1.3 * math.sin(math.radians(186.0))), fov=True)
|
||||
follow.start(w.see, say)
|
||||
assert wait_end(3.0) and any("can't turn" in x for x in said), said
|
||||
assert all(c[2] == 0.0 for c in w.cmds), w.cmds
|
||||
fetch.turn_hits = turn_hits
|
||||
print("right behind, both ways blocked: stops, says so")
|
||||
|
||||
# lumi: act("stop") ends following; follow_me locks onto the person talking, refuses when it must
|
||||
lumi.agv.cancel = lumi.skills.cancel = lumi.motion.stop = lambda: None
|
||||
w = World(person=(3.0, 0.0))
|
||||
|
||||
@@ -119,7 +119,7 @@ run["on"] = False
|
||||
L = fresh("What time is it?", -70.0)
|
||||
assert L.talk_turn() and heard == ["What time is it?"] and L.current is L.vision.stranger, (heard, L.current)
|
||||
# "look at me" / "이쪽 봐": the cameras first: the person seen (-60), whatever the voice says
|
||||
lumi.head.turn = lambda yaw, pitch=None: done.append(("head turn", round(yaw)))
|
||||
lumi.head.turn = lambda yaw, pitch=None, **k: done.append(("head turn", round(yaw)))
|
||||
lumi.LOOK_ME_SETTLE_S = 0.0
|
||||
|
||||
|
||||
|
||||
@@ -242,4 +242,11 @@ assert b._after(brain.Brain._action("ACTION: look left", "yes", []), "yes")["act
|
||||
assert b._after(brain.Brain._action("ACTION: look left", "네", []), "네")["action"] == "look"
|
||||
b.history = [("what is over there?", "ACTION: none -\nThe stage.")]
|
||||
assert b._after(brain.Brain._action("ACTION: look left", "yes", []), "yes").get("held") # no offer: talk only
|
||||
# "let's go charging" (2026-10-30: the LLM took it as a remark, "I'll be ready to go when you are!")
|
||||
CM = ["home", "charge", "p1"]
|
||||
for t in ["Let's go charging.", "Go charging.", "Lumi, go charging", "Let's go recharging", "go charge", "충전하러 가"]:
|
||||
assert brain.intent(t, CM) == ("go_to", "charge"), (t, brain.intent(t, CM))
|
||||
assert brain.intent("Let's go charging.", ["home", "p1"]) == ("go_to", "home") # no charger on the map: home
|
||||
for t in ["I want to go charging later", "Do you go charging at night?", "don't go charging"]:
|
||||
assert brain.intent(t, CM) is None, t
|
||||
print("intents ok")
|
||||
|
||||
@@ -6,7 +6,7 @@ import no_robot # noqa: F401 any connection
|
||||
from assistant import lumi
|
||||
|
||||
turns, pitches = [], []
|
||||
lumi.head.turn = lambda yaw, pitch=None: (turns.append(round(yaw)), pitches.append(pitch))
|
||||
lumi.head.turn = lambda yaw, pitch=None, **k: (turns.append(round(yaw)), pitches.append(pitch))
|
||||
lumi.LOOK_ME_SETTLE_S = 0.0
|
||||
lumi.waist_turned = lambda: 0.0 # the waist at the front unless a case says otherwise
|
||||
|
||||
@@ -52,16 +52,16 @@ for v in (128.0, -122.0, 120.0, -120.0):
|
||||
# several seen, none at the voice: the one nearest where the head looks, not one on the voice's side
|
||||
assert look([(-30.0, 1.0), (35.0, 1.0)], voice=150.0, gaze=-25.0) == [-30], turns
|
||||
# nobody seen: the head looks to the voice's side first, finds the person there
|
||||
assert look([], voice=-55.0, after=[(-50.0, 0.9)]) == [-60, -50], turns
|
||||
assert look([], voice=-55.0, after=[(-50.0, 0.9)]) == [-110, -50], turns
|
||||
# nobody seen, no voice: looks around and back
|
||||
assert look([], gaze=10.0) == [60, -60, 10], turns
|
||||
assert look([], gaze=10.0) == [110, -110, 10], turns
|
||||
# nobody seen, the voice unsure but on the right: the right first, not the side the head happens to face (2026-10-30)
|
||||
L = lumi.Lumi.__new__(lumi.Lumi)
|
||||
L.vision, L.current, L.voice_angle, L.voice_trusted, L.voice_guess = Vision([], [(-50.0, 2.0)]), None, 0.0, False, -64.0
|
||||
L.det_yaw = lambda: 0.0
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert turns == [-60, -50], turns
|
||||
assert turns == [-110, -50], turns
|
||||
|
||||
# "Lumi" with the voice read on the left, nobody there: the head turns there, then to the person seen, else back
|
||||
heads = []
|
||||
@@ -160,7 +160,7 @@ L.modes = type("M", (), {"patrol": False})()
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert waist["calls"] == [(120, True, 170.0)], waist
|
||||
assert turns == [60, -60, 50, 0], turns # looked around first; 170 - 120 left for the head; nobody: back
|
||||
assert turns == [110, -110, 50, 0], turns # looked around first; 170 - 120 left for the head; nobody: back
|
||||
assert not L.voice_trusted and L.voice_at == 0.0 # a direction measured before the turn is never used again
|
||||
print("look me behind: ok")
|
||||
|
||||
@@ -186,13 +186,13 @@ L.det_yaw = lambda: 0.0
|
||||
L.modes = type("M", (), {"patrol": False})()
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert waist["calls"] == [(120, True, 150.0)] and turns == [60, -60, 30, 0], (waist, turns)
|
||||
assert waist["calls"] == [(120, True, 150.0)] and turns == [110, -110, 30, 0], (waist, turns)
|
||||
# ... and a voice read in front with nobody there is taken as its mirror behind (-55 -> -125)
|
||||
waist.update(at=0.0, calls=[])
|
||||
L.voice_angle, L.voice_trusted, L.voice_guess = -55.0, True, -55.0
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert waist["calls"] == [(-120, True, -125.0)] and turns == [-60, 60, -5, 0], (waist, turns)
|
||||
assert waist["calls"] == [(-120, True, -125.0)] and turns == [-110, 110, -5, 0], (waist, turns)
|
||||
print("look me from behind, unsure voice: ok")
|
||||
|
||||
# the waist left turned at -73 deg, the caller on the other side (2026-10-30): nobody in either head look, so the waist
|
||||
@@ -207,5 +207,5 @@ L.det_yaw = lambda: 0.0
|
||||
L.modes = type("M", (), {"patrol": False})()
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert turns == [60, -60, -60, -50] and waist["calls"] == [], (turns, waist)
|
||||
assert turns == [110, -110, -110, -50] and waist["calls"] == [], (turns, waist)
|
||||
print("look me with the waist turned: ok")
|
||||
|
||||
Reference in New Issue
Block a user