Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which sensors used for Sensor.TYPE_ROTATION_VECTOR

Tags:

android

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

like image 858
Mark Avatar asked Aug 11 '11 14:08

Mark


2 Answers

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.

like image 106
Jacek Gorgoń Avatar answered Sep 20 '22 20:09

Jacek Gorgoń


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.

like image 42
nunojpg Avatar answered Sep 20 '22 20:09

nunojpg