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 BaroHgt.hpp | ||
10 | /// @brief Barometric Height Storage Class | ||
11 | /// @author T. Hobiger (hobiger@ins.uni-stuttgart.de) | ||
12 | /// @date 2025-02-10 | ||
13 | |||
14 | #pragma once | ||
15 | |||
16 | #include "NodeData/NodeData.hpp" | ||
17 | #include "util/Assert.h" | ||
18 | #include <Eigen/src/Core/MatrixBase.h> | ||
19 | |||
20 | namespace NAV | ||
21 | { | ||
22 | /// Barometric height storage class | ||
23 | class BaroHgt : public NodeData | ||
24 | { | ||
25 | public: | ||
26 | /// @brief Returns the type of the data class | ||
27 | /// @return The data type | ||
28 | 941 | [[nodiscard]] static std::string type() | |
29 | { | ||
30 |
1/2✓ Branch 1 taken 941 times.
✗ Branch 2 not taken.
|
1882 | return "BaroHgt"; |
31 | } | ||
32 | |||
33 | /// @brief Returns the type of the data class | ||
34 | /// @return The data type | ||
35 | ✗ | [[nodiscard]] std::string getType() const override { return type(); } | |
36 | |||
37 | /// @brief Returns the parent types of the data class | ||
38 | /// @return The parent data types | ||
39 | 112 | [[nodiscard]] static std::vector<std::string> parentTypes() | |
40 | { | ||
41 |
3/6✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 112 times.
✓ Branch 4 taken 112 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
336 | return { NodeData::type() }; |
42 | 112 | } | |
43 | |||
44 | /// @brief Returns a vector of data descriptors | ||
45 | ✗ | [[nodiscard]] static std::vector<std::string> GetStaticDataDescriptors() | |
46 | { | ||
47 | return { | ||
48 | "BaroHgt [m]", | ||
49 | "BaroHgt StDev [m]" | ||
50 | ✗ | }; | |
51 | } | ||
52 | |||
53 | /// @brief Get the amount of descriptors | ||
54 | ✗ | [[nodiscard]] static constexpr size_t GetStaticDescriptorCount() { return 2; } | |
55 | |||
56 | /// @brief Returns a vector of data descriptors | ||
57 | ✗ | [[nodiscard]] std::vector<std::string> staticDataDescriptors() const override { return GetStaticDataDescriptors(); } | |
58 | |||
59 | /// @brief Get the amount of descriptors | ||
60 | ✗ | [[nodiscard]] size_t staticDescriptorCount() const override { return GetStaticDescriptorCount(); } | |
61 | |||
62 | /// @brief Get the value at the index | ||
63 | /// @param idx Index corresponding to data descriptor order | ||
64 | /// @return Value if in the observation | ||
65 | ✗ | [[nodiscard]] std::optional<double> getValueAt(size_t idx) const override | |
66 | { | ||
67 | ✗ | INS_ASSERT(idx < GetStaticDescriptorCount()); | |
68 | ✗ | switch (idx) | |
69 | { | ||
70 | ✗ | case 0: // BaroHgt [m] | |
71 | ✗ | return baro_height; | |
72 | ✗ | case 1: // BaroHgt StDev [m] | |
73 | ✗ | return baro_heightStdev; | |
74 | ✗ | default: | |
75 | ✗ | return std::nullopt; | |
76 | } | ||
77 | return std::nullopt; | ||
78 | } | ||
79 | |||
80 | /// @brief Set the value at the index | ||
81 | /// @param idx Index corresponding to data descriptor order | ||
82 | /// @param value Value to set | ||
83 | /// @return True if the value was updated | ||
84 | ✗ | [[nodiscard]] bool setValueAt(size_t idx, double value) override | |
85 | { | ||
86 | ✗ | INS_ASSERT(idx < GetStaticDescriptorCount()); | |
87 | ✗ | switch (idx) | |
88 | { | ||
89 | ✗ | case 0: // BaroHgt [m] | |
90 | ✗ | baro_height = value; | |
91 | ✗ | break; | |
92 | ✗ | case 1: // BaroHgt StDev [m] | |
93 | ✗ | baro_heightStdev = value; | |
94 | ✗ | break; | |
95 | ✗ | default: | |
96 | ✗ | return false; | |
97 | } | ||
98 | |||
99 | ✗ | return true; | |
100 | } | ||
101 | |||
102 | /// Barometric height [m] | ||
103 | double baro_height{ std::nan("") }; | ||
104 | |||
105 | /// Standard deviation of barometric height [m] | ||
106 | std::optional<double> baro_heightStdev; | ||
107 | }; | ||
108 | |||
109 | } // namespace NAV | ||
110 |