Improve head resting pose and keep the head where it was asked to look
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -237,4 +237,34 @@ for text in ("I am standing or sitting.", "Am I sitting or standing?", "It looks
|
||||
assert lumi.claimed_name("I'm James.") == "james"
|
||||
assert "only when they clearly tell you their name" in brain_mod.SYSTEM
|
||||
|
||||
# the head rests looking down (lowest pitch): every "head back" sends HEAD_REST_PITCH, never pitch 0
|
||||
src = open(lumi.__file__).read()
|
||||
assert "turn_head(0, 0)" not in src and "head.HEAD_REST_PITCH" in src
|
||||
assert lumi.LOOK["center"] == (0, lumi.head.HEAD_REST_PITCH) and lumi.head.HEAD_REST_PITCH == lumi.head.PITCH_RANGE[0]
|
||||
|
||||
# a look asked for is held: automatic head moves wait until LOOK_HOLD_S of silence, a goodbye or a stop word
|
||||
moves = []
|
||||
real_status, real_turn = lumi.head.status, lumi.head.turn
|
||||
lumi.head.status = lambda: [50.0, 0.0, 0.0, 20.0]
|
||||
lumi.head.turn = lambda yaw, pitch=None, **k: moves.append((yaw, pitch))
|
||||
H = lumi.Lumi.__new__(lumi.Lumi)
|
||||
H.looked_at, H.last_activity = time.time(), time.time() # "look up" just now
|
||||
H.turn_head(30.0) # toward a speaker: waits
|
||||
H.turn_head(0, lumi.head.HEAD_REST_PITCH) # back to rest: waits
|
||||
H.looked_at = H.last_activity = time.time() - lumi.LOOK_HOLD_S + 1 # still inside the hold
|
||||
H.turn_head(0, lumi.head.HEAD_REST_PITCH)
|
||||
time.sleep(0.2)
|
||||
assert moves == [] and H.look_held(), moves
|
||||
H.turn_head(10.0, 10, force=True) # an order still moves it
|
||||
H.looked_at = H.last_activity = time.time() - lumi.LOOK_HOLD_S - 1 # 35 s of silence: rest
|
||||
H.turn_head(0, lumi.head.HEAD_REST_PITCH)
|
||||
time.sleep(0.2)
|
||||
assert moves == [(10.0, 10), (0, lumi.head.HEAD_REST_PITCH)] and not H.look_held(), moves
|
||||
moves.clear()
|
||||
H.looked_at = H.last_activity = time.time()
|
||||
H.head_rest() # a goodbye / stop word ends the hold
|
||||
time.sleep(0.2)
|
||||
assert moves == [(0, lumi.head.HEAD_REST_PITCH)] and H.looked_at == 0.0, moves
|
||||
lumi.head.status, lumi.head.turn = real_status, real_turn
|
||||
|
||||
print("ok: wake words, waves, no greeting to passers-by or during tasks, answers never cut, names")
|
||||
|
||||
Reference in New Issue
Block a user