Desmond-Dong commited on
Commit
0813da7
·
1 Parent(s): 7a7e15d

Speaking: pause face tracking, use lively nodding animation (1.5Hz)

Browse files
reachy_mini_ha_voice/animations/conversation_animations.json CHANGED
@@ -26,14 +26,14 @@
26
  "frequency_hz": 0.5
27
  },
28
  "speaking": {
29
- "description": "Animation while TTS is playing - lively head movement",
30
- "pitch_amplitude_rad": 0.06,
31
- "yaw_amplitude_rad": 0.05,
32
- "roll_amplitude_rad": 0.04,
33
- "z_amplitude_m": 0.004,
34
- "antenna_amplitude_rad": 0.35,
35
  "antenna_move_name": "wiggle",
36
- "frequency_hz": 0.9
37
  },
38
  "happy": {
39
  "description": "Happy/positive response",
 
26
  "frequency_hz": 0.5
27
  },
28
  "speaking": {
29
+ "description": "Speaking animation - lively nodding like talking",
30
+ "pitch_amplitude_rad": 0.08,
31
+ "yaw_amplitude_rad": 0.06,
32
+ "roll_amplitude_rad": 0.03,
33
+ "z_amplitude_m": 0.005,
34
+ "antenna_amplitude_rad": 0.4,
35
  "antenna_move_name": "wiggle",
36
+ "frequency_hz": 1.5
37
  },
38
  "happy": {
39
  "description": "Happy/positive response",
reachy_mini_ha_voice/satellite.py CHANGED
@@ -747,9 +747,16 @@ class VoiceSatelliteProtocol(APIServer):
747
 
748
  def _reachy_on_listening(self) -> None:
749
  """Called when listening for speech (HA state: Listening)."""
750
- # Enable high-frequency face tracking during conversation
751
  self._set_conversation_mode(True)
752
 
 
 
 
 
 
 
 
753
  # Disable tap detection during conversation to prevent false triggers from robot movement
754
  tap_detector = getattr(self.state, 'tap_detector', None)
755
  if tap_detector:
@@ -767,6 +774,13 @@ class VoiceSatelliteProtocol(APIServer):
767
 
768
  def _reachy_on_thinking(self) -> None:
769
  """Called when processing speech (HA state: Processing)."""
 
 
 
 
 
 
 
770
  if not self.state.motion_enabled or not self.state.reachy_mini:
771
  return
772
  try:
@@ -778,6 +792,14 @@ class VoiceSatelliteProtocol(APIServer):
778
 
779
  def _reachy_on_speaking(self) -> None:
780
  """Called when TTS is playing (HA state: Responding)."""
 
 
 
 
 
 
 
 
781
  if not self.state.motion_enabled or not self.state.reachy_mini:
782
  return
783
  try:
@@ -787,11 +809,18 @@ class VoiceSatelliteProtocol(APIServer):
787
  except Exception as e:
788
  _LOGGER.error("Reachy Mini motion error: %s", e)
789
 
790
- def _reachy_on_idle(self) -> None:
791
  """Called when returning to idle state (HA state: Idle)."""
792
  # Disable high-frequency face tracking, switch to adaptive mode
793
  self._set_conversation_mode(False)
794
 
 
 
 
 
 
 
 
795
  # Re-enable tap detection when conversation ends
796
  tap_detector = getattr(self.state, 'tap_detector', None)
797
  if tap_detector:
 
747
 
748
  def _reachy_on_listening(self) -> None:
749
  """Called when listening for speech (HA state: Listening)."""
750
+ # Enable high-frequency face tracking during listening
751
  self._set_conversation_mode(True)
752
 
753
+ # Resume face tracking (may have been paused during speaking)
754
+ if self.camera_server is not None:
755
+ try:
756
+ self.camera_server.set_face_tracking_enabled(True)
757
+ except Exception as e:
758
+ _LOGGER.debug("Failed to resume face tracking: %s", e)
759
+
760
  # Disable tap detection during conversation to prevent false triggers from robot movement
761
  tap_detector = getattr(self.state, 'tap_detector', None)
762
  if tap_detector:
 
774
 
775
  def _reachy_on_thinking(self) -> None:
776
  """Called when processing speech (HA state: Processing)."""
777
+ # Resume face tracking (may have been paused during speaking)
778
+ if self.camera_server is not None:
779
+ try:
780
+ self.camera_server.set_face_tracking_enabled(True)
781
+ except Exception as e:
782
+ _LOGGER.debug("Failed to resume face tracking: %s", e)
783
+
784
  if not self.state.motion_enabled or not self.state.reachy_mini:
785
  return
786
  try:
 
792
 
793
  def _reachy_on_speaking(self) -> None:
794
  """Called when TTS is playing (HA state: Responding)."""
795
+ # Pause face tracking during speaking - robot will use speaking animation instead
796
+ if self.camera_server is not None:
797
+ try:
798
+ self.camera_server.set_face_tracking_enabled(False)
799
+ _LOGGER.debug("Face tracking paused during speaking")
800
+ except Exception as e:
801
+ _LOGGER.debug("Failed to pause face tracking: %s", e)
802
+
803
  if not self.state.motion_enabled or not self.state.reachy_mini:
804
  return
805
  try:
 
809
  except Exception as e:
810
  _LOGGER.error("Reachy Mini motion error: %s", e)
811
 
812
+ def _reachy_on_listening(self) -> None:
813
  """Called when returning to idle state (HA state: Idle)."""
814
  # Disable high-frequency face tracking, switch to adaptive mode
815
  self._set_conversation_mode(False)
816
 
817
+ # Resume face tracking (may have been paused during speaking)
818
+ if self.camera_server is not None:
819
+ try:
820
+ self.camera_server.set_face_tracking_enabled(True)
821
+ except Exception as e:
822
+ _LOGGER.debug("Failed to resume face tracking: %s", e)
823
+
824
  # Re-enable tap detection when conversation ends
825
  tap_detector = getattr(self.state, 'tap_detector', None)
826
  if tap_detector: