-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathomegaDerivFromEuler.m
64 lines (53 loc) · 2.17 KB
/
omegaDerivFromEuler.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function omega_gb_b_dt = omegaFromEuler2( eulerAngles_dt2, ...
eulerAngles_dt, eulerAngles ) %#codegen
% omegaFromEuler computes the first time derivate of the
% angular velcocity.
%
% Literature:
% [1] Holzapfel, F. (2004). Nichtlineare adaptive Regelung eines
% unbemannten Fluggeraetes (Doctoral dissertation, Technische
% Universitaet Muenchen).
%
% Inputs:
% eulerAngles_dt2 vector (3x1) of second time derivates of the
% Euler angles, in rad/s
% eulerAngles_dt vector (3x1) of the first time derivates of the
% Euler angles, in rad/s
% eulerAngles vector (3x1) of the Euler angles, in rad
%
% Outputs:
% omega_gb_b_dt vector (3x1) of the first time derivatives of the
% angular velocity of the body relative to the earth
% represented in earth frame, in rad/s^2
%
% See also: omegaFromEuler
%
% Disclaimer:
% SPDX-License-Identifier: GPL-3.0-only
%
% Copyright (C) 2020-2022 Yannic Beyer
% Copyright (C) 2022 TU Braunschweig, Institute of Flight Guidance
% *************************************************************************
Phi = eulerAngles(1);
Theta = eulerAngles(2);
Phi_dt = eulerAngles_dt(1);
Theta_dt = eulerAngles_dt(2);
sin_Phi = sin( Phi );
cos_Phi = cos( Phi );
sin_Theta = sin( Theta );
cos_Theta = cos( Theta );
M1 = [ 1, 0, -sin_Theta; ...
0, cos_Phi, cos_Theta*sin_Phi; ...
0, -sin_Phi, cos_Theta*cos_Phi];
M2 = [ 0, 0, 0; ...
0, -sin_Phi, cos_Theta*cos_Phi; ...
0, -cos_Phi, -cos_Theta*sin_Phi];
M3 = [ 0, 0, -cos_Theta; ...
0, 0, -sin_Theta*sin_Phi; ...
0, 0, -sin_Theta*cos_Phi];
% compute the first time derivative of the Euler angles according to
% [1, page 132]
omega_gb_b_dt = (M1 * eulerAngles_dt2) + ...
(M2 * eulerAngles_dt)*Phi_dt + ...
(M3 * eulerAngles_dt)*Theta_dt;
end