I'm trying to calculate the roll and the pitch of my system, a basic inertial unit for monitoring RC plane. I'm using the build-in IMU of an Arduino Nano 33 BLE Sense.
However, the calculation is quite strange. For example, if I apply a rotation continuoulsy around the roll axis, I have this sequence of angle : 0 / 45 / 90 / 45 / 0 / -45 / -90 / -45 / 0.
But, I would like something like that : 0 / 45 / 90 / 135 / 180 / 225 / 270 / 315 / 360(or zero).
The phenomena is the same around the pitch axis.
Have you some ideas for that ?
It is very important to understand that with Euler angles, the order of rotations matters. There are at least a dozen different angular system definitions.
It is working well for compute the roll and pitch angles (using the xyz sequence) but there is something strange about the range of value :
[-90;+90] for pitch ;
[-180;+180] for roll.
If that possible, I would like [-180;+180] also for pitch, did I misunderstand something about Euler angles ?
My purpose is to use these datas for emulate an artificial horizon, so it will be useful to have the full range. So, that means Euler's angles are not the good way for doing that ?
No, it won't. You clearly don't yet understand the math.
No one uses Euler angles for absolute orientation these days, because of the singularity problems this thread has touched on. Use a quaternion to represent absolute orientation instead.
Euler angles are fine to represent nearly level flight.
I understand the problematic now. I am sorry, I am beginner about navigation topics.
So, I need to a quaternion-based algorithm.
According to my internet searches, I have seen the existence of the Madwick's algorithm (seems quaternion-based). Do you think that a good way or there is something more simple ?
The Madgwick and Mahony AHRS filters are popular and libraries for either one are available for the Nano BLE Sense. The Mahony algorithm is shorter and faster.