Desmond-Dong commited on
Commit
3f94c2a
·
1 Parent(s): 5254645

debug: 添加人脸追踪调试日志,移除Y偏移,增加smoothing factor

Browse files
reachy_mini_ha_voice/camera_server.py CHANGED
@@ -221,14 +221,9 @@ class MJPEGCameraServer:
221
  h, w = frame.shape[:2]
222
  eye_center_norm = (face_center + 1) / 2
223
 
224
- # Apply Y offset to look at eye level instead of face center
225
- # YOLO detects face bounding box center, which is below eye level
226
- # Positive offset moves the target point down in image (robot looks down)
227
- y_offset_ratio = 0.08 # 8% of image height downward
228
-
229
  eye_center_pixels = [
230
  eye_center_norm[0] * w,
231
- (eye_center_norm[1] + y_offset_ratio) * h,
232
  ]
233
 
234
  # Get the head pose needed to look at the target
@@ -258,8 +253,10 @@ class MJPEGCameraServer:
258
  float(rotation[2]),
259
  ]
260
 
261
- _LOGGER.debug("Face tracked: conf=%.2f, offsets=(%.3f, %.3f, %.3f)",
262
- confidence or 0, translation[0], translation[1], translation[2])
 
 
263
 
264
  except Exception as e:
265
  _LOGGER.debug("Face tracking error: %s", e)
 
221
  h, w = frame.shape[:2]
222
  eye_center_norm = (face_center + 1) / 2
223
 
 
 
 
 
 
224
  eye_center_pixels = [
225
  eye_center_norm[0] * w,
226
+ eye_center_norm[1] * h,
227
  ]
228
 
229
  # Get the head pose needed to look at the target
 
253
  float(rotation[2]),
254
  ]
255
 
256
+ # Debug: log the actual values
257
+ _LOGGER.info("Face tracking: trans=(%.4f, %.4f, %.4f), rot=(%.2f, %.2f, %.2f) deg",
258
+ translation[0], translation[1], translation[2],
259
+ np.degrees(rotation[0]), np.degrees(rotation[1]), np.degrees(rotation[2]))
260
 
261
  except Exception as e:
262
  _LOGGER.debug("Face tracking error: %s", e)
reachy_mini_ha_voice/movement_manager.py CHANGED
@@ -391,7 +391,7 @@ class MovementManager:
391
 
392
  # Face tracking smoothing (exponential moving average)
393
  self._smoothed_face_offsets: List[float] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
394
- self._face_smoothing_factor = 0.15 # Lower = smoother but slower response
395
 
396
  logger.info("MovementManager initialized")
397
 
 
391
 
392
  # Face tracking smoothing (exponential moving average)
393
  self._smoothed_face_offsets: List[float] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
394
+ self._face_smoothing_factor = 0.3 # Higher = faster response, lower = smoother
395
 
396
  logger.info("MovementManager initialized")
397