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:
@@ -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