0.2.0
Loading...
Searching...
No Matches
Navio2Sensor.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
18#if !__APPLE__ && !defined(WIN32) && !defined(_WIN32) && !defined(__WIN32)
19 #include "Navio/Common/InertialSensor.h"
20#endif
21
23#include <chrono>
24
25namespace NAV
26{
28class Navio2Sensor : public Imu
29{
30 public:
34 ~Navio2Sensor() override;
36 Navio2Sensor(const Navio2Sensor&) = delete;
43
45 [[nodiscard]] static std::string typeStatic();
46
48 [[nodiscard]] std::string type() const override;
49
51 [[nodiscard]] static std::string category();
52
55 void guiConfig() override;
56
58 [[nodiscard]] json save() const override;
59
62 void restore(const json& j) override;
63
65 bool resetNode() override;
66
67 private:
68 constexpr static size_t OUTPUT_PORT_INDEX_IMU_OBS = 0;
69
71 bool initialize() override;
72
74 void deinitialize() override;
75
77 enum ImuType : int
78 {
80 MPU,
82 LSM
83 };
84
85#if !__APPLE__ && !defined(WIN32) && !defined(_WIN32) && !defined(__WIN32)
87 std::unique_ptr<InertialSensor> _sensor;
88#endif
89
91 ImuType _imuType = ImuType::MPU;
92
94 int _outputFrequency = 100;
95
97 CallbackTimer _timer;
99 std::chrono::time_point<std::chrono::steady_clock> _startTime;
100
102 float _ax{};
104 float _ay{};
106 float _az{};
108 float _gx{};
110 float _gy{};
112 float _gz{};
114 float _mx{};
116 float _my{};
118 float _mz{};
119
122 static void readImuThread(void* userData);
123};
124
125} // namespace NAV
Starts a Periodic Timer.
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
Abstract IMU Class.
Manages a thread which calls a specified function at a specified interval.
Definition CallbackTimer.hpp:22
Abstract IMU Class.
Definition Imu.hpp:24
Navio2Sensor Sensor Class.
Definition Navio2Sensor.hpp:29
static std::string typeStatic()
String representation of the Class Type.
std::string type() const override
String representation of the Class Type.
static std::string category()
String representation of the Class Category.
Navio2Sensor()
Default constructor.
void guiConfig() override
ImGui config window which is shown on double click.
bool resetNode() override
Resets the node. It is guaranteed that the node is initialized when this is called.
json save() const override
Saves the node into a json object.
~Navio2Sensor() override
Destructor.
void restore(const json &j) override
Restores the node from a json object.
Navio2Sensor(Navio2Sensor &&)=delete
Move constructor.
Navio2Sensor & operator=(Navio2Sensor &&)=delete
Move assignment operator.
Navio2Sensor & operator=(const Navio2Sensor &)=delete
Copy assignment operator.
Navio2Sensor(const Navio2Sensor &)=delete
Copy constructor.