Compass and Accelerometer precision

前端 未结 3 1975
耶瑟儿~
耶瑟儿~ 2021-02-11 10:14

i made my own application in Android that use compass and accelerometer sensors to display the degrees of rotation and inclination of my device. I initialized all the listener a

3条回答
  •  无人及你
    2021-02-11 10:51

    What you're seeing is the real thing- the orientation sensors on most phones are only good enough to give you a rough compass heading.

    If you want to smooth the displayed value out so it gives you something that's doesn't appear to change randomly I recommend implementing a http://en.wikipedia.org/wiki/Moving_average or other smoothing filter in Java on that orientation result.

    For the highest performance you could write the filter using the NDK and use the Boost Accumulators library: http://www.boost.org/doc/libs/1_46_1/doc/html/accumulators.html

提交回复
热议问题