Skip to content Skip to sidebar Skip to footer

How To Calculate Rotation Angle Using Android Sensors?

I am doing an Opengl appln in which i have to rotate the camera, if the android device is rotated/tilted along Z axis. I tried the SensorManager.getOrientation(R, orientVals); usin

Solution 1:

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.

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...)

Post a Comment for "How To Calculate Rotation Angle Using Android Sensors?"