0.4.1
Loading...
Searching...
No Matches
PressToHgt.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 PressToHgt.hpp
10/// @brief Pressure to height converter
11/// @author T. Hobiger (hobiger@ins.uni-stuttgart.de)
12/// @date 2025-02-10
13
14#pragma once
15
19
20namespace NAV
21{
22/// Pressure to height converter
23class PressToHgt : public Node
24{
25 public:
26 /// @brief Default constructor
27 PressToHgt();
28 /// @brief Destructor
29 ~PressToHgt() override;
30 /// @brief Copy constructor
31 PressToHgt(const PressToHgt&) = delete;
32 /// @brief Move constructor
34 /// @brief Copy assignment operator
35 PressToHgt& operator=(const PressToHgt&) = delete;
36 /// @brief Move assignment operator
38
39 /// @brief String representation of the Class Type
40 [[nodiscard]] static std::string typeStatic();
41
42 /// @brief String representation of the Class Type
43 [[nodiscard]] std::string type() const override;
44
45 /// @brief String representation of the Class Category
46 [[nodiscard]] static std::string category();
47
48 /// @brief ImGui config window which is shown on double click
49 /// @attention Don't forget to set _hasConfig to true in the constructor of the node
50 void guiConfig() override;
51
52 /// @brief Saves the node into a json object
53 [[nodiscard]] json save() const override;
54
55 /// @brief Restores the node from a json object
56 /// @param[in] j Json object with the node state
57 void restore(const json& j) override;
58
59 private:
60 constexpr static size_t OUTPUT_PORT_INDEX_BAROHEIGHT = 0; ///< @brief Flow
61 constexpr static size_t INPUT_PORT_INDEX_POS = 0; ///< @brief Flow
62
63 /// @brief Initialize the node
64 bool initialize() override;
65
66 /// @brief Deinitialize the node
67 void deinitialize() override;
68
69 /// @brief Converts the RtklibPosObs into PosVel
70 /// @param[in] queue Queue with all the received data messages
71 /// @param[in] pinIdx Index of the pin the data is received on
72 void receiveObs(InputPin::NodeDataQueue& queue, size_t pinIdx);
73
74 /// Temperature at Sea level in deg K
75 double _temp0 = 288.15;
76 /// Pressure at Sea level in hPa
77 double _pressure0 = 1013.25;
78 /// Temperature lapse rate in K / m
79 double _lapserate = 0.00976;
80 /// Geoid undulation in m
81 double _geoidhgt = 0.0;
82 /// Gravity in m / s²
84
85 /// save computations, by storing g * M / R0 / L;
87
88 /// Initial position in LLA [deg, deg, m] for the calculation of the local gravity through EGM96
89 Eigen::Vector3d _initPos{ 48.780509, 9.171712, 300.0 };
90
91 /// @brief Available options for gravity input
92 enum class GravityInput : uint8_t
93 {
94 Manual, ///< Manual entry of the gravity's magnitude
95 Position, ///< Entry of the position, gravity is then deducted from EGM96
96 COUNT, ///< Number of items in the enum
97 };
98
99 /// Default gravity input type
101
102 /// @brief Converts the enum to a string
103 /// @param[in] value Enum value to convert into text
104 /// @return String representation of the enum
105 friend constexpr const char* to_string(GravityInput value);
106};
107
108/// @brief Converts the enum to a string
109/// @param[in] value Enum value to convert into text
110/// @return String representation of the enum
111constexpr const char* to_string(NAV::PressToHgt::GravityInput value)
112{
113 switch (value)
114 {
116 return "Manual";
118 return "Position";
120 return "";
121 }
122 return "";
123};
124
125} // namespace NAV
Holds all Constants.
nlohmann::json json
json namespace
Node Class.
Random Number Generator.
TsDeque< std::shared_ptr< const NAV::NodeData > > NodeDataQueue
Node data queue type.
Definition Pin.hpp:707
static constexpr double Rg
Universal gas constant in [J/K/mol].
static constexpr double dMtr
Molar mass of dry air in [kg/mol].
static constexpr double G_NORM
Standard gravity in [m / s^2].
Definition Constants.hpp:40
Node(std::string name)
Constructor.
Definition Node.cpp:30
void deinitialize() override
Deinitialize the node.
bool initialize() override
Initialize the node.
double _temp0
Temperature at Sea level in deg K.
double _geoidhgt
Geoid undulation in m.
void guiConfig() override
ImGui config window which is shown on double click.
double _lapserate
Temperature lapse rate in K / m.
std::string type() const override
String representation of the Class Type.
PressToHgt & operator=(PressToHgt &&)=delete
Move assignment operator.
PressToHgt(PressToHgt &&)=delete
Move constructor.
~PressToHgt() override
Destructor.
static constexpr size_t OUTPUT_PORT_INDEX_BAROHEIGHT
Flow.
GravityInput
Available options for gravity input.
@ COUNT
Number of items in the enum.
@ Position
Entry of the position, gravity is then deducted from EGM96.
@ Manual
Manual entry of the gravity's magnitude.
void restore(const json &j) override
Restores the node from a json object.
static constexpr size_t INPUT_PORT_INDEX_POS
Flow.
PressToHgt & operator=(const PressToHgt &)=delete
Copy assignment operator.
static std::string category()
String representation of the Class Category.
double _gravity
Gravity in m / s²
static std::string typeStatic()
String representation of the Class Type.
GravityInput _gravityInput
Default gravity input type.
double _exponent
save computations, by storing g * M / R0 / L;
PressToHgt()
Default constructor.
PressToHgt(const PressToHgt &)=delete
Copy constructor.
double _pressure0
Pressure at Sea level in hPa.
Eigen::Vector3d _initPos
Initial position in LLA [deg, deg, m] for the calculation of the local gravity through EGM96.
void receiveObs(InputPin::NodeDataQueue &queue, size_t pinIdx)
Converts the RtklibPosObs into PosVel.
json save() const override
Saves the node into a json object.
friend constexpr const char * to_string(GravityInput value)
Converts the enum to a string.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.