File size: 1,375 Bytes
c2b7969
 
51169d5
 
 
c2b7969
 
51169d5
 
 
 
c2b7969
51169d5
c2b7969
51169d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: Face Tracker
emoji: πŸ‘€
colorFrom: purple
colorTo: blue
sdk: static
pinned: false
short_description: "Robot smoothly follows your face"
tags:
  - reachy_mini
  - reachy_mini_python_app
---
# Face Tracker πŸ‘€πŸ€–

Detects faces via MediaPipe Face Detection and smoothly tracks the closest/largest face with the robot's head. Includes proximity-based emotional responses.

## Features

- **Smooth tracking**: Proportional controller with exponential smoothing
- **Largest face priority**: Tracks the biggest (closest) face in frame
- **Proximity emotions**:
  - Close (large face) β†’ Happy, antennas up
  - Medium distance β†’ Mildly content
  - Far (small face) β†’ Curious
  - No face β†’ Lonely drift/scanning
- **Natural movement**: Smooth interpolation prevents jerky head motion
- **Idle behavior**: Gentle scanning when no face detected for ~1 second

## How It Works

1. Captures frames from Reachy Mini's camera
2. Detects faces using MediaPipe Face Detection
3. Calculates face center offset from frame center
4. Maps offset to head yaw/pitch correction (proportional controller)
5. Smoothly interpolates toward target position
6. Adjusts antenna angle based on face proximity (emotion)

## Requirements

- Camera connected to Reachy Mini
- `mediapipe`, `opencv-python`, `numpy`

## Install & Run

```bash
pip install .
reachy-mini run face_tracker
```