# How to translate MATLAB's euler angle quadrotor equations into body frame?

5 views (last 30 days)
Johannes Ihle on 26 Apr 2024
Answered: SAI SRUJAN on 1 May 2024
In the following MIT lecture notes Equation (6.10) is given with body-frame angular velocities, whereas in this Matlab tutorial, the equations are given in euler angles. I have tried, using cross product properties, to translate between the two. The two equation presentations are given in detail in this post, I was unable to move the latex expressions over to Matlab's latex editor.

SAI SRUJAN on 1 May 2024
Hi Johannes,
I understand that you are facing an issue translating the MATLAB's euler angle quadrotor equations into body frame angular velocities.
To address the transformation of Euler angle-based quadrotor dynamics into body frame representations within MATLAB, the following code uses symbolic math to define the transformation and calculate the body frame angular velocities from given Euler angle rates.
Please go through the following code sample to proceed further,
syms phi theta psi dot_phi dot_theta dot_psi
T = [1, 0, -sin(theta);
0, cos(phi), cos(theta)*sin(phi);
0, -sin(phi), cos(theta)*cos(phi)];
eulerRates = [dot_phi; dot_theta; dot_psi];
bodyFrameVelocities = T * eulerRates;
p = bodyFrameVelocities(1);
q = bodyFrameVelocities(2);
r = bodyFrameVelocities(3);
I hope this helps!