@@ -23,81 +23,6 @@ namespace hako::drone_physics {
23
23
* Maths section (3D frame transformations between body and ground)
24
24
*/
25
25
26
- /*
27
- * For generic vectors. all vector types can be available including
28
- * velocity, acceleration, angular ones, but NOT for angles/angular rates(EULERS).
29
- */
30
- VectorType ground_vector_from_body (
31
- const VectorType& body,
32
- const EulerType& angle)
33
- {
34
- using std::sin ; using std::cos ;
35
- const auto
36
- c_phi = cos (angle.phi ), s_phi = sin (angle.phi ),
37
- c_theta = cos (angle.theta ), s_theta = sin (angle.theta ),
38
- c_psi = cos (angle.psi ), s_psi = sin (angle.psi );
39
-
40
- const auto [x, y, z] = body;
41
-
42
- /*
43
- * eq.(1.71),(1.124) in Nonami's book.
44
- * See also https://mtkbirdman.com/flight-dynamics-body-axes-system
45
- * for the transformation equations.
46
- */
47
- /* ****************************************************************/
48
- double
49
- x_e = (c_theta * c_psi) * x
50
- + (s_phi * s_theta * c_psi - c_phi * s_psi) * y
51
- + (c_phi * s_theta * c_psi + s_phi * s_psi) * z;
52
- double
53
- y_e = (c_theta * s_psi) * x
54
- + (s_phi * s_theta * s_psi + c_phi * c_psi) * y
55
- + (c_phi * s_theta * s_psi - s_phi * c_psi) * z;
56
- double
57
- z_e = (- s_theta) * x
58
- + (s_phi * c_theta) * y
59
- + (c_phi * c_theta) * z;
60
- /* ****************************************************************/
61
-
62
- return {x_e, y_e, z_e};
63
- }
64
-
65
- /* for generic vectors. use the meaningful aliases below */
66
- VectorType body_vector_from_ground (
67
- const VectorType& ground,
68
- const EulerType& angle)
69
- {
70
- using std::sin ; using std::cos ;
71
- const auto
72
- c_phi = cos (angle.phi ), s_phi = sin (angle.phi ),
73
- c_theta = cos (angle.theta ), s_theta = sin (angle.theta ),
74
- c_psi = cos (angle.psi ), s_psi = sin (angle.psi );
75
- const auto [x_e, y_e, z_e] = ground;
76
- /*
77
- * See eq.(1.69), inverse of (1.124) in Nonami's book.
78
- * See also https://mtkbirdman.com/flight-dynamics-body-axes-system
79
- * for the transformation equations.
80
- */
81
- /* ****************************************************************/
82
- double
83
- x = (c_theta * c_psi) * x_e
84
- + (c_theta * s_psi) * y_e
85
- - (s_theta) * z_e;
86
-
87
- double
88
- y = (s_phi * s_theta * c_psi - c_phi * s_psi) * x_e
89
- + (s_phi * s_theta * s_psi + c_phi * c_psi) * y_e
90
- + (s_phi * c_theta) * z_e;
91
-
92
- double
93
- z = (c_phi * s_theta * c_psi + s_phi * s_psi) * x_e
94
- + (c_phi * s_theta * s_psi - s_phi * c_psi) * y_e
95
- + (c_phi * c_theta) * z_e;
96
- /* ****************************************************************/
97
-
98
- return {x, y, z};
99
- }
100
-
101
26
/* Tranlsform angular rate in body frame to ground frame eq.(1.109)*/
102
27
EulerRateType euler_rate_from_body_angular_velocity (
103
28
const AngularVelocityType& body,
0 commit comments