Accelerometer/Gyroscope output frequency

Hello,


We have successfully developed an Android application based on your device and your SDK. Thank you for the great job and providing such a API.

We still have a little issue, we stream data from the device (a metawear R Pro) and we wrote the data in a file (each record as a row).
We are streaming at this frequency :
  • 25 Hz for the gyroscope
  • 12.5 Hz for the accelerometer
However when we look at the files generated it appears that we have many duplicate lines. Furthermore, we reach almost a frequency of 25 Hz for the accelerometer and 50 Hz for the gyroscope (so the frequency is twice as expected).


Here is the code used for configuring the sensors :
Accelerometer.ConfigEditor<?> editor = accelerometer.configure();
editor.odr(12.5f);
editor.range(2.0f);
editor.commit();
gyroscope.configure().odr(GyroBmi160.OutputDataRate.ODR_25_HZ)
.range(GyroBmi160.Range.FSR_125).commit();
We retrieve the data by adding an AsyncRoute to the accelerometer and another AsyncRoute for the GyroScope.

Any idea why did we have this weird behavior ?


Thanks you for your time,

Regards.

Comments

  • edited May 4
    Place some log calls in your code to see if you are adding a route multiple times and in the subscriber to see if it's being called multiple times.  It appears that you are either setting up the accelerometer and gyro routes twice or the subscriber is adding multiple lines to the file per call of its apply function.
Sign In or Register to comment.