I implemented a listener for both the rotation vector and the orientation vector, although I know that it has depreciated. I wanted to check both.
I know that the rotation vector is a merge sensor and is recommended, but according to it to the north (the value [0] returned by GetOrientation (rotationMatrix, value) geaving bearing 0 ) does not coincide with the North from the orientation sensor. I also calculated from different applications from the game store, the values ββof the orientation sensors seem to be closer to them.
In addition, many times my azimuth value [0] from Rotation_Vector, then getOrientation just shoots and continues to fluctuate between -180 and 180
PS "getRotationMatrix (float [] R, float [] I, float [] gravity, float [] geomagnetic)" also gives the same result as the rotation vector.
public final void onSensorChanged(SensorEvent event) { float rotationMatrix[]; switch(event.sensor.getType()) { . . . case Sensor.TYPE_ROTATION_VECTOR: rotationMatrix=new float[16]; mSensorManager.getRotationMatrixFromVector(rotationMatrix,event.values); determineOrientation(rotationMatrix); break; case Sensor.TYPE_ORIENTATION: sensorZValue.setText(""+event.values[0]);
I want to determine the angle between the phoneβs axis Y and the βVectorβ pointer pointing north , so this was my initial implementation. Please suggest.
android android-sensors magnetometer rotational-matrices
pxm
source share