0.5.0
Loading...
Searching...
No Matches
ImuObsSimulated.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 ImuObsSimulated.hpp
10/// @brief Data storage class for simulated IMU observations
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2023-11-20
13
14#pragma once
15
16#include "ImuObsWDelta.hpp"
17
18namespace NAV
19{
20/// VectorNav Observation storage Class
21class ImuObsSimulated final : public ImuObsWDelta
22{
23 public:
24 /// @brief Constructor
25 /// @param[in] imuPos Reference to the position and rotation info of the Imu
26 explicit ImuObsSimulated(const ImuPos& imuPos)
28
29 /// @brief Returns the type of the data class
30 /// @return The data type
31 [[nodiscard]] static std::string type()
32 {
33 return "ImuObsSimulated";
34 }
35
36 /// @brief Returns the type of the data class
37 /// @return The data type
38 [[nodiscard]] std::string getType() const override { return type(); }
39
40 /// @brief Returns the parent types of the data class
41 /// @return The parent data types
42 [[nodiscard]] static std::vector<std::string> parentTypes()
43 {
44 auto parent = ImuObsWDelta::parentTypes();
45 parent.push_back(ImuObsWDelta::type());
46 return parent;
47 }
48
49 /// @brief Returns a vector of data descriptors
50 [[nodiscard]] static std::vector<std::string> GetStaticDataDescriptors()
51 {
53 desc.emplace_back("AccelDynamicsN [m/s^2]");
54 desc.emplace_back("AccelDynamicsE [m/s^2]");
55 desc.emplace_back("AccelDynamicsD [m/s^2]");
56 desc.emplace_back("AngularRateN (ω_nb_n) [rad/s]");
57 desc.emplace_back("AngularRateE (ω_nb_n) [rad/s]");
58 desc.emplace_back("AngularRateD (ω_nb_n) [rad/s]");
59 desc.emplace_back("AccelDynamicsX ECEF [m/s^2]");
60 desc.emplace_back("AccelDynamicsY ECEF [m/s^2]");
61 desc.emplace_back("AccelDynamicsZ ECEF [m/s^2]");
62 desc.emplace_back("AngularRateX ECEF (ω_nb_e) [rad/s]");
63 desc.emplace_back("AngularRateY ECEF (ω_nb_e) [rad/s]");
64 desc.emplace_back("AngularRateZ ECEF (ω_nb_e) [rad/s]");
65 return desc;
66 }
67
68 /// @brief Get the amount of descriptors
69 [[nodiscard]] static constexpr size_t GetStaticDescriptorCount() { return ImuObsWDelta::GetStaticDescriptorCount() + 12; }
70
71 /// @brief Returns a vector of data descriptors
72 [[nodiscard]] std::vector<std::string> staticDataDescriptors() const override { return GetStaticDataDescriptors(); }
73
74 /// @brief Get the amount of descriptors
75 [[nodiscard]] size_t staticDescriptorCount() const override { return GetStaticDescriptorCount(); }
76
77 /// @brief Get the value at the index
78 /// @param idx Index corresponding to data descriptor order
79 /// @return Value if in the observation
80 [[nodiscard]] std::optional<double> getValueAt(size_t idx) const override
81 {
84 switch (idx)
85 {
86 case ImuObsWDelta::GetStaticDescriptorCount() + 0: // AccelDynamicsN [m/s^2]
87 return n_accelDynamics.x();
88 case ImuObsWDelta::GetStaticDescriptorCount() + 1: // AccelDynamicsE [m/s^2]
89 return n_accelDynamics.y();
90 case ImuObsWDelta::GetStaticDescriptorCount() + 2: // AccelDynamicsD [m/s^2]
91 return n_accelDynamics.z();
92 case ImuObsWDelta::GetStaticDescriptorCount() + 3: // AngularRateN (ω_nb_n) [rad/s]
93 return n_angularRateDynamics.x();
94 case ImuObsWDelta::GetStaticDescriptorCount() + 4: // AngularRateE (ω_nb_n) [rad/s]
95 return n_angularRateDynamics.y();
96 case ImuObsWDelta::GetStaticDescriptorCount() + 5: // AngularRateD (ω_nb_n) [rad/s]
97 return n_angularRateDynamics.z();
98 case ImuObsWDelta::GetStaticDescriptorCount() + 6: // AccelDynamicsX ECEF [m/s^2]
99 return e_accelDynamics.x();
100 case ImuObsWDelta::GetStaticDescriptorCount() + 7: // AccelDynamicsY ECEF [m/s^2]
101 return e_accelDynamics.y();
102 case ImuObsWDelta::GetStaticDescriptorCount() + 8: // AccelDynamicsZ ECEF [m/s^2]
103 return e_accelDynamics.z();
104 case ImuObsWDelta::GetStaticDescriptorCount() + 9: // AngularRateX ECEF (ω_nb_e) [rad/s]
105 return e_angularRateDynamics.x();
106 case ImuObsWDelta::GetStaticDescriptorCount() + 10: // AngularRateY ECEF (ω_nb_e) [rad/s]
107 return e_angularRateDynamics.y();
108 case ImuObsWDelta::GetStaticDescriptorCount() + 11: // AngularRateZ ECEF (ω_nb_e) [rad/s]
109 return e_angularRateDynamics.z();
110 default:
111 return std::nullopt;
112 }
113 }
114
115 /// @brief Set the value at the index
116 /// @param idx Index corresponding to data descriptor order
117 /// @param value Value to set
118 /// @return True if the value was updated
119 [[nodiscard]] bool setValueAt(size_t idx, double value) override
120 {
122 if (idx < ImuObsWDelta::GetStaticDescriptorCount()) { return ImuObsWDelta::setValueAt(idx, value); }
123 switch (idx)
124 {
125 case ImuObsWDelta::GetStaticDescriptorCount() + 0: // AccelDynamicsN [m/s^2]
126 n_accelDynamics.x() = value;
127 break;
128 case ImuObsWDelta::GetStaticDescriptorCount() + 1: // AccelDynamicsE [m/s^2]
129 n_accelDynamics.y() = value;
130 break;
131 case ImuObsWDelta::GetStaticDescriptorCount() + 2: // AccelDynamicsD [m/s^2]
132 n_accelDynamics.z() = value;
133 break;
134 case ImuObsWDelta::GetStaticDescriptorCount() + 3: // AngularRateN (ω_nb_n) [rad/s]
135 n_angularRateDynamics.x() = value;
136 break;
137 case ImuObsWDelta::GetStaticDescriptorCount() + 4: // AngularRateE (ω_nb_n) [rad/s]
138 n_angularRateDynamics.y() = value;
139 break;
140 case ImuObsWDelta::GetStaticDescriptorCount() + 5: // AngularRateD (ω_nb_n) [rad/s]
141 n_angularRateDynamics.z() = value;
142 break;
143 case ImuObsWDelta::GetStaticDescriptorCount() + 6: // AccelDynamicsX ECEF [m/s^2]
144 e_accelDynamics.x() = value;
145 break;
146 case ImuObsWDelta::GetStaticDescriptorCount() + 7: // AccelDynamicsY ECEF [m/s^2]
147 e_accelDynamics.y() = value;
148 break;
149 case ImuObsWDelta::GetStaticDescriptorCount() + 8: // AccelDynamicsZ ECEF [m/s^2]
150 e_accelDynamics.z() = value;
151 break;
152 case ImuObsWDelta::GetStaticDescriptorCount() + 9: // AngularRateX ECEF (ω_nb_e) [rad/s]
153 e_angularRateDynamics.x() = value;
154 break;
155 case ImuObsWDelta::GetStaticDescriptorCount() + 10: // AngularRateY ECEF (ω_nb_e) [rad/s]
156 e_angularRateDynamics.y() = value;
157 break;
158 case ImuObsWDelta::GetStaticDescriptorCount() + 11: // AngularRateZ ECEF (ω_nb_e) [rad/s]
159 e_angularRateDynamics.z() = value;
160 break;
161 default:
162 return false;
163 }
164
165 return true;
166 }
167
168 /// The acceleration derived from the trajectory in [m/s^2], given in the NED frame.
169 Eigen::Vector3d n_accelDynamics;
170 /// The angular rate ω_nb_n derived from the trajectory in [rad/s], given in the NED frame.
171 Eigen::Vector3d n_angularRateDynamics;
172
173 /// The acceleration derived from the trajectory in [m/s^2], given in the ECEF frame.
174 Eigen::Vector3d e_accelDynamics;
175 /// The angular rate ω_nb_e derived from the trajectory in [rad/s], given in the ECEF frame.
176 Eigen::Vector3d e_angularRateDynamics;
177};
178
179} // namespace NAV
#define INS_ASSERT(_EXPR)
Assert function wrapper.
Definition Assert.h:19
Data storage class for one VectorNavImu observation.
Eigen::Vector3d e_accelDynamics
The acceleration derived from the trajectory in [m/s^2], given in the ECEF frame.
static std::vector< std::string > GetStaticDataDescriptors()
Returns a vector of data descriptors.
static constexpr size_t GetStaticDescriptorCount()
Get the amount of descriptors.
Eigen::Vector3d e_angularRateDynamics
The angular rate ω_nb_e derived from the trajectory in [rad/s], given in the ECEF frame.
std::vector< std::string > staticDataDescriptors() const override
Returns a vector of data descriptors.
bool setValueAt(size_t idx, double value) override
Set the value at the index.
Eigen::Vector3d n_angularRateDynamics
The angular rate ω_nb_n derived from the trajectory in [rad/s], given in the NED frame.
static std::string type()
Returns the type of the data class.
std::optional< double > getValueAt(size_t idx) const override
Get the value at the index.
static std::vector< std::string > parentTypes()
Returns the parent types of the data class.
std::string getType() const override
Returns the type of the data class.
size_t staticDescriptorCount() const override
Get the amount of descriptors.
Eigen::Vector3d n_accelDynamics
The acceleration derived from the trajectory in [m/s^2], given in the NED frame.
ImuObsSimulated(const ImuPos &imuPos)
Constructor.
bool setValueAt(size_t idx, double value) override
Set the value at the index.
static constexpr size_t GetStaticDescriptorCount()
Get the amount of descriptors.
static std::string type()
Returns the type of the data class.
static std::vector< std::string > GetStaticDataDescriptors()
Returns a vector of data descriptors.
ImuObsWDelta(const ImuPos &imuPos)
Constructor.
std::optional< double > getValueAt(size_t idx) const override
Get the value at the index.
static std::vector< std::string > parentTypes()
Returns the parent types of the data class.
const ImuPos & imuPos
Position and rotation information for conversion from platform to body frame.
Definition ImuObs.hpp:172
IMU Position.
Definition ImuPos.hpp:26