head_tracking:
  ros__parameters:
    # ── Camera (Intel RealSense D435i) ──────────────────────────────────────
    image_width:  848       # pixels
    image_height: 480       # pixels
    fov_h_deg:    87.0      # horizontal field of view (degrees)
    fov_v_deg:    58.0      # vertical field of view (degrees)

    # ── PID gains — pan axis ────────────────────────────────────────────────
    # Output: deg/step.  Start conservative; increase kp for faster tracking.
    pan_kp:  0.08           # proportional gain (deg per deg-of-error per step)
    pan_ki:  0.002          # integral gain
    pan_kd:  0.015          # derivative gain

    # ── PID gains — tilt axis ───────────────────────────────────────────────
    tilt_kp: 0.08
    tilt_ki: 0.002
    tilt_kd: 0.015

    # ── Servo limits (degrees from centre) ──────────────────────────────────
    pan_min_deg:  -60.0     # max left
    pan_max_deg:   60.0     # max right
    tilt_min_deg: -30.0     # max down
    tilt_max_deg:  30.0     # max up

    # ── Tracking behaviour ──────────────────────────────────────────────────
    hold_duration_s:    3.0   # hold last position this long after target loss
    center_speed_deg_s: 20.0  # degrees/sec to return to centre after hold
    dead_zone_px:       10.0  # pixel error smaller than this is treated as zero
    control_hz:         20.0  # PID loop rate

    # ── Target selection ────────────────────────────────────────────────────
    # score = distance_weight * (1/(1+dist_m)) + confidence_weight * confidence
    # Highest score wins.  If distance_m == 0 (unknown), confidence only.
    distance_weight:    0.6
    confidence_weight:  0.4
