2

The GameRotationVector in Android does not behave as expected from the doc (1). The Android doc says that the GameRotationVector should give the same values as the RotationVector sensor, with the difference that it does NOT consider the real azimuth (magnetic north). In this case I am talking about the azimuth which I get by the following code.

public void onSensorChanged(SensorEvent event) {
    SensorManager.getRotationMatrixFromVector(rotMatrix,event.values);
    SensorManager.remapCoordinateSystem(rotMatrix, SensorManager.AXIS_X, SensorManager.AXIS_Z, rotMatrixRemapped);
    SensorManager.getOrientation(rotMatrixRemapped, vals);
    myAzimuthInRadiant = vals[0];
}

The RotationVector sensor gives values from -pi to pi when I turned my device in 360° - everything fine, but look at the second picture.

RotationVector values are as expected from -pi to pi

In the second picture you can see that the GameRotationVector gives values from pi/2 to pi and vice versa on the negative site. That's, summing up = pi, which is half the range of the RotationVector.

So what is wrong here?

GameRotationVector values are just from pi/2 to pi (pos. and neg.)

(1) http://developer.android.com/reference/android/hardware/Sensor.html#TYPE_GAME_ROTATION_VECTOR

Sorcerer
  • 854
  • 1
  • 8
  • 20
  • I don't know the answer for your question but I have something to add. When using normal ROTATION_VECTOR, and I let my device idle on a flat surface, the value is near to 0. But when using GAME_ROTATION_VECTOR, the value is SOMETIMES not near to 0. The only solution I found is to restart the device, and the value of GAME_ROTATION_VECTOR will back to normal. However, it will become wrong again after awhile, possibly DRIFT. (but android docs stated GAME_ROTATION_VECTOR will not drift???) – tcboy88 May 06 '14 at 04:29

0 Answers0