如何从 Android 3 轴加速度计的加速度计读数中删除重力因子 [英] How to remove Gravity factor from Accelerometer readings in Android 3-axis accelerometer
问题描述
谁能帮忙从加速度计读数中去除 g 因子?
Can anyone help on removing the g factor from accelerometer readings?
我使用 SensorEventListener 和 onSensorChanged()
方法来获取 Sensor.TYPE_ACCELEROMETER 数据.我只需要所有方向上的纯加速度值.所以在任何状态下,如果设备稳定(或匀速),它应该大致给出 (0.0,0.0,0.0).
I am using SensorEventListener with onSensorChanged()
method for getting Sensor.TYPE_ACCELEROMETER data. I need only pure acceleration values in all directions. So at any state if the device is stable (or in constant speed), it should give (0.0,0.0,0.0) roughly.
目前,根据它的俯仰和滚转,它根据作用在每个轴上的 g 力为我提供可变的输出.
Currently, depending on its pitch and roll, it gives me variable output depending on the g forces acting on each axis.
我希望有一些公式可以消除这一点,因为我还从 Sensor.TYPE_ORIENTATION 侦听器中获得了方向值(俯仰和滚转).我用过一些,但没有用.
I hope there is some formula to remove this, as I also get orientation values (pitch and roll) from Sensor.TYPE_ORIENTATION listener. I have used some but it didn't work.
推荐答案
使用 Sensor.TYPE_LINEAR_ACCELERATION 而不是 Sensor.TYPE_ACCELEROMETER
Use Sensor.TYPE_LINEAR_ACCELERATION instead of Sensor.TYPE_ACCELEROMETER
这篇关于如何从 Android 3 轴加速度计的加速度计读数中删除重力因子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!