Compass and Accelerometer precision

南笙酒味 提交于 2019-12-03 10:11:11
thom_nic

See my answer here: Smoothing data from a sensor

I run this filter on both the accelerometer and magetometer event values before passing them to SensorManager.getRotationMatrix(). I think this algorithm has the advantage of not having to keep a large array of historic values, just the prior low-pass output array.

The algorithm was derived from this Wikipedia entry: http://en.wikipedia.org/wiki/Low-pass_filter#Algorithmic_implementation

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

I did this using a Kalman filter from here: Greg Czerniak's Website

I'm sending data to a udp port and smoothing it on the PC using python. But I guess you can find a Kalman filter implementation for java/android out there.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!