0.2.0
Loading...
Searching...
No Matches
MultiImuFile.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
20
22
23namespace NAV
24{
26class MultiImuFile : public Node, public FileReader
27{
28 public:
32 ~MultiImuFile() override;
34 MultiImuFile(const MultiImuFile&) = delete;
41
43 [[nodiscard]] static std::string typeStatic();
44
46 [[nodiscard]] std::string type() const override;
47
49 [[nodiscard]] static std::string category();
50
53 void guiConfig() override;
54
56 [[nodiscard]] json save() const override;
57
60 void restore(const json& j) override;
61
63 bool resetNode() override;
64
66 [[nodiscard]] const ImuPos& imuPosition() const { return _imuPos; }
67
68 protected:
71
72 private:
73 constexpr static size_t OUTPUT_PORT_INDEX_IMU_OBS = 0;
74
76 bool initialize() override;
77
79 void deinitialize() override;
80
82 void updateNumberOfOutputPins();
83
86 NAV::FileReader::FileType determineFileType() override;
87
89 void readHeader() override;
90
95 [[nodiscard]] std::shared_ptr<const NodeData> pollData(size_t pinIdx, bool peek);
96
98 size_t _nSensors = 5;
99
101 double _gpsRate = 1;
102
107 std::vector<std::map<InsTime, std::shared_ptr<ImuObs>>> _messages;
108
110 size_t _lineCounter{};
111
113 std::vector<size_t> _messageCnt;
114
116 char _delim = ',';
117
119 double _startupGpsSecond{};
120
122 gui::widgets::TimeEditFormat _startTimeEditFormat;
123
125 InsTime _startTime{ 2000, 1, 1, 0, 0, 0 };
126
128 std::vector<std::string> _columns{ "sensorId", "gpsSecond", "timeNumerator", "timeDenominator", "accelX", "accelY", "accelZ", "gyroX", "gyroY", "gyroZ" };
129
131 std::vector<std::string> _headerColumns{ "nmeaMsgType", "UTC_HMS", "day", "month", "year" };
132
134 std::vector<ImuPos> _imuPosAll;
135
137 InsTime _lastFiltObs{};
138
140 bool _gpzdaFound = false;
142 bool _gpggaFound = false;
143
145 enum class NmeaType
146 {
147 GPGGA,
148 GPZDA,
149 COUNT,
150 };
154 friend constexpr const char* to_string(NmeaType value);
155
157 NmeaType _nmeaType = NmeaType::GPZDA;
158};
159
163constexpr const char* to_string(NAV::MultiImuFile::NmeaType value)
164{
165 switch (value)
166 {
167 case NAV::MultiImuFile::NmeaType::GPGGA:
168 return "GPGGA";
169 case NAV::MultiImuFile::NmeaType::GPZDA:
170 return "GPZDA";
171 case NAV::MultiImuFile::NmeaType::COUNT:
172 return "";
173 }
174 return "";
175}
176
177} // namespace NAV
Abstract File Reader class.
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
Parent Class for all IMU Observations.
Imu Position Data.
@ COUNT
Amount of items in the enum.
Node Class.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
Widget to modify time point values.
Abstract File Reader class.
Definition FileReader.hpp:31
auto peek()
Looking ahead in the stream.
Definition FileReader.hpp:149
FileType
File Type Enumeration.
Definition FileReader.hpp:35
IMU Position.
Definition ImuPos.hpp:26
File reader for Multi-IMU data log files.
Definition MultiImuFile.hpp:27
static std::string category()
String representation of the Class Category.
MultiImuFile()
Default constructor.
bool resetNode() override
Resets the node. Moves the read cursor to the start.
MultiImuFile & operator=(const MultiImuFile &)=delete
Copy assignment operator.
MultiImuFile & operator=(MultiImuFile &&)=delete
Move assignment operator.
const ImuPos & imuPosition() const
Position and rotation information for conversion from platform to body frame.
Definition MultiImuFile.hpp:66
MultiImuFile(MultiImuFile &&)=delete
Move constructor.
json save() const override
Saves the node into a json object.
void restore(const json &j) override
Restores the node from a json object.
friend constexpr const char * to_string(NmeaType value)
Converts the enum to a string.
Definition MultiImuFile.hpp:163
MultiImuFile(const MultiImuFile &)=delete
Copy constructor.
~MultiImuFile() override
Destructor.
ImuPos _imuPos
Position and rotation information for conversion from platform to body frame.
Definition MultiImuFile.hpp:70
void guiConfig() override
ImGui config window which is shown on double click.
std::string type() const override
String representation of the Class Type.
static std::string typeStatic()
String representation of the Class Type.
Abstract parent class for all nodes.
Definition Node.hpp:86