0.2.0
Loading...
Searching...
No Matches
PosVelAttInitializer.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
17
19
24
27
28#include <limits>
29
30namespace NAV
31{
34{
35 public:
48
50 [[nodiscard]] static std::string typeStatic();
51
53 [[nodiscard]] std::string type() const override;
54
56 [[nodiscard]] static std::string category();
57
60 void guiConfig() override;
61
63 [[nodiscard]] json save() const override;
64
67 void restore(const json& j) override;
68
69 private:
70 constexpr static size_t OUTPUT_PORT_INDEX_POS_VEL_ATT = 0;
71
73 int _inputPinIdxIMU = -1;
75 int _inputPinIdxGNSS = -1;
76
78 bool initialize() override;
79
81 void deinitialize() override;
82
84 void updatePins();
85
87 void finalizeInit();
88
92 void receiveImuObs(InputPin::NodeDataQueue& queue, size_t pinIdx);
93
97 void receiveGnssObs(InputPin::NodeDataQueue& queue, size_t pinIdx);
98
101 void receiveUbloxObs(const std::shared_ptr<const UbloxObs>& obs);
102
105 void receivePosObs(const std::shared_ptr<const Pos>& obs);
106
109 void receivePosVelObs(const std::shared_ptr<const PosVel>& obs);
110
113 void receivePosVelAttObs(const std::shared_ptr<const PosVelAtt>& obs);
114
117 [[nodiscard]] std::shared_ptr<const NodeData> pollPVASolution();
118
120 double _initDuration = 5.0;
121
123 uint64_t _startTime = 0;
124
126 enum class AttitudeMode
127 {
128 BOTH,
129 IMU,
130 GNSS,
131 COUNT,
132 };
133
137 friend constexpr const char* to_string(AttitudeMode attitudeMode);
138
140 AttitudeMode _attitudeMode = AttitudeMode::BOTH;
141
143 bool _overridePosition = false;
145 gui::widgets::PositionWithFrame _overridePositionValue;
146
148 double _positionAccuracyThreshold = 10;
150 std::array<double, 3> _lastPositionAccuracy = { std::numeric_limits<double>::infinity(),
151 std::numeric_limits<double>::infinity(),
152 std::numeric_limits<double>::infinity() };
153
155 enum class VelocityOverride
156 {
157 OFF,
158 ECEF,
159 NED,
160 COUNT,
161 };
162
166 friend constexpr const char* to_string(VelocityOverride velOverride);
167
169 VelocityOverride _overrideVelocity = VelocityOverride::OFF;
171 Eigen::Vector3d _overrideVelocityValues = Eigen::Vector3d::Zero();
173 double _velocityAccuracyThreshold = 10;
175 std::array<double, 3> _lastVelocityAccuracy = { std::numeric_limits<double>::infinity(),
176 std::numeric_limits<double>::infinity(),
177 std::numeric_limits<double>::infinity() };
178
180 double _countAveragedAttitude = 0.0;
182 std::array<double, 3> _averagedAttitude = { 0.0, 0.0, 0.0 };
184 std::array<bool, 3> _overrideRollPitchYaw = { false, false, false };
186 std::array<double, 3> _overrideRollPitchYawValues = {};
187
189 std::array<bool, 4> _posVelAttInitialized = { false, false, false, false };
190
192 gui::widgets::TimeEditFormat _initTimeEditFormat;
193
195 InsTime _initTime = InsTime(InsTime_GPSweekTow(0, 0, 0));
197 Eigen::Quaterniond _n_Quat_b_init;
199 Eigen::Vector3d _e_initPosition;
201 Eigen::Vector3d _n_initVelocity;
202};
203
207constexpr const char* to_string(PosVelAttInitializer::AttitudeMode attitudeMode)
208{
209 switch (attitudeMode)
210 {
211 case NAV::PosVelAttInitializer::AttitudeMode::BOTH:
212 return "Both";
213 case NAV::PosVelAttInitializer::AttitudeMode::IMU:
214 return "IMU";
215 case NAV::PosVelAttInitializer::AttitudeMode::GNSS:
216 return "GNSS";
217 case NAV::PosVelAttInitializer::AttitudeMode::COUNT:
218 return "";
219 }
220 return "";
221}
222
226constexpr const char* to_string(PosVelAttInitializer::VelocityOverride velOverride)
227{
228 switch (velOverride)
229 {
230 case NAV::PosVelAttInitializer::VelocityOverride::OFF:
231 return "OFF";
232 case NAV::PosVelAttInitializer::VelocityOverride::ECEF:
233 return "ECEF";
234 case NAV::PosVelAttInitializer::VelocityOverride::NED:
235 return "NED";
236 case NAV::PosVelAttInitializer::VelocityOverride::COUNT:
237 return "";
238 }
239 return "";
240}
241
242} // namespace NAV
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
Parent Class for all IMU Observations.
The class is responsible for all time-related tasks.
@ COUNT
Amount of items in the enum.
Node Class.
Position, Velocity and Attitude Storage Class.
Position Input GUI widgets.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
RTKLIB Pos Observation Class.
Widget to modify time point values.
ublox Observation Class
Abstract parent class for all nodes.
Definition Node.hpp:86
Position, Velocity, Attitude Initializer from GPS and IMU data.
Definition PosVelAttInitializer.hpp:34
PosVelAttInitializer & operator=(PosVelAttInitializer &&)=delete
Move assignment operator.
static std::string typeStatic()
String representation of the Class Type.
static std::string category()
String representation of the Class Category.
friend constexpr const char * to_string(AttitudeMode attitudeMode)
Converts the enum to a string.
Definition PosVelAttInitializer.hpp:207
std::string type() const override
String representation of the Class Type.
PosVelAttInitializer(PosVelAttInitializer &&)=delete
Move constructor.
void guiConfig() override
ImGui config window which is shown on double click.
void restore(const json &j) override
Restores the node from a json object.
~PosVelAttInitializer() override
Destructor.
PosVelAttInitializer()
Default constructor.
json save() const override
Saves the node into a json object.
PosVelAttInitializer & operator=(const PosVelAttInitializer &)=delete
Copy assignment operator.
PosVelAttInitializer(const PosVelAttInitializer &)=delete
Copy constructor.
Position with Reference frame, used for GUI input.
Definition PositionInput.hpp:31