0.3.0
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
13
14#pragma once
15
16#include "NodeData/NodeData.hpp"
17#include "util/Assert.h"
18
19namespace NAV
20{
22class BaroPressObs : public NodeData
23{
24 public:
27 [[nodiscard]] static std::string type()
28 {
29 return "BaroPressObs";
30 }
31
34 [[nodiscard]] std::string getType() const override { return type(); }
35
38 [[nodiscard]] static std::vector<std::string> parentTypes()
39 {
40 return { NodeData::type() };
41 }
42
44 [[nodiscard]] static std::vector<std::string> GetStaticDataDescriptors()
45 {
46 return {
47 "BaroPressObs [hPa]",
48 "BaroPressObs StDev [hPa]"
49 };
50 }
51
53 [[nodiscard]] static constexpr size_t GetStaticDescriptorCount() { return 2; }
54
56 [[nodiscard]] std::vector<std::string> staticDataDescriptors() const override { return GetStaticDataDescriptors(); }
57
59 [[nodiscard]] size_t staticDescriptorCount() const override { return GetStaticDescriptorCount(); }
60
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
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
101 double baro_pressure{ std::nan("") };
102
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.
Definition BaroPressObs.hpp:23
bool setValueAt(size_t idx, double value) override
Set the value at the index.
Definition BaroPressObs.hpp:82
static constexpr size_t GetStaticDescriptorCount()
Get the number of descriptors.
Definition BaroPressObs.hpp:53
std::optional< double > baro_pressureStdev
Standard deviation of barometric pressure.
Definition BaroPressObs.hpp:104
std::optional< double > getValueAt(size_t idx) const override
Get the value at the index.
Definition BaroPressObs.hpp:64
std::string getType() const override
Returns the type of the data class.
Definition BaroPressObs.hpp:34
double baro_pressure
Barometric pressure [hPa].
Definition BaroPressObs.hpp:101
static std::vector< std::string > parentTypes()
Returns the parent types of the data class.
Definition BaroPressObs.hpp:38
std::vector< std::string > staticDataDescriptors() const override
Returns a vector of data descriptors.
Definition BaroPressObs.hpp:56
static std::string type()
Returns the type of the data class.
Definition BaroPressObs.hpp:27
static std::vector< std::string > GetStaticDataDescriptors()
Returns a vector of data descriptors.
Definition BaroPressObs.hpp:44
size_t staticDescriptorCount() const override
Get the number of descriptors.
Definition BaroPressObs.hpp:59
NodeData()=default
Default constructor.
static std::string type()
Returns the type of the data class.
Definition NodeData.hpp:45