thomas-haslwanter / scikit-kinematics

Python functions for working with 3D kinematics.
Other
126 stars 45 forks source link

R_init doesn't work as intended with manual sensors. #41

Open EmpireOfTheTsun opened 4 years ago

EmpireOfTheTsun commented 4 years ago

N.B. I have tested this using a manual sensor with data gathered previously, both with and without magnetometer values (using Madgwick and Analytical, respectively).

EDIT: Based on further review, I believe that R_init is not ignored entirely, but valid rotation matricies don't produce the desired effect (see below). I have therefore removed some previous analysis in this post.

I am new to IMUs and kinematics in general, so if I have made some error, I deeply apologise. Thank you for your time.

EmpireOfTheTsun commented 4 years ago
initOrientation = np.array([[0.707,.707,0], #Initial orientation. Arbitrary, as model should converge to true orientation quickly.
                            [-.707,0.707,0],
                            [0,0,1]])

inputData = {'rate':50,
        'acc':accData,
        'omega':gyroData}
sensor = manual.MyOwnSensor(in_data=inputData, R_init=initOrientation)

Gives a visualisation of: image

EmpireOfTheTsun commented 4 years ago

UPDATE: Using the initOrientation above (which I believe should be a 45 degree rotation around the z axis) results in an initial quaternion of [ 1.00000000e+00 -6.93889390e-18 1.73472348e-18 8.67361738e-19] Instead of the usual [1,0,0,0]. So it appears that R_init is having an effect, but a much milder one than anticipated.

Furthermore, rotation matrices such as the ones used here do not produce any deviation from the default orientation, when it should produce a 180 degree rotation around the Z axis.