Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cf09884 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

fix [3369027] Sensor.TYPE_ROTATION_VECTOR is unstable and returns NaNs when running slowly

The cut-off frequency of the lowpass filter was too high
for the sampling rate used by DELAY_NORMAL.

Now we use the same filters used for the gravity vector
(cascaded biquad at 1.5 Hz)

Change-Id: I319dc4f449a3abd553d61b196a9ddcf7782f912d
parent 50b66767
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@ static inline T clamp(T v) {

RotationVectorSensor::RotationVectorSensor(sensor_t const* list, size_t count)
    : mSensorDevice(SensorDevice::getInstance()),
      mALowPass(M_SQRT1_2, 5.0f),
      mALowPass(M_SQRT1_2, 1.5f),
      mAX(mALowPass), mAY(mALowPass), mAZ(mALowPass),
      mMLowPass(M_SQRT1_2, 2.5f),
      mMLowPass(M_SQRT1_2, 1.5f),
      mMX(mMLowPass), mMY(mMLowPass), mMZ(mMLowPass)
{
    for (size_t i=0 ; i<count ; i++) {
+2 −2
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@ class RotationVectorSensor : public SensorInterface {
    double mAccTime;
    double mMagTime;
    SecondOrderLowPassFilter mALowPass;
    BiquadFilter mAX, mAY, mAZ;
    CascadedBiquadFilter mAX, mAY, mAZ;
    SecondOrderLowPassFilter mMLowPass;
    BiquadFilter mMX, mMY, mMZ;
    CascadedBiquadFilter mMX, mMY, mMZ;

public:
    RotationVectorSensor(sensor_t const* list, size_t count);