问题描述
所以,我已经实现了Android上的一个简单的应用程序,使得我倾斜手机的方向球滚动。然而,它是不可能让球还是由于传感器值continously改变,即使我想我还拿着它。
So I have implemented a simple app on Android that makes the ball roll in the direction I tilt the phone. However it is impossible to keep the ball still since the sensor values are continously changing even if I think I am holding it still.
所以我猜我想要的那朵过滤掉小的变化?使用某种lowpassfilter的?
So I guess what I want tis filter away small changes? Using some sort of lowpassfilter?
所以,我会怎么做呢?保留旧rotationMatrix而不做任何修改,如果差不大于某一阈值更大?
So how would I do that? Keep the old rotationMatrix and not do any changes if the difference is not bigger than some threshold?
推荐答案
如果你想在方向的球滚动你倾斜我建议使用在X和Y方向陀螺仪试图电话。然而,加速度计和陀螺仪的组合,可以给你更好的结果。
If you want to make the ball roll in the direction you tilt the phone I suggest trying using the gyroscope in x and y directions. However, a combination of accelerometer and gyroscope can give you better results.
是一个不错的视频,了解传感器如何工作的。它解释了如何传感器收购移动设备,以及如何最大限度地减少使用sensorfusion和滤波技术,错误的数据。
This is a good video to understand how the sensors work. It explains how the sensors acquire the data in mobile devices and how to minimize the error using sensorfusion and filtering techniques.
这篇关于过滤掉来自Android的倾斜(加速度计和磁场)的传感器的噪声?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!