0.4.1
Loading...
Searching...
No Matches
Units.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 Units.hpp
10/// @brief Units used by the system model parameters
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2024-08-20
13
14#pragma once
15
16#include <cstddef>
17#include <string>
18
19#include "util/Json.hpp"
20
21namespace NAV
22{
23
24namespace Units
25{
26
27/// Possible Units for the Standard deviation of the acceleration due to user motion
28enum class CovarianceAccelUnits : uint8_t
29{
30 m2_s3, ///< [ m^2 / s^3 ]
31 m_sqrts3, ///< [ m / √(s^3) ]
32 COUNT, ///< Amount of items in the enum
33};
34
35/// Possible Units for the Standard deviation of the rotation velocity
37{
38 rad2_s, ///< [ rad^2 / s ]
39 rad_sqrts, ///< [ rad / √(s) ]
40 deg2_s, ///< [ deg^2 / s ]
41 deg_sqrts, ///< [ deg / √(s) ]
42 deg2s_min2, ///< [ deg^2 s / min^2 ]
43 degsqrts_min, ///< [ deg √(s) / min ]
44 COUNT, ///< Amount of items in the enum
45};
46
47/// Possible Units for the Standard deviation of the clock phase drift
48enum class CovarianceClkPhaseDriftUnits : uint8_t
49{
50 m2_s, ///< [ m^2 / s ]
51 m_sqrts, ///< [ m / √(s) ]
52 COUNT, ///< Amount of items in the enum
53};
54
55/// Possible Units for the Standard deviation of the clock frequency drift
57{
58 m2_s3, ///< [ m^2 / s^3 ]
59 m_sqrts3, ///< [ m / √(s^3) ]
60 COUNT, ///< Amount of items in the enum
61};
62
63/// @brief Converts the provided data into a json object
64/// @param[out] j Json object which gets filled with the info
65/// @param[in] data Data to convert into json
66void to_json(json& j, const CovarianceAccelUnits& data);
67/// @brief Converts the provided json object into the data object
68/// @param[in] j Json object with the needed values
69/// @param[out] data Object to fill from the json
70void from_json(const json& j, CovarianceAccelUnits& data);
71
72/// @brief Converts the provided data into a json object
73/// @param[out] j Json object which gets filled with the info
74/// @param[in] data Data to convert into json
75void to_json(json& j, const CovarianceAngularVelocityUnits& data);
76/// @brief Converts the provided json object into the data object
77/// @param[in] j Json object with the needed values
78/// @param[out] data Object to fill from the json
80
81/// @brief Converts the provided data into a json object
82/// @param[out] j Json object which gets filled with the info
83/// @param[in] data Data to convert into json
84void to_json(json& j, const CovarianceClkPhaseDriftUnits& data);
85/// @brief Converts the provided json object into the data object
86/// @param[in] j Json object with the needed values
87/// @param[out] data Object to fill from the json
88void from_json(const json& j, CovarianceClkPhaseDriftUnits& data);
89
90/// @brief Converts the provided data into a json object
91/// @param[out] j Json object which gets filled with the info
92/// @param[in] data Data to convert into json
94/// @brief Converts the provided json object into the data object
95/// @param[in] j Json object with the needed values
96/// @param[out] data Object to fill from the json
98
99} // namespace Units
100
101/// @brief Converts the value depending on the unit provided
102/// @param[in] value Value to convert
103/// @param[in] unit Unit the value is in
104/// @return Value in unit of the first item in the Unit enum
105[[nodiscard]] double convertUnit(const double& value, Units::CovarianceAccelUnits unit);
106
107/// @brief Converts the value depending on the unit provided
108/// @param[in] value Value to convert
109/// @param[in] unit Unit the value is in
110/// @return Value in unit of the first item in the Unit enum
111[[nodiscard]] double convertUnit(const double& value, Units::CovarianceAngularVelocityUnits unit);
112
113/// @brief Converts the value depending on the unit provided
114/// @param[in] value Value to convert
115/// @param[in] unit Unit the value is in
116/// @return Value in unit of the first item in the Unit enum
117[[nodiscard]] double convertUnit(const double& value, Units::CovarianceClkPhaseDriftUnits unit);
118
119/// @brief Converts the value depending on the unit provided
120/// @param[in] value Value to convert
121/// @param[in] unit Unit the value is in
122/// @return Value in unit of the first item in the Unit enum
123[[nodiscard]] double convertUnit(const double& value, Units::CovarianceClkFrequencyDriftUnits unit);
124
125/// @brief Converts the unit into a string
126/// @param[in] unit Unit
127[[nodiscard]] std::string to_string(Units::CovarianceAccelUnits unit);
128/// @brief Converts the unit into a string
129/// @param[in] unit Unit
130[[nodiscard]] std::string to_string(Units::CovarianceAngularVelocityUnits unit);
131/// @brief Converts the unit into a string
132/// @param[in] unit Unit
133[[nodiscard]] std::string to_string(Units::CovarianceClkPhaseDriftUnits unit);
134/// @brief Converts the unit into a string
135/// @param[in] unit Unit
136[[nodiscard]] std::string to_string(Units::CovarianceClkFrequencyDriftUnits unit);
137
138} // namespace NAV
nlohmann::json json
json namespace
Defines how to save certain datatypes to json.
void to_json(json &j, const PositionUncertaintyUnits &data)
Converts the provided data into a json object.
Definition Units.cpp:18
CovarianceAngularVelocityUnits
Possible Units for the Standard deviation of the rotation velocity.
Definition Units.hpp:37
CovarianceClkPhaseDriftUnits
Possible Units for the Standard deviation of the clock phase drift.
Definition Units.hpp:49
@ COUNT
Amount of items in the enum.
Definition Units.hpp:33
CovarianceAccelUnits
Possible Units for the Standard deviation of the acceleration due to user motion.
Definition Units.hpp:29
@ m_sqrts3
[ m / √(s^3) ]
Definition Units.hpp:31
void from_json(const json &j, PositionUncertaintyUnits &data)
Converts the provided json object into the data object.
Definition Units.cpp:22
CovarianceClkFrequencyDriftUnits
Possible Units for the Standard deviation of the clock frequency drift.
Definition Units.hpp:57
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
double convertUnit(const double &value, Units::PositionUncertaintyUnits unit)
Converts the value depending on the unit provided.
Definition Units.cpp:135