Improve speaker targeting and assistant stability
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,9 @@ class Vision:
|
||||
|
||||
visible = present
|
||||
|
||||
def anyone(self):
|
||||
return bool(self.tracks)
|
||||
|
||||
def only_seen(self):
|
||||
return self.tracks[0] if len(self.tracks) == 1 else None
|
||||
|
||||
@@ -196,4 +199,28 @@ L.turn_head = lambda yaw=None, pitch=None, force=False: heads.append((round(yaw)
|
||||
L.find_caller(50.0, True)
|
||||
lumi.time.sleep = real_sleep
|
||||
assert heads == [(S * 50, True), (S * 38, True)], heads
|
||||
# ---- who gave the order (speaker_track): never the wrong one of several people ----
|
||||
owner, other = Track(20, 60.0, 4.0), Track(21, 0.0, 2.0)
|
||||
L = fresh(owner, other) # the owner far behind the head's turn, someone else near ahead:
|
||||
L._yaw = S * 60.0 # the head looks at the owner ("look at me" left it there)
|
||||
L.voice_trusted = False
|
||||
assert L.speaker_track() is owner and not said
|
||||
L = fresh(owner, other)
|
||||
L.voice_trusted, L.voice_angle = True, 2.0 # a sure voice wins over the look
|
||||
assert L.speaker_track() is other
|
||||
L = fresh(owner, other) # the voice unsure, the head between them, nobody talked with:
|
||||
L.voice_trusted, L.voice_angle, L._yaw = False, 5.0, S * 30.0 # asked to raise a hand, the one who does is taken
|
||||
up.append(60.0)
|
||||
assert L.speaker_track() is owner and said == [lumi.RAISE_HAND_SAY[0]], said
|
||||
up.clear()
|
||||
L = fresh(owner, other) # nobody raises a hand: nobody is taken, it says so
|
||||
L.voice_trusted, L._yaw, real_raise, lumi.RAISE_HAND_S = False, S * 30.0, lumi.RAISE_HAND_S, 0.3
|
||||
assert L.speaker_track() is None and said == [lumi.RAISE_HAND_SAY[0], lumi.WHO_ASKED_SAY[0]], said
|
||||
goals = [] # ... and "come here" then drives nowhere, no "can't see you"
|
||||
lumi.agv.go_point = lambda *a: goals.append(a) or (True, "")
|
||||
L = fresh(owner, other)
|
||||
L.voice_trusted, L._yaw = False, S * 30.0
|
||||
L.come_to(None)
|
||||
assert not goals and said == [lumi.RAISE_HAND_SAY[0], lumi.WHO_ASKED_SAY[0]], said
|
||||
lumi.RAISE_HAND_S, lumi.agv.go_point = real_raise, (lambda *a: (True, ""))
|
||||
print("focus ok")
|
||||
|
||||
@@ -182,6 +182,7 @@ print("too close: stands still")
|
||||
|
||||
# every stop word ends it at once (lumi.follow_stop, as answer() calls it); then "follow me" starts again
|
||||
L = lumi.Lumi.__new__(lumi.Lumi)
|
||||
L._yaw, L._yaw_time = 0.0, float("inf") # the head at the front (det_yaw reads no body)
|
||||
stops = []
|
||||
L.stop_all = lambda: stops.append(1)
|
||||
STOP = ["stop", "Stop!", "enough", "that's enough", "wait", "wait, Lumi", "stay here", "you can stop", "hold on",
|
||||
@@ -664,8 +665,10 @@ L.current, started[:] = None, []
|
||||
L.follow_me()
|
||||
assert not started and "can't see you" in spoken[-1]
|
||||
L.find_caller = lambda angle, trusted: track # where the voice came from
|
||||
L.voice_trusted = True # (only a sure direction counts)
|
||||
L.follow_me()
|
||||
assert started and L.current is track
|
||||
L.voice_trusted = False
|
||||
started.clear()
|
||||
L.modes.drive = False
|
||||
L.follow_me()
|
||||
@@ -675,6 +678,7 @@ L.follow_me()
|
||||
assert not started and "on a task" in spoken[-1]
|
||||
L.skill_busy, real_ready = (lambda: False), follow.ready
|
||||
follow.ready = lambda: fetch.ARM_UNSEEN # checked before "Okay"
|
||||
L.voice_trusted = True # the person found by the voice
|
||||
L.follow_me()
|
||||
assert not started and spoken[-1] == fetch.ARM_UNSEEN[0] and not any("follow you" in x for x in spoken[-1:])
|
||||
follow.ready = real_ready
|
||||
|
||||
@@ -27,6 +27,7 @@ arm_state = {"power": 1, "enable": 1}
|
||||
lumi.arm.cmd = lambda name, **a: dict(arm_state) if name == "get_robot_state" else forbid()
|
||||
|
||||
L = lumi.Lumi.__new__(lumi.Lumi)
|
||||
L._yaw, L._yaw_time = 0.0, float("inf") # the head at the front (det_yaw reads no body)
|
||||
L.lang, L.markers, L.current, L.patrol, L.vision, L.voice_angle = "en", M, None, None, None, 0.0
|
||||
L.turn_head = lambda *a, **k: moved.append("head")
|
||||
L.brain = types.SimpleNamespace(history=[])
|
||||
|
||||
@@ -231,6 +231,16 @@ L.mic = Mic(U("루미야, 뭐 보여?"))
|
||||
L.step()
|
||||
assert ("answer", "뭐 보여") in done, done
|
||||
|
||||
# the person talked with, still tracked but past STAY_MAX (come here took a far one): gone, never "seen again" as
|
||||
# itself (that looped ~33000 times a s, the assistant went deaf, 2026-10-28 18:06)
|
||||
L = fresh(a := Track(10, 186.0, 4.7))
|
||||
a.greeted, L.current = True, a
|
||||
L.vision.present = lambda t: t in L.vision.tracks and t.distance <= lumi.STAY_MAX
|
||||
L.vision.nearest_greeted = lambda: None
|
||||
lumi.ears.listen = lambda **k: (None, None)
|
||||
L.step()
|
||||
assert L.current is None, L.current
|
||||
|
||||
L = fresh() # a talk started by voice ends the same way
|
||||
L.voice_until = time.time() - 1
|
||||
L.brain.history = [("hi", "hello")]
|
||||
|
||||
Reference in New Issue
Block a user