0.3.0
Loading...
Searching...
No Matches
ErrorEquations.cpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#include "ErrorEquations.hpp"
10
12
13namespace NAV
14{
15
16Eigen::Matrix3d n_F_dpsi_dpsi(const Eigen::Vector3d& n_omega_in)
17{
18 // Math: \mathbf{F}_{11}^n = -[\mathbf{\omega}_{in}^n \land]
19 Eigen::Matrix3d skewMat;
20 // clang-format off
21 skewMat << 0 , n_omega_in(2), -n_omega_in(1),
22 -n_omega_in(2), 0 , n_omega_in(0),
23 n_omega_in(1), -n_omega_in(0), 0 ;
24 // clang-format on
25 return skewMat;
26}
27
28Eigen::Matrix3d n_F_dpsi_dv(double latitude, double height, double R_N, double R_E)
29{
30 // Math: \mathbf{F}_{12}^n = \begin{bmatrix} 0 & -\frac{1}{R_E + h} & 0 \\ \frac{1}{R_N + h} & 0 & 0 \\ 0 & \frac{\tan{\phi}}{R_E + h} & 0 \end{bmatrix}
31 Eigen::Matrix3d n_F_12 = Eigen::Matrix3d::Zero(3, 3);
32
33 n_F_12(0, 1) = -1 / (R_E + height);
34 n_F_12(1, 0) = 1 / (R_N + height);
35 n_F_12(2, 1) = std::tan(latitude) / (R_E + height);
36
37 return n_F_12;
38}
39
40Eigen::Matrix3d n_F_dpsi_dr(double latitude, double height, const Eigen::Vector3d& n_velocity, double R_N, double R_E)
41{
42 const double& v_N = n_velocity(0); // North velocity in [m/s]
43 const double& v_E = n_velocity(1); // East velocity in [m/s]
44
45 // Math: \mathbf{F}_{13}^n = \begin{bmatrix} \omega_{ie}\sin{\phi} & 0 & \frac{v_E}{(R_E + h)^2} \\ 0 & 0 & -\frac{v_N}{(R_N + h)^2} \\ \omega_{ie}\cos{\phi} + \frac{v_E}{(R_E + h)\cos^2{\phi}} & 0 & -\frac{v_E\tan{\phi}}{(R_E + h)^2} \end{bmatrix}
46 Eigen::Matrix3d n_F_13 = Eigen::Matrix3d::Zero(3, 3);
47
48 n_F_13(0, 0) = InsConst::omega_ie * std::sin(latitude);
49 n_F_13(0, 2) = v_E / std::pow(R_E + height, 2.0);
50 n_F_13(1, 2) = -v_N / std::pow(R_N + height, 2.0);
51 n_F_13(2, 0) = InsConst::omega_ie * std::cos(latitude)
52 + v_E / ((R_E + height) * std::pow(std::cos(latitude), 2));
53 n_F_13(2, 2) = -v_E * std::tan(latitude) / std::pow(R_E + height, 2.0);
54
55 return n_F_13;
56}
57
58Eigen::Matrix3d n_F_dpsi_dw(const Eigen::Matrix3d& n_Dcm_b)
59{
60 return n_Dcm_b;
61}
62
63Eigen::Matrix3d n_F_dv_dpsi(const Eigen::Vector3d& n_force_ib)
64{
65 const auto& f_N = n_force_ib(0); // Specific force in North direction in [m/s^2]
66 const auto& f_E = n_force_ib(1); // Specific force in East direction in [m/s^2]
67 const auto& f_D = n_force_ib(2); // Specific force in Down direction in [m/s^2]
68
69 // Math: \mathbf{F}_{21}^n = \begin{bmatrix} (-\mathbf{C}_{b}^n \hat{f}_{ib}^b) \land \end{bmatrix}
70 Eigen::Matrix3d skewMat;
71 // clang-format off
72 skewMat << 0 , f_D, -f_E,
73 -f_D, 0 , f_N,
74 f_E, -f_N, 0 ;
75 // clang-format on
76
77 return skewMat;
78}
79
80Eigen::Matrix3d n_F_dv_dv(const Eigen::Vector3d& n_velocity, double latitude, double height, double R_N, double R_E)
81{
82 const double& v_N = n_velocity(0); // North velocity in [m/s]
83 const double& v_E = n_velocity(1); // East velocity in [m/s]
84 const double& v_D = n_velocity(2); // Down velocity in [m/s]
85
86 // Math: \mathbf{F}_{22}^n = \begin{bmatrix} \frac{v_D}{R_N+h} & -2\frac{v_E\tan{\phi}}{R_E+h}-2\omega_{ie}\sin{\phi} & \frac{v_N}{R_N+h} \\ \frac{v_E\tan{\phi}}{R_E+h}+2\omega_{ie}\sin{\phi} & \frac{v_N\tan{\phi}+v_D}{R_E+h} & \frac{v_E}{R_E+h}+2\omega_{ie}\cos{\phi} \\ -\frac{2v_N}{R_N+h} & -\frac{2v_E}{R_E+h}-2\omega_{ie}\cos{\phi} & 0 \end{bmatrix}
87 Eigen::Matrix3d n_F_22 = Eigen::Matrix3d::Zero(3, 3);
88
89 n_F_22(0, 0) = v_D / (R_N + height);
90 n_F_22(0, 1) = -2.0 * v_E * std::tan(latitude) / (R_E + height)
91 - 2.0 * InsConst::omega_ie * std::sin(latitude);
92 n_F_22(0, 2) = v_N / (R_N + height);
93 n_F_22(1, 0) = v_E * std::tan(latitude) / (R_E + height)
94 + 2.0 * InsConst::omega_ie * std::sin(latitude);
95 n_F_22(1, 1) = (v_N * std::tan(latitude) + v_D) / (R_E + height);
96 n_F_22(1, 2) = v_E / (R_E + height)
97 + 2.0 * InsConst::omega_ie * std::cos(latitude);
98 n_F_22(2, 0) = -2.0 * v_N / (R_N + height);
99 n_F_22(2, 1) = -2.0 * v_E / (R_E + height)
100 - 2.0 * InsConst::omega_ie * std::cos(latitude);
101
102 return n_F_22;
103}
104
105Eigen::Matrix3d n_F_dv_dr(const Eigen::Vector3d& n_velocity, double latitude, double height, double R_N, double R_E, double g_0, double r_eS_e)
106{
107 // Math: \mathbf{F}_{23}^n = \begin{bmatrix} -\frac{v_E^2}{(R_E+h)\cos^2{\phi}}-2v_E\omega_{ie}\cos{\phi} & 0 & \frac{v_E^2\tan{\phi}}{(R_E+h)^2}-\frac{v_Nv_D}{(R_N+h)^2} \\ \frac{v_Nv_E}{(R_E+h)\cos^2{\phi}}+2v_N\omega_{ie}\cos{\phi}-2v_D\omega_{ie}\sin{\phi} & 0 & -\frac{v_Nv_E\tan{\phi}+v_Ev_D}{(R_E+h)^2} \\ 2v_E\omega_{ie}\sin{\phi} & 0 & \frac{v_E^2}{(R_E+h)^2}+\frac{v_N^2}{(R_N+h)^2}-\frac{2g_0}{r_{eS}^e} \end{bmatrix}
108 Eigen::Matrix3d n_F_23 = Eigen::Matrix3d::Zero(3, 3);
109
110 const double& v_N = n_velocity(0);
111 const double& v_E = n_velocity(1);
112 const double& v_D = n_velocity(2);
113
114 n_F_23(0, 0) = -std::pow(v_E, 2) / ((R_E + height) * std::pow(std::cos(latitude), 2.0))
115 - 2.0 * v_E * InsConst::omega_ie * std::cos(latitude);
116
117 n_F_23(0, 2) = std::pow(v_E, 2) * std::tan(latitude) / std::pow(R_E + height, 2.0)
118 - (v_N * v_D) / std::pow(R_N + height, 2.0);
119
120 n_F_23(1, 0) = v_N * v_E / ((R_E + height) * std::pow(std::cos(latitude), 2.0))
121 + 2.0 * v_N * InsConst::omega_ie * std::cos(latitude)
122 - 2.0 * v_D * InsConst::omega_ie * std::sin(latitude);
123
124 n_F_23(1, 2) = -(v_N * v_E * std::tan(latitude) + v_E * v_D) / std::pow(R_E + height, 2.0);
125
126 n_F_23(2, 0) = 2.0 * v_E * InsConst::omega_ie * std::sin(latitude);
127
128 n_F_23(2, 2) = std::pow(v_E, 2) / std::pow(R_E + height, 2.0)
129 + std::pow(v_N, 2) / std::pow(R_N + height, 2.0)
130 - 2 * g_0 / r_eS_e;
131
132 return n_F_23;
133}
134
135Eigen::Matrix3d n_F_dv_df(const Eigen::Matrix3d& n_Dcm_b)
136{
137 return n_Dcm_b;
138}
139
140Eigen::Matrix3d n_F_dr_dv(double latitude, double height, double R_N, double R_E)
141{
142 // Math: \mathbf{F}_{32}^n = \begin{bmatrix} \frac{1}{R_N + h} & 0 & 0 \\ 0 & \frac{1}{(R_E + h)\cos{\phi}} & 0 \\ 0 & 0 & -1 \end{bmatrix} \quad \text{P. Groves}\,(14.70)
143 Eigen::Matrix3d n_F_32 = Eigen::Matrix3d::Zero(3, 3);
144 n_F_32(0, 0) = 1.0 / (R_N + height);
145 n_F_32(1, 1) = 1.0 / ((R_E + height) * std::cos(latitude));
146 n_F_32(2, 2) = -1;
147
148 return n_F_32;
149}
150
151Eigen::Matrix3d n_F_dr_dr(const Eigen::Vector3d& n_velocity, double latitude, double height, double R_N, double R_E)
152{
153 const double& v_N = n_velocity(0);
154 const double& v_E = n_velocity(1);
155
156 // Math: \mathbf{F}_{33}^n = \begin{bmatrix} 0 & 0 & -\frac{v_N}{(R_N + h)^2} \\ \frac{v_E \tan{\phi}}{(R_E + h) \cos{\phi}} & 0 & -\frac{v_E}{(R_E + h)^2 \cos{\phi}} \\ 0 & 0 & 0 \end{bmatrix} \quad \text{P. Groves}\,(14.71)
157 Eigen::Matrix3d n_F_33 = Eigen::Matrix3d::Zero(3, 3);
158
159 n_F_33(0, 2) = -v_N / std::pow(R_N + height, 2.0);
160 n_F_33(1, 0) = v_E * std::tan(latitude) / ((R_E + height) * std::cos(latitude));
161 n_F_33(1, 2) = -v_E / (std::pow(R_E + height, 2.0) * std::cos(latitude));
162
163 return n_F_33;
164}
165
166Eigen::Matrix3d n_F_df_df(const Eigen::Vector3d& beta_a)
167{
168 // Math: \mathbf{F}_{a} = - \begin{bmatrix} \beta_{a,1} & 0 & 0 \\ 0 & \beta_{a,2} & 0 \\ 0 & 0 & \beta_{a,2} \end{bmatrix} \quad \text{T. Hobiger}\,(6.3)
169 return -1.0 * beta_a.asDiagonal();
170}
171
172Eigen::Matrix3d n_F_dw_dw(const Eigen::Vector3d& beta_omega)
173{
174 // Math: \mathbf{F}_{\omega} = - \begin{bmatrix} \beta_{\omega,1} & 0 & 0 \\ 0 & \beta_{\omega,2} & 0 \\ 0 & 0 & \beta_{\omega,2} \end{bmatrix} \quad \text{T. Hobiger}\,(6.3)
175 return -1.0 * beta_omega.asDiagonal();
176}
177
178} // namespace NAV
Holds all Constants.
Error Equations for the local navigation frame.
static constexpr double omega_ie
Nominal mean angular velocity of the Earth in [rad/s].
Eigen::Matrix3d n_F_dv_df(const Eigen::Matrix3d &n_Dcm_b)
Calculates the matrix 𝐅_𝜓'_𝛿f.
Eigen::Matrix3d n_F_dpsi_dr(double latitude, double height, const Eigen::Vector3d &n_velocity, double R_N, double R_E)
Calculates the matrix 𝐅_𝜓'_𝛿r.
Eigen::Matrix3d n_F_dpsi_dv(double latitude, double height, double R_N, double R_E)
Calculates the matrix 𝐅_𝜓'_𝛿v.
Eigen::Matrix3d n_F_dr_dv(double latitude, double height, double R_N, double R_E)
Calculates the matrix 𝐅_𝛿r'_𝛿v.
Eigen::Matrix3d n_F_dv_dr(const Eigen::Vector3d &n_velocity, double latitude, double height, double R_N, double R_E, double g_0, double r_eS_e)
Calculates the matrix 𝐅_𝛿v'_𝛿r.
Eigen::Matrix3d n_F_dpsi_dw(const Eigen::Matrix3d &n_Dcm_b)
Calculates the matrix 𝐅_𝜓'_𝛿ω
Eigen::Matrix3d n_F_dw_dw(const Eigen::Vector3d &beta_omega)
Calculates the matrix 𝐅_𝛿ω'_𝛿ω
Eigen::Matrix3d n_F_dv_dpsi(const Eigen::Vector3d &n_force_ib)
Calculates the matrix 𝐅_𝛿v'_𝜓
Eigen::Matrix3d n_F_df_df(const Eigen::Vector3d &beta_a)
Calculates the matrix 𝐅_𝛿f'_𝛿f.
Eigen::Matrix3d n_F_dpsi_dpsi(const Eigen::Vector3d &n_omega_in)
Calculates the matrix 𝐅_𝜓'_𝜓
Eigen::Matrix3d n_F_dr_dr(const Eigen::Vector3d &n_velocity, double latitude, double height, double R_N, double R_E)
Calculates the matrix 𝐅_𝛿r'_𝛿r.
Eigen::Matrix3d n_F_dv_dv(const Eigen::Vector3d &n_velocity, double latitude, double height, double R_N, double R_E)
Calculates the matrix 𝐅_𝛿v'_𝛿v.