Compass Plugin and Tilt Compensation

sisaacks

New member
Joined
Jul 5, 2023
Messages
2
Programming Experience
10+
I am developing an app where I need a compass to account for tilt compensation.
I noticed that James Montemagno and cbartonnh created the Compass Plugin
They use SensorManager.GetRotationMatrix and SensorManager.GetOrientation in OnSensorChanged
I have googled and googled but I cant confirm if these methods are actually accounting for tilt.
The info I did find was about Android and not iOS.
Any help would be much appreciated
 
Can you explain what he does with those matrix values? If you know what he is doing with those, then that would tell you if they account for tilt or not.
 
Here is the link:
Here is the code:
SensorManager.GetRotationMatrix(r, null, lastAccelerometer, lastMagnetometer);
SensorManager.GetOrientation(r, orientation);
var azimuthInRadians = orientation[0];
var azimuthInDegress = (Java.Lang.Math.ToDegrees(azimuthInRadians) + 360.0) % 360.0;
Being that the second value for GetRotaion is NULL, I dont believe this is accounting for tilt compensation.
But I am not 100% sure.
 
Back
Top Bottom