Core gesture recognition engine using Dynamic Time Warping. Provides template management, matching, and confidence scoring against ESP32-S3 CSI motion frames.
The Gesture cog runs a Dynamic Time Warping (DTW) matcher over a sliding window of CSI amplitude frames from the
ESP32-S3. Each enabled template is scored independently; the best score under the threshold emits a
gesture_match event with the matched template_id and a normalised
confidence in [0, 1].
Templates are loaded at boot from flash and may be added, retrained, or disabled at runtime. The matcher is gated by a configurable activation window and Sakoe-Chiba band to keep latency under one frame at 50 Hz.
gesture_match
event
gesture/ ├── manifest.toml # name, version, deps, events ├── cog.py # entrypoint + event loop ├── dtw.py # Sakoe-Chiba banded DTW ├── templates.py # load / save / enable / score ├── templates/ │ ├── wave_left.bin │ ├── wave_right.bin │ ├── circle_cw.bin │ ├── circle_ccw.bin │ ├── push.bin │ └── tap.bin └── tests/ ├── test_dtw.py └── test_templates.py
[cog]
name = "gesture"
version = "2.0.0"
description = "Core DTW gesture recognition engine with template management"
author = "developer"
size_kb = 16
difficulty = "easy"
category = "signal"
[hardware]
target = "esp32-s3"
[inputs]
csi_motion = { rate_hz = 50, channels = 2 }
[[events]]
name = "gesture_match"
fields = ["confidence", "template_id"]
[config]
threshold = 0.65
window_ms = 1200
smoothing = 0.35
band_width = 8
max_templates = 12