I'am actually working with an LSM6DSO32 captor, I use kalman filter to get roll and pitch angles. But in certain position I get strange value, suddenly my angle jump for exemple I'am in -79° in pitch and -76° in roll and if I move just a little bit my captor (1- 5°) my angles jump to -0.48 in roll and pitch approach 90°, is it gimbal lock? It's seem that this phenomenon appears only in certain configuration when roll and pitch approch to certain angle
I also try to use Madgwick ahrs and I got the same result...
Ok and there is a solution to this trigonometric problems? It's really strange my roll angle jump suddenly when my pitch is close to 90 or -90°, my roll jump to -80 to 2° suddenly but I moved my captor only by 3-5° max
If I go to the opposite I don't have the problem my roll doesn't move and my pitch decrease to -86° to -10° and this is the good value...
You should work with DCMs or quarternions internally, only converting to roll/pitch for humans. DCMs and quarternions don't have discontinuous behaviour.
Quarternions are usually the most convenient representation for orientation as they are 4 values with 3 DoF (degrees of freedom), whereas a DCM has 9 values with 3 DoF.
An orientation is the same as a 3D rotation, note.
Whatever you do Euler angles will display discontinuity, typically between upright and inverted - its fundamental to that represenation. This is why they are hopeless for calculations.