I'm developing for Honeycomb Gingerbread and I was wondering, which physical sensors are used when I use the Sensor.TYPE_ROTATION_VECTOR?
Does it use a combination of compass and accelerometers? Or gyro + accel? Or all three? Or something else? The reason I'm asking is that my app behaves differently on two different pieces of hardware, and they should actually have the same type of sensors.
Thanks, Mark
I realize it's been a while since the question was asked, but I don't see a clear answer, so...
It uses all three sensors if they're available. The use of magnetic field sensor is crucial to have some absolute point of reference. The "rotation sensor" needs to initially orient itself and then eliminate the drift that gyro introduces over time. Gyro is still used because of it's precision and good response time. The accelerometer helps determine the gravity vector.
The theory:
For you phone to know the orientation, including azimuth, you need to reference a plane in the real world. That plane is calculated from two non co-linear vectors: Gravity (Accelerometer) and Magnetic fields forces. This vectors DO GET co-linear at two "places" on earth, but fortunately that is near the earth poles.
The practice:
With the Magnetic and Accelerometer you are able to get the orientation. Unfortunately if you submit your phone to any linear acceleration, or if there is magnetic disturbances the measures get noisy. The use of a Gyroscope dramatically improves response time/accuracy (since it is a tradeoff), but it is not essential for all applications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With