I hope you can help me and this is the right forum to ask.
In the process of building and programming my own Quadcopter, I encountered the term Euler angles. I took some time to understand them and then wondered why they are used in multicopter systems.
In my understanding Euler angles are used to rotate a point or vector in a coordinate system/ to express that rotation. I now wonder why i should use Euler angles to compute the orientation of the quadcopter as I could easily(at least i think so) compute the angles by themself, like $$ \theta = arctan(y/z) $$ $$ \phi = arctan(x/z) $$ (just using accelerometer, where $x, y, z$ are axis accelerations and $\theta, \phi$ are pitch and roll, respectively. In the actual implementation I do not only use the accelerometer, this is just simplified to make the point clear).
Where exactly are Euler angles used? Are they only used to convert desired trajectory in the earth frame to desired trajectory in the Body frame?
I would be very glad if anyone could point this out and explain the concept/ why and where they are used further.
Edit: As it seems, it is unclear what my problem is. I do know that Euler angles encounter gimbal lock, that they are three rotations about $x, y, z$ axis and how they generally work(I think). @Christo gave a very good explanation.
My question now is, why are they used? Isn't it counterproductive to apply the yaw rotation, then pitch, and then roll?
-Earth frame X,Y,Z
rotation about Z(psi)
->Frame 1 x', y', z'
rotation about y'(theta)
->Frame 2 x'', y'', z''
rotation about x''(phi)
->Body frame x, y, z
and vice versa.
Why? I would just have said:
pitch = angles between X and x
roll = angle between Y and y
yaw = angle between x-y-projection of the magnetic field-vector and the starting vector(yaw is kinda different).
(Notice the difference between uppercase and lowercase, look at the Earth-to-Body-Frame for notation). Tied with this i wonder why the correct formula for pitch($\theta)$ should be $$\theta = \tan^{-1}\left(-f_x/\sqrt{f_y^2+f_z^2}\right)$$ I would have thought $$\theta = \tan^{-1}\left(-f_x/f_z\right)$$ suffices. Maybe I have some flaw in my knowledge or a piece of the puzzle is still missing.
I hope this is understandable, if not feel free to ask. If this gets too crowded, I can always ask another question, just make me aware of it.
Edit finished
Thank you in advance,
WiaF
(sorry for my username)
(If anyone could explain how to use quaternions to express orientation I would be very thankful, but I can also just ask another time. I get the concept of Quaternions, just not how to use them to express orientation not rotation. Again, many thanks)