plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Question]: sensors_plus: irregular sample interval

Open WasaLordy opened this issue 2 years ago • 0 comments

What is your question?

E.g. If I access the "userAccelerometerEventStream(samplingPeriod: SensorInterval.gameInterval)" and write a timestamp each time a sample arrives. The difference between each timestamp is usually 20 ms. What I'm interessted in is the maximum variance.

If I do nothing else the maxiumum gap between two timestamps is ~26 ms, which is fine for me. If I plot the data with syncfusion_flutter_charts or run a calculation the max gap grows fast to 100 ms. Still I have a sampling rate of 50 samples per second. (The following samples are then closer together.)

The numbers are in debug mode but release doesn't make it much better. Other [SensorInterval]s and other sensors have the same problem.

  1. Do the samples come from the sensor every 20 ms and the thread is simply blocked from time to time, which is why the creation of the timestamp is irregular or is the query interval of the sensor value irregular?
  2. If the query interval of the sensor value is irregular, can I somehow query the values in another thread and visualize them in the main thread? (My attempts so far have failed)

I am grateful for any help.

WasaLordy avatar Dec 14 '23 10:12 WasaLordy