0.4.1
Loading...
Searching...
No Matches
SNRMask.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 SNRMask.hpp
10/// @brief Signal to Noise Ratio Mask
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2023-12-17
13
14#pragma once
15
16#include <array>
17
20
21namespace NAV
22{
23
24/// Signal to Noise Ratio Mask
26{
27 public:
28 /// @brief Default Constructor
29 SNRMask();
30
31 /// @brief Shows a button to select the SNR Mask
32 /// @param[in] label Text to display on the button. If empty, just 'SNR Mask' will be written
33 bool ShowGuiWidgets(const char* label = nullptr);
34
35 /// @brief Checks wether all SNR values are 0
36 [[nodiscard]] bool isInactive() const;
37
38 /// @brief Checks wether the SNR values passes the SNR mask
39 /// @param[in] freq Frequency of the signal
40 /// @param[in] elevation Elevation in [rad] of the satellite transmitting the signal
41 /// @param[in] SNR Signal to Noise Ratio in [dbHz]
42 /// @return True if the value passed the mask
43 [[nodiscard]] bool checkSNRMask(Frequency freq, double elevation, double SNR) const;
44
45 /// @brief Disables the SNR mask by setting all values to 0
46 void disable()
47 {
48 for (auto& m : mask)
49 {
50 for (auto& snr : m.second.first)
51 {
52 snr = 0.0;
53 }
54 }
55 }
56
57 private:
58 /// @brief Elevations [rad]. Checks to smaller or equal than the value
59 static constexpr std::array<double, 10> elevations = {
60 deg2rad(5.0),
61 deg2rad(15.0),
62 deg2rad(25.0),
63 deg2rad(35.0),
64 deg2rad(45.0),
65 deg2rad(55.0),
66 deg2rad(65.0),
67 deg2rad(75.0),
68 deg2rad(85.0),
69 deg2rad(90.0),
70 };
71
72 /// @brief Values when changed override all others
73 std::pair<std::array<double, elevations.size()>, bool> allOverride = { {}, true };
74
75 /// @brief Masks for all frequencies and SNR [dbHz] values + lock together boolean
76 std::array<std::pair<Frequency, std::pair<std::array<double, elevations.size()>, bool>>, Frequency::GetAll().size()> mask;
77
78 friend void to_json(json& j, const SNRMask& obj);
79 friend void from_json(const json& j, SNRMask& obj);
80};
81
82/// @brief Converts the provided object into json
83/// @param[out] j Json object which gets filled with the info
84/// @param[in] obj Object to convert into json
85void to_json(json& j, const SNRMask& obj);
86/// @brief Converts the provided json object into a node object
87/// @param[in] j Json object with the needed values
88/// @param[out] obj Object to fill from the json
89void from_json(const json& j, SNRMask& obj);
90
91} // namespace NAV
nlohmann::json json
json namespace
Frequency definition for different satellite systems.
Frequency definition for different satellite systems.
Definition Frequency.hpp:59
static constexpr std::array< Frequency, 27 > GetAll()
Returns a list with all possible frequencies.
Signal to Noise Ratio Mask.
Definition SNRMask.hpp:26
friend void from_json(const json &j, SNRMask &obj)
Converts the provided json object into a node object.
Definition SNRMask.cpp:208
bool checkSNRMask(Frequency freq, double elevation, double SNR) const
Checks wether the SNR values passes the SNR mask.
Definition SNRMask.cpp:181
friend void to_json(json &j, const SNRMask &obj)
Converts the provided object into json.
Definition SNRMask.cpp:200
bool ShowGuiWidgets(const char *label=nullptr)
Shows a button to select the SNR Mask.
Definition SNRMask.cpp:35
std::pair< std::array< double, elevations.size()>, bool > allOverride
Values when changed override all others.
Definition SNRMask.hpp:73
SNRMask()
Default Constructor.
Definition SNRMask.cpp:25
static constexpr std::array< double, 10 > elevations
Elevations [rad]. Checks to smaller or equal than the value.
Definition SNRMask.hpp:59
std::array< std::pair< Frequency, std::pair< std::array< double, elevations.size()>, bool > >, Frequency::GetAll().size()> mask
Masks for all frequencies and SNR [dbHz] values + lock together boolean.
Definition SNRMask.hpp:76
void disable()
Disables the SNR mask by setting all values to 0.
Definition SNRMask.hpp:46
bool isInactive() const
Checks wether all SNR values are 0.
Definition SNRMask.cpp:172
void to_json(json &j, const Node &node)
Converts the provided node into a json object.
Definition Node.cpp:990
void from_json(const json &j, Node &node)
Converts the provided json object into a node object.
Definition Node.cpp:1007
constexpr auto deg2rad(const T &deg)
Convert Degree to Radians.
Definition Units.hpp:21