I'm trying to understand the implementation of accelerometer and magnetometer as an orientation device.
If I make some assumptions that gravity is uniform and no external acceleration occurs I have 1 known vector. G=1 (Gx=0,Gy=0,Gz=1)
My magnetometer gives another vector Magnetic north. assuming corrected for Hard and Soft Iron offsets and normalised. M=1 (Mx=0,My=1,Mz=0)
It is the cross product of these two vectors that gives me my 3rd vector (magnetic east?) which is perpendicular to both previous vectors. This I understand but I don't understand how to create a value for this from my 2 readings. in a formula sense what combination of Gx/Gy/Gz || Mx/My/Mz = Ex/Ey/Ez
all sensor readings are normalized so the vector would represent -1 \ 1 as min and max values and essentially represents points around a sphere.
My G should allow me to form a rotation matrix around X and Y axis. My M should allow me to forma a rotation matrix around X and Z axis My E should allow me to form a rotation matrix around Y and Z axis. allowing for cross referencing.
does sound like reasonable mathematical approach to this problem. I have read many articles online which all seem to jump straight to C+ coding which I'm not savvy with so I am trying to understand the mathematics so I can work out the implementation.
Thank you. apologies if it is a done question before but I can't find a clear solution or answer that makes sense. my Maths understand used to be much better that it is now, but even so matrixes etc were not something I studied at A level physics or O level Maths. I'm a surgeon now, so neither plays an ongoing role in my work.
Didn’t understand your context completely but just to aid the computations putting across the formulas
cross product of two vectors in Cartesian form is given by
Rotation matrices are as follows:
An example is shown below To multiply z component by 90 deg