es-ude / BallChallenge

0 stars 0 forks source link

Use Gyroscope in BallChallange #17

Open DavidFederl opened 2 months ago

DavidFederl commented 2 months ago

Add Gyroscope measurement with 1.6kHz and publish to different topic.

ToDo

Remarks

[!CAUTION] When reading with 1600Hz the internal RAM of the RP2040 (260KB) is to small to store all data! Amounts to around (only one topic):

\#_{\text{Bytes per sample}} \cdot \omega_{\text{measurements}} \cdot \Delta_{\text{recording}} = 14 \cdot 1600Hz \cdot 5s = 112000B \approx 110KiB

Solutions:

DavidFederl commented 2 months ago

waiting for https://github.com/es-ude/elastic-ai.runtime.enV5/issues/282#issue-2529441686 to be merged

DavidFederl commented 2 months ago

To overcome memory shortage on the ESP32 side we will split up the measurement into groups of around 800 samples. With a measurement frequency of about 1.6kHz this would lead to 6 published batches for one cycle of 3 seconds.

This can be accomplished by providing a ID for the measurement request under which the data will be published.

sequenceDiagram
    participant S as CSV-Service 
    participant E as enV5
    Note over E: sub[.../DO/measurement]
    S ->> E: pub[.../DO/measurement , <ID>]
    Note over S: sub[.../DATA/gyroscope/<ID>]
    Note over S: sub[.../DATA/accelerometer/<ID>]
    Note over S: sub[.../DONE/measurement]
    Note over S,E: show countdown
    loop for 3 seconds
        par gyroscope
            Note over E: measure with 1600Hz
            E ->> S: pub[.../DATA/gyroscope/<ID> , batch (~800 samples)]
        and accelerometer
            Note over E: measure with 800Hz
            E ->> S: pub[.../DATA/accelerometer/<ID> , batch (~800 sampkes)]
        end
    end
    E ->> S: pub[.../DONE/measurement , <ID>]
    Note over S: unsub[.../DATA/gyroscope/<ID>]
    Note over S: unsub[.../DATA/accelerometer/<ID>]
    Note over S: unsub[.../DONE/measurement]