本文介绍了如何使用Android传感器来计算旋转角?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我在做一个OpenGL APPLN在我所旋转摄像头,如果Android设备旋转/沿Z轴的倾斜。

I am doing an Opengl appln in which i have to rotate the camera, if the android device is rotated/tilted along Z axis.

我试过 SensorManager.getOrientation(R,orientVals)。但值都非常波动。
陀螺仪也可在我的设备。

I tried the SensorManager.getOrientation(R, orientVals); using the magnetic and accelerometer sensors. But the values are very much fluctuating.Gyroscope is also available in my device.

由于我动画(旋转)相机,我需要一个平滑的旋转值

Since I am animating (rotate) the camera, I need a smooth rotation values

请指导我在这方面。

推荐答案

请参阅计算旋转速度,以及(如果可用)陀螺仪。

See How do you calculate the rate of rotation using the accelerometer values in Android for a particular axis on how to read Android's software-derived sensors that combine the data from the accelerometers, magnetometers, and (if available) gyroscopes.

要平滑值,使用低通滤波器或(更好,但更复杂的)一个卡尔曼滤波。我怀疑Android的软件衍生传感器,如旋转传感器已经使用卡尔曼滤波器将数据从不同的传感器相结合。 (人们可以搜索源$ C ​​$ C ...)

To smooth values, use a low-pass filter or (better but more complicated) a Kalman filter. I suspect that Android's software-derived sensors such as the "rotation sensor" already use a Kalman filter to combine data from the different sensors. (One could search the source code...)

这篇关于如何使用Android传感器来计算旋转角?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 08:16