Android Compass orientation on unreliable (Low pass filter)

前端 未结 5 2173
后悔当初
后悔当初 2020-12-13 03:05

Im creating an application where i need to position a ImageView depending on the Orientation of the device. I use the values from a MagneticField and Accelerometer Sensors

5条回答
  •  囚心锁ツ
    2020-12-13 03:43

    A low pass filter (LPF) blocks fast changing signals and
    allows only slow changes in the signals. This means any small
    sudden changes will be ignored.

    The standard way to implement this in software is to take a running average
    of the last N samples and report that value. Start with N as small as 3 and
    keep increasing N until you find sufficient smoothed out response in your app.

    Do keep in mind that the higher you make N, slower the response of the system.

提交回复
热议问题