开发者

How to calculate orientation on accelerating phone

I want to calculate orientation of the phone. Android documentation says that I can do that using getRotationMatrix (float[] R, float[] I, float[] gravity, float[] geomagnetic) and remapCoordinateSystem(float[], int, int, float[]), but also in documentation write 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.

My question is how to calculate phone orientation wh开发者_运维问答en the phone is accelerating, no matthr what kind of acceleration it is, free fall, phone attached to car etc...


getResources().getConfiguration().orientation http://developer.android.com/reference/android/content/res/Configuration.html#orientation


An accelerometer is NOT designed to calculate pitch. It is only by mere fortunate natural coincidence that you can establish pitch from a NON-ACCELERATING accelerometer. At all other times it is unreliable (for measuring pitch). It has nothing to do with quality of sensor etc it's just that accelerometers DO NOT measure pitch. To reliably establish pitch you need gyroscopes. These devices ARE designed to measure pitch.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜