What Is The Working Mechanism Of Sensor_type_gravity To Get Its Data? - Android
I have a 3-D acceleration vector (a, b, c) obtained from an Android phone accelerometer. I wish to calculate the angle between this vector (a, b, c) and the gravity vector, which p
Solution 1:
The three sensors Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_GRAVITY and Sensor.TYPE_LINEAR_ACCELERATION are related by the equation
"Sensor.TYPE_ACCELEROMETER" = "Sensor.TYPE_GRAVITY" + "Sensor.TYPE_LINEAR_ACCELERATION"
If you register for updates for all three, what you find is that Sensor.TYPE_ACCELEROMETER always arrives first, followed by Sensor.TYPE_GRAVITY and Sensor.TYPE_LINEAR_ACCELERATION, and that the values always satisfy that equation. Internally, Android is using filtering, and in particular a Kalman filter, to separate the two.
A low pass filter is a simple way of doing something similar. However, a lot of thought will have gone into the Android mechanism, so I'm sure that if a low pass filter was better, then Android would have implemented that.
Post a Comment for "What Is The Working Mechanism Of Sensor_type_gravity To Get Its Data? - Android"