Page 1 of 1

Gesture Storage & Comparator

Posted: Tue Jul 13, 2021 8:21 pm
by Caritas
Hello,

I'm looking to create a custom test for successful gesture replication on microbit, following the algorithm below:

1) User is prompted to press button A
2) Once button is pressed, accelerometer data is generated until values return to near-zero levels (i.e. accelerometer x-, y-, and z-values are all less than a calibratable threshold)
3) Accelerometer data is stored, and the new gesture is named 'Gesture A', or some such placeholder, similar to up/down/shake etc.
4) User is prompted to press button B
5) Data is generated as in step 2, and stored as a gesture named 'Gesture B'

Ultimately, I'll be writing a comparator algorithm to determine similarity between the two gestures, but that's a task for another day.

For now, I'm looking for guidance on where to start, with the following questions.

How should I store accelerometer data? What sort of data structure allows for easy retrieval and comparison of 0.5s-3s worth of data w/ a high sampling rate?
What data type is a gesture? I.e. if accelerometer.was_gesture("shake"): makes sense because shake is a known gesture (is this a class? an object? I'm fairly new to programming and don't fully understand). I'd like to essentially create a gestureA, such that

if accelerometer.was_gesture("gestureA"):

is valid.

I'd appreciate any and all feedback and assistance.