morgil / madgwick_py

A Python implementation of Madgwick's IMU and AHRS algorithm.
GNU Lesser General Public License v3.0
180 stars 60 forks source link

Quaternion Euler/Euler123 issues #5

Open mungewell opened 5 years ago

mungewell commented 5 years ago

Hi, Looks like there is a coding error with Euler123 output, setting different initiation and outputing without updating AHRS gives invalid data

refq = Quaternion(1,0,0,0) # look front
Euler:  (0.0, 0.0, 0.0)
Eu123:  (0.0, 0.0, 0.0)
Quat:   [1 0 0 0]

refq = Quaternion.from_angle_axis(np.pi/2,0,0,1) # look front, sideways
Euler:  (0, 1.5707963267948966, 0.0)
Eu123:  (-0.0, 0.0, 1.5707963267948963)
Quat:   [ 0.70710678  0.          0.          0.70710678]

refq = Quaternion.from_angle_axis(np.pi/2,1,0,0) # look up
Euler:  (1.5707963267948963, 0.0, 0.0)
Eu123:  (1.5707963267948963, 1.5707963267948966, -0.0)
Quat:   [ 0.70710678  0.70710678  0.          0.        ]

refq = Quaternion.from_angle_axis(np.pi/2,0,1,0) # look right
Euler:  (0.0, 0.0, 1.5707963267948963)
Eu123:  (-0.0, 0.0, -0.0)
Quat:   [ 0.70710678  0.          0.70710678  0.        ]

Also discussed here: https://github.com/RiftCat/vridge-api/issues/17

hippoly-bot commented 4 months ago

I agree, still not solved..