Skip to content

Commit 6869cc0

Browse files
committed
Fix speaking state transitions and gesture cadence
1 parent 4da48d0 commit 6869cc0

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

reachy_mini_home_assistant/core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class CameraConfig:
101101
idle_threshold: float = 30.0 # Seconds without face -> idle
102102

103103
# Gesture detection runtime tuning
104-
gesture_detection_interval: int = 2 # Run every other frame for balanced responsiveness
104+
gesture_detection_interval: int = 1 # Run every frame for maximum gesture responsiveness
105105

106106

107107
@dataclass

reachy_mini_home_assistant/motion/command_runtime.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ def poll_commands(manager: "MovementManager") -> None:
2222
cmd, payload = manager._command_queue.get_nowait()
2323
except Empty:
2424
break
25+
26+
if cmd == "set_state":
27+
while True:
28+
try:
29+
next_cmd, next_payload = manager._command_queue.get_nowait()
30+
except Empty:
31+
break
32+
if next_cmd == "set_state":
33+
payload = next_payload
34+
continue
35+
handle_command(manager, next_cmd, next_payload)
36+
2537
handle_command(manager, cmd, payload)
2638

2739

tests/test_command_runtime.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,13 @@ def test_stop_timer_sound_does_not_finish_tts_session(self):
8080
self.assertEqual(len(unduck_calls), 1)
8181
self.assertEqual(len(stop_calls), 1)
8282
self.assertEqual(protocol._tts_finished_calls, 0)
83+
84+
85+
class CommandRuntimeStateQueueTests(unittest.TestCase):
86+
def test_poll_commands_coalesces_back_to_back_state_updates(self):
87+
path = Path("reachy_mini_home_assistant/motion/command_runtime.py")
88+
content = path.read_text(encoding="utf-8")
89+
90+
self.assertIn('if cmd == "set_state":', content)
91+
self.assertIn('if next_cmd == "set_state":', content)
92+
self.assertIn("payload = next_payload", content)

0 commit comments

Comments
 (0)