Desmond-Dong commited on
Commit
4fa5aec
·
1 Parent(s): be89d68

fix: IDLE state should be completely still, restore face tracking fps

Browse files

- Disable breathing animation in IDLE state (amplitude = 0)
- IDLE state now stays completely still like just powered on
- Restore face tracking to 15fps for smoother tracking
- Root cause was breathing animation causing continuous pose changes

reachy_mini_ha_voice/__init__.py CHANGED
@@ -11,7 +11,7 @@ Key features:
11
  - Reachy Mini motion control integration
12
  """
13
 
14
- __version__ = "0.4.0"
15
  __author__ = "Desmond Dong"
16
 
17
  # Don't import main module here to avoid runpy warning
 
11
  - Reachy Mini motion control integration
12
  """
13
 
14
+ __version__ = "0.5.0"
15
  __author__ = "Desmond Dong"
16
 
17
  # Don't import main module here to avoid runpy warning
reachy_mini_ha_voice/camera_server.py CHANGED
@@ -51,7 +51,7 @@ class MJPEGCameraServer:
51
  reachy_mini: Optional["ReachyMini"] = None,
52
  host: str = "0.0.0.0",
53
  port: int = 8081,
54
- fps: int = 10, # 10fps for daemon stability
55
  quality: int = 80,
56
  enable_face_tracking: bool = True,
57
  ):
 
51
  reachy_mini: Optional["ReachyMini"] = None,
52
  host: str = "0.0.0.0",
53
  port: int = 8081,
54
+ fps: int = 15, # 15fps for smooth face tracking
55
  quality: int = 80,
56
  enable_face_tracking: bool = True,
57
  ):
reachy_mini_ha_voice/movement_manager.py CHANGED
@@ -58,12 +58,11 @@ except ImportError:
58
 
59
  # Control loop frequency - CRITICAL for daemon stability
60
  # The daemon's internal control loop runs at 50Hz.
61
- # We use 10Hz for IDLE state stability - breathing animation doesn't need high frequency.
62
  # Each set_target() call sends 3 Zenoh messages (head, antennas, body_yaw).
63
- # At 10Hz × 3 = 30 messages/second MAX, but with pose change detection we typically
64
- # send much fewer messages (only when pose actually changes significantly).
65
- # With threshold of 0.005 rad, actual message rate is ~5-10 msg/s during idle.
66
- CONTROL_LOOP_FREQUENCY_HZ = 10 # 10Hz control loop for daemon stability
67
  TARGET_PERIOD = 1.0 / CONTROL_LOOP_FREQUENCY_HZ
68
 
69
  # Speech sway parameters (from conversation_app SwayRollRT)
@@ -86,11 +85,13 @@ SWAY_F_Z = 0.25 # Z frequency Hz
86
  # Master scale
87
  SWAY_MASTER = 1.5 # Overall sway intensity multiplier
88
 
89
- # Breathing parameters - smoother animation with continuous sine wave
90
- BREATHING_Z_AMPLITUDE = 0.003 # 3mm (reduced for stability)
91
- BREATHING_FREQUENCY = 0.08 # 0.08Hz (~5 breaths per minute, slower pace)
92
- ANTENNA_SWAY_AMPLITUDE_DEG = 5.0 # 5 degrees (reduced to prevent excessive messages)
93
- ANTENNA_FREQUENCY = 0.15 # 0.15Hz (slower, more graceful)
 
 
94
 
95
  # VAD parameters for speech detection
96
  VAD_DB_ON = -35 # Start detection threshold
@@ -496,9 +497,10 @@ class MovementManager:
496
  self.state.last_activity_time = self._now()
497
 
498
  # State transition logic
 
499
  if payload == RobotState.IDLE and old_state != RobotState.IDLE:
500
  self.state.idle_start_time = self._now()
501
- self._breathing.set_active(True)
502
  self._speech_sway.reset()
503
  # Unfreeze antennas when returning to idle
504
  self._start_antenna_unfreeze()
 
58
 
59
  # Control loop frequency - CRITICAL for daemon stability
60
  # The daemon's internal control loop runs at 50Hz.
61
+ # We use 10Hz for control loop - sufficient for smooth motion.
62
  # Each set_target() call sends 3 Zenoh messages (head, antennas, body_yaw).
63
+ # With pose change detection, actual message rate is much lower in IDLE state
64
+ # because we only send when pose actually changes.
65
+ CONTROL_LOOP_FREQUENCY_HZ = 10 # 10Hz control loop
 
66
  TARGET_PERIOD = 1.0 / CONTROL_LOOP_FREQUENCY_HZ
67
 
68
  # Speech sway parameters (from conversation_app SwayRollRT)
 
85
  # Master scale
86
  SWAY_MASTER = 1.5 # Overall sway intensity multiplier
87
 
88
+ # Breathing parameters - DISABLED for IDLE state stability
89
+ # IDLE state should be completely still like just powered on
90
+ # Breathing animation was causing continuous pose changes and daemon crashes
91
+ BREATHING_Z_AMPLITUDE = 0.0 # Disabled - no breathing in IDLE
92
+ BREATHING_FREQUENCY = 0.08
93
+ ANTENNA_SWAY_AMPLITUDE_DEG = 0.0 # Disabled - no antenna sway in IDLE
94
+ ANTENNA_FREQUENCY = 0.15
95
 
96
  # VAD parameters for speech detection
97
  VAD_DB_ON = -35 # Start detection threshold
 
497
  self.state.last_activity_time = self._now()
498
 
499
  # State transition logic
500
+ # IDLE state: completely still, no animations (like just powered on)
501
  if payload == RobotState.IDLE and old_state != RobotState.IDLE:
502
  self.state.idle_start_time = self._now()
503
+ self._breathing.set_active(False) # No breathing in IDLE - stay still
504
  self._speech_sway.reset()
505
  # Unfreeze antennas when returning to idle
506
  self._start_antenna_unfreeze()