0.4.1
Loading...
Searching...
No Matches
BaroPressObs.hpp
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/// @file BaroPressObs.hpp
10/// @brief Barometric Pressure 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
19namespace NAV
20{
21/// Barometric pressure storage class
22class BaroPressObs : public NodeData
23{
24 public:
25 /// @brief Returns the type of the data class
26 /// @return The data type
27 [[nodiscard]] static std::string type()
28 {
29 return "BaroPressObs";
30 }
31
32 /// @brief Returns the type of the data class
33 /// @return The data type
34 [[nodiscard]] std::string getType() const override { return type(); }
35
36 /// @brief Returns the parent types of the data class
37 /// @return The parent data types
38 [[nodiscard]] static std::vector<std::string> parentTypes()
39 {
40 return { NodeData::type() };
41 }
42
43 /// @brief Returns a vector of data descriptors
44 [[nodiscard]] static std::vector<std::string> GetStaticDataDescriptors()
45 {
46 return {
47 "BaroPressObs [hPa]",
48 "BaroPressObs StDev [hPa]"
49 };
50 }
51
52 /// @brief Get the number of descriptors
53 [[nodiscard]] static constexpr size_t GetStaticDescriptorCount() { return 2; }
54
55 /// @brief Returns a vector of data descriptors
56 [[nodiscard]] std::vector<std::string> staticDataDescriptors() const override { return GetStaticDataDescriptors(); }
57
58 /// @brief Get the number of descriptors
59 [[nodiscard]] size_t staticDescriptorCount() const override { return GetStaticDescriptorCount(); }
60
61 /// @brief Get the value at the index
62 /// @param idx Index corresponding to data descriptor order
63 /// @return Value if in the observation
64 [[nodiscard]] std::optional<double> getValueAt(size_t idx) const override
65 {
66 switch (idx)
67 {
68 case 0: // BaroPressObs [hPa]
69 return baro_pressure;
70 case 1: // BaroPressObs StDev [hPa]
71 return baro_pressureStdev;
72 default:
73 return std::nullopt;
74 }
75 return std::nullopt;
76 }
77
78 /// @brief Set the value at the index
79 /// @param idx Index corresponding to data descriptor order
80 /// @param value Value to set
81 /// @return True if the value was updated
82 [[nodiscard]] bool setValueAt(size_t idx, double value) override
83 {
85 switch (idx)
86 {
87 case 0: // Baro pressure [hPa]
88 baro_pressure = value;
89 break;
90 case 1: // Baro pressure StDev [hPa]
91 baro_pressureStdev = value;
92 break;
93 default:
94 return false;
95 }
96
97 return true;
98 }
99
100 /// Barometric pressure [hPa]
101 double baro_pressure{ std::nan("") };
102
103 /// Standard deviation of barometric pressure
104 std::optional<double> baro_pressureStdev;
105};
106
107} // namespace NAV
Assertion helpers.
#define INS_ASSERT(_EXPR)
Assert function wrapper.
Definition Assert.h:19
Abstract NodeData Class.
Barometric pressure storage class.
bool setValueAt(size_t idx, double value) override
Set the value at the index.
static constexpr size_t GetStaticDescriptorCount()
Get the number of descriptors.
std::optional< double > baro_pressureStdev
Standard deviation of barometric pressure.
std::optional< double > getValueAt(size_t idx) const override
Get the value at the index.
std::string getType() const override
Returns the type of the data class.
double baro_pressure
Barometric pressure [hPa].
static std::vector< std::string > parentTypes()
Returns the parent types of the data class.
std::vector< std::string > staticDataDescriptors() const override
Returns a vector of data descriptors.
static std::string type()
Returns the type of the data class.
static std::vector< std::string > GetStaticDataDescriptors()
Returns a vector of data descriptors.
size_t staticDescriptorCount() const override
Get the number of descriptors.
NodeData()=default
Default constructor.
static std::string type()
Returns the type of the data class.
Definition NodeData.hpp:45