SlimeVR-Rust icon indicating copy to clipboard operation
SlimeVR-Rust copied to clipboard

[Firmware] Add timestamps to UnfusedData

Open TheButlah opened this issue 2 years ago • 1 comments

We need to add hardware timestamps to UnfusedData. We may want to be generic on the timestamp type, so that we can represent when things are hardware timestamps vs software timestamps.

Fusion algos will need this, as several can use a dt to improve performance: https://github.com/jmagnuson/ahrs-rs#field_access

TheButlah avatar Feb 26 '23 00:02 TheButlah

After some research into this, I now believe that reading timestamps from the fifo is not the right approach. Rather, we should sample the mcu timestamp at each new data ready interrupt, and then use that to track an exponential moving average of the estimated sample rate, in terms of MCU time (which is lower ppm/drift than the internal clock on most IMUs). We can use that sample rate to update the sample rate of the fusion algorithm, possibly on some fixed interval task.

In other words, the sample rate of the data stream should be tracked, rather than associating the deltaT or absolute time of each sample with the unfused data.

TheButlah avatar Apr 05 '23 06:04 TheButlah