Magnetometer coordinates differ testing on different devices

Hi all!

I am working with a 360 degree image, that one can navigate by moving an iPad around.

I use pictures from Ricoh Theta and bind them to a sphere. Then I get the magnetometer information using @trentbrooks’ xCoreMotion (thanks for making the addon and putting this up!!) and make them into a ofQuaternion. At specific x,y,z I then add buttons to play specific sounds on touch.

I test on an iPad mini 4 gen and everything works ok, but I tried an iPad mini 2 and also an iPhone 5C and the magnetometer information is completely different, ranging to completely different numbers…

Am I doing something wrong? It seems unlikely that magnetometer coordinates are device specific or resolution dependent…
just looking at this:

ofVec3f m = coreMotion.getMagnetometerData();
cout<<"magnetometer x,y,z = "<< ofToString(m.x, 3) <<" "<< ofToString(m.y, 3) <<" "<< ofToString(m.z, 3)<<endl;

Many thanks for the help!

hey @marcod,

I’m not a 100% sure on the magnetometer, but the accelerometer also has a different range on older devices (-+2g) compared to newer (-+8g) due to better sensors (http://stackoverflow.com/a/722611). I’m guessing the same is true for the magnetometer- this demo app seems to confirm https://github.com/foundry/MagnetoMeter

Is there a reason your using the magnetometer to look around the inside of your sphere? If you want the orientation of the device you can use the ‘device attitude’- and setup with either CMAttitudeReferenceFrameXMagneticNorthZVertical or CMAttitudeReferenceFrameXTrueNorthZVertical. The ‘example-camera’ shows how to do this.

Good luck.

2 Likes

Thanks! I completely missed that, silly me!

And is there a better (proper) way to find absolute positions of the device than looking for quat.x() between these values and quat.y() between these other values… changing the orientation of the iPad affects the attitude although the view is still the same (the sphere texture visible at that position). It would be nice to have a way to lock that position independently from device orientation.

Anyway, thanks so much for your help and again for addon!
Cheers,m.

Do you mean absolute orientation? You can’t get absolute positional information (moving up/down/left/right/forward/backward). For orientation, besides configuring with magnetic north or true north - you can set your own custom reference frame as the default view (i do this in the other example/ app on double tap).

1 Like