Question

In Android Documentation is specified the third parameter as

float[] gravity 

then is specifies

[0 0 g] = R * gravity (g = magnitude of gravity)

Now, in most of the examples online I can see everyone sending accelerometer values to getRotationMatrix, but, Isn't suppose that I should send only gravity values?

For example, if the mobile phone has the gravity sensor, Should I send it raw output to getRotationMatrix? If it hasn't one, Should I send accelerometer values? Should I extract non gravity components first? (as accelerometer values are Acceleration minus G).

Will the use of gravity sensor values be more reliable than using accelerometer values in mobile phones that have that sensor?

Thanks in advance! Guillermo.

No correct solution

OTHER TIPS

I think the reason you only see examples using the accelerometer values is because the gravity sensor was only launched in API 9 and also because most phones might not give this values separated from the accelerometer values, or dont have the sensor, etc, etc..

Another reason would be because in most of the cases the result tend to be the same, since what the accelerometer sensor outputs is the device linear acceleration plus gravity, but most of the time the phone will be standing still or even moving at a constant velocity, thus the device acceleration will be zero.

From the setRotationMatrix Android Docs:

The matrices returned by this function are meaningful only when the device is not free-falling and it is not close to the magnetic north. If the device is accelerating, or placed into a strong magnetic field, the returned matrices may be inaccurate.

Now, you're asking if the gravity data would me more reliable? Well, there is nothing like testing, but I suppose it wouldn't make much difference and it really depends on which application you want. Also, obtaining the simple gravity values is not trivial and it requires filtering, so you could end up with noisy results.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top