Device orientation discrepancies between iOS and Android

I try to get a common orientation matrix or Quaternion between iOS and Android, but I get different reading from the fused sensors.
When I say reading I mean that I print to the screen every 300 ms the X,Y,Z,W values of the reading in both platform.
In Android, I use Rotation Vector and in iOS I use Device Motion, both gives back Quaternion representation of the device orientation relative to magnetic pole and gravity (centre of the earth).
But the reading are different (probably units or ranges or computational approaches) and I try to find a way to "calibrate" Android (or iOS for that matter) so that it will be align with iOS in such way that if I hold both devices in the same orientation close to each other, the print will be the same.

I know for example that the android accelerometer behave as follow:
android accelerometer x / (-9.81) = ios accelerometer x
android accelerometer y / (-9.81) = ios accelerometer y
android accelerometer z / (-9.81) = ios accelerometer z

I've tried it and it worked, so align only the accelerometer is easy (we simply divide android values by the gravity constant 9.81)
And I guess I can find the other discrepancies in the other individual sensors an align them individual as well.
But the point is to use the fused virtual sensor, AKA SensorType.RotationVector in android and Device motion in iOS .

In android I use SensorManager.GetQuaternionFromVector
in iOS I use CMMotionManager.DeviceMotion.Attitude.Quaternion

Any help how to align the values some how will be greatly appreciated.



  • LandLuLandLu Member, Xamarin Team Xamurai

    Can you explain more about fused virtual sensor? What is AKA SensorType.RotationVector used for?

  • RoySadakaRoySadaka USMember ✭✭

    I ended up using the raw sensors data and not fused ones
    To your question, RotationVector is a "Software Sensor" from Android that behave like a sensor (with X,Y,Z) but its values are computed from multiple "Hardware Sensors".


Sign In or Register to comment.