INSTINCT Code Coverage Report


Directory: src/
File: Navigation/INS/Mechanization.hpp
Date: 2025-02-07 16:54:41
Exec Total Coverage
Lines: 7 15 46.7%
Functions: 1 2 50.0%
Branches: 5 14 35.7%

Line Branch Exec Source
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 /// @file Mechanization.hpp
10 /// @brief Inertial Navigation Mechanization Functions
11 /// @author T. Topp (topp@ins.uni-stuttgart.de)
12 /// @author M. Maier (marcel.maier@ins.uni-stuttgart.de)
13 /// @date 2023-12-11
14
15 #pragma once
16
17 #include <type_traits>
18
19 #include "Navigation/Gravity/Gravity.hpp"
20
21 namespace NAV
22 {
23
24 /// @brief Values needed to calculate the PosVelAttDerivative for the local-navigation frame
25 template<std::floating_point Scalar>
26 struct PosVelAttDerivativeConstants
27 {
28 GravitationModel gravitationModel = GravitationModel::EGM96; ///< Gravity Model to use
29 bool coriolisAccelerationCompensationEnabled = true; ///< Apply the Coriolis acceleration compensation to the measured accelerations
30 bool centrifgalAccelerationCompensationEnabled = true; ///< Apply the centrifugal acceleration compensation to the measured accelerations
31 bool angularRateEarthRotationCompensationEnabled = true; ///< Apply the Earth rotation rate compensation to the measured angular rates
32 bool angularRateTransportRateCompensationEnabled = true; ///< Apply the transport rate compensation to the measured angular rates
33 Scalar timeDifferenceSec = 0.0; ///< Time difference over the whole integration step [s]
34 };
35
36 /// @brief Write info to a json object
37 /// @param[out] j Json output
38 /// @param[in] data Object to read info from
39 template<std::floating_point Scalar>
40 void to_json(json& j, const PosVelAttDerivativeConstants<Scalar>& data)
41 {
42 j = json{
43 { "gravitationModel", data.gravitationModel },
44 { "coriolisAccelerationCompensationEnabled", data.coriolisAccelerationCompensationEnabled },
45 { "centrifgalAccelerationCompensationEnabled", data.centrifgalAccelerationCompensationEnabled },
46 { "angularRateEarthRotationCompensationEnabled", data.angularRateEarthRotationCompensationEnabled },
47 { "angularRateTransportRateCompensationEnabled", data.angularRateTransportRateCompensationEnabled },
48 };
49 }
50 /// @brief Read info from a json object
51 /// @param[in] j Json variable to read info from
52 /// @param[out] data Output object
53 template<std::floating_point Scalar>
54 19 void from_json(const json& j, PosVelAttDerivativeConstants<Scalar>& data)
55 {
56
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 if (j.contains("gravitationModel")) { j.at("gravitationModel").get_to(data.gravitationModel); }
57
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 if (j.contains("coriolisAccelerationCompensationEnabled")) { j.at("coriolisAccelerationCompensationEnabled").get_to(data.coriolisAccelerationCompensationEnabled); }
58
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 if (j.contains("centrifgalAccelerationCompensationEnabled")) { j.at("centrifgalAccelerationCompensationEnabled").get_to(data.centrifgalAccelerationCompensationEnabled); }
59
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 if (j.contains("angularRateEarthRotationCompensationEnabled")) { j.at("angularRateEarthRotationCompensationEnabled").get_to(data.angularRateEarthRotationCompensationEnabled); }
60
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 if (j.contains("angularRateTransportRateCompensationEnabled")) { j.at("angularRateTransportRateCompensationEnabled").get_to(data.angularRateTransportRateCompensationEnabled); }
61 19 }
62
63 } // namespace NAV
64