0.5.0
Loading...
Searching...
No Matches
VectorNavBinaryConverter.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 VectorNavBinaryConverter.hpp
10/// @brief Converts VectorNavBinaryOutput
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2021-07-09
13
14#pragma once
15
18
23
24#include <cstdint>
25#include <memory>
26
27namespace NAV
28{
29/// Converts VectorNavBinaryOutput
31{
32 public:
33 /// @brief Default constructor
35 /// @brief Destructor
37 /// @brief Copy constructor
39 /// @brief Move constructor
41 /// @brief Copy assignment operator
43 /// @brief Move assignment operator
45
46 /// @brief String representation of the Class Type
47 [[nodiscard]] static std::string typeStatic();
48
49 /// @brief String representation of the Class Type
50 [[nodiscard]] std::string type() const override;
51
52 /// @brief String representation of the Class Category
53 [[nodiscard]] static std::string category();
54
55 /// @brief ImGui config window which is shown on double click
56 /// @attention Don't forget to set _hasConfig to true in the constructor of the node
57 void guiConfig() override;
58
59 /// @brief Saves the node into a json object
60 [[nodiscard]] json save() const override;
61
62 /// @brief Restores the node from a json object
63 /// @param[in] j Json object with the node state
64 void restore(const json& j) override;
65
66 /// Enum specifying the type of the output message
67 enum class OutputType : uint8_t
68 {
69 ImuObs, ///< Extract ImuObs data
70 ImuObsWDelta, ///< Extract ImuObsWDelta data
71 BaroPressObs, ///< Extract BaroPressObs data
72 PosVelAtt, ///< Extract PosVelAtt data
73 GnssObs, ///< Extract GnssObs data
74 COUNT, ///< Number of items in the enum
75 };
76
77 private:
78 constexpr static size_t OUTPUT_PORT_INDEX_CONVERTED = 0; ///< @brief Flow
79 constexpr static size_t INPUT_PORT_INDEX_VECTORNAV_BINARY_OUTPUT = 0; ///< @brief Flow (VectorNavBinaryOutput)
80
81 /// The selected output type in the GUI
83
84 /// Enum specifying the source for the PosVelAtt conversion
85 enum PosVelSource : uint8_t
86 {
87 PosVelSource_Best, ///< INS > GNSS1 > GNSS2
88 PosVelSource_Ins, ///< Take only INS values into account
89 PosVelSource_Gnss1, ///< Take only GNSS1 values into account
90 PosVelSource_Gnss2, ///< Take only GNSS2 values into account
91 };
92
93 /// The selected PosVel source in the GUI
95
96 /// GUI option. If checked forces position to a static value and velocity to 0
97 bool _forceStatic = false;
98
99 /// Whether to extract the compensated data or the uncompensated
101
102 /// Position, Velocity and Attitude at initialization (needed for static data)
103 std::shared_ptr<const PosVelAtt> _posVelAtt__init = nullptr;
104
105 /// @brief Initialize the node
106 bool initialize() override;
107
108 /// @brief Converts the VectorNavBinaryOutput observation to the selected message type
109 /// @param[in] queue Queue with all the received data messages
110 /// @param[in] pinIdx Index of the pin the data is received on
111 void receiveObs(InputPin::NodeDataQueue& queue, size_t pinIdx);
112
113 /// @brief Converts the VectorNavBinaryOutput to a ImuObsWDelta observation
114 /// @param[in] vnObs VectorNavBinaryOutput to process
115 /// @return The converted data
116 std::shared_ptr<const ImuObsWDelta> convert2ImuObsWDelta(const std::shared_ptr<const VectorNavBinaryOutput>& vnObs) const;
117
118 /// @brief Converts the VectorNavBinaryOutput to a ImuObs observation
119 /// @param[in] vnObs VectorNavBinaryOutput to process
120 /// @return The converted data
121 std::shared_ptr<const ImuObs> convert2ImuObs(const std::shared_ptr<const VectorNavBinaryOutput>& vnObs) const;
122
123 /// @brief Converts the VectorNavBinaryOutput to a BaroPressObs observation
124 /// @param[in] vnObs VectorNavBinaryOutput to process
125 /// @return The converted data
126 std::shared_ptr<const BaroPressObs> convert2BaroPressObs(const std::shared_ptr<const VectorNavBinaryOutput>& vnObs) const;
127
128 /// @brief Converts the VectorNavBinaryOutput to a PosVelAtt observation
129 /// @param[in] vnObs VectorNavBinaryOutput to process
130 /// @return The converted data
131 std::shared_ptr<const PosVelAtt> convert2PosVelAtt(const std::shared_ptr<const VectorNavBinaryOutput>& vnObs);
132
133 /// @brief Converts the VectorNavBinaryOutput to a GnssObs observation
134 /// @param[in] vnObs VectorNavBinaryOutput to process
135 /// @return The converted data
136 static std::shared_ptr<const GnssObs> convert2GnssObs(const std::shared_ptr<const VectorNavBinaryOutput>& vnObs);
137};
138
139/// @brief Converts the enum to a string
140/// @param[in] value Enum value to convert into text
141/// @return String representation of the enum
143
144} // namespace NAV
Barometric Pressure Storage Class.
nlohmann::json json
json namespace
GNSS Observation messages.
Data storage class for one VectorNavImu observation.
Node Class.
Position, Velocity and Attitude Storage Class.
Binary Outputs from VectorNav Sensors.
TsDeque< std::shared_ptr< const NAV::NodeData > > NodeDataQueue
Node data queue type.
Definition Pin.hpp:707
Node(std::string name)
Constructor.
Definition Node.cpp:30
VectorNavBinaryConverter & operator=(const VectorNavBinaryConverter &)=delete
Copy assignment operator.
VectorNavBinaryConverter(const VectorNavBinaryConverter &)=delete
Copy constructor.
static std::shared_ptr< const GnssObs > convert2GnssObs(const std::shared_ptr< const VectorNavBinaryOutput > &vnObs)
Converts the VectorNavBinaryOutput to a GnssObs observation.
std::shared_ptr< const ImuObs > convert2ImuObs(const std::shared_ptr< const VectorNavBinaryOutput > &vnObs) const
Converts the VectorNavBinaryOutput to a ImuObs observation.
OutputType _outputType
The selected output type in the GUI.
std::shared_ptr< const PosVelAtt > convert2PosVelAtt(const std::shared_ptr< const VectorNavBinaryOutput > &vnObs)
Converts the VectorNavBinaryOutput to a PosVelAtt observation.
VectorNavBinaryConverter & operator=(VectorNavBinaryConverter &&)=delete
Move assignment operator.
OutputType
Enum specifying the type of the output message.
void receiveObs(InputPin::NodeDataQueue &queue, size_t pinIdx)
Converts the VectorNavBinaryOutput observation to the selected message type.
static constexpr size_t OUTPUT_PORT_INDEX_CONVERTED
Flow.
static std::string category()
String representation of the Class Category.
std::shared_ptr< const PosVelAtt > _posVelAtt__init
Position, Velocity and Attitude at initialization (needed for static data)
void restore(const json &j) override
Restores the node from a json object.
static std::string typeStatic()
String representation of the Class Type.
std::shared_ptr< const ImuObsWDelta > convert2ImuObsWDelta(const std::shared_ptr< const VectorNavBinaryOutput > &vnObs) const
Converts the VectorNavBinaryOutput to a ImuObsWDelta observation.
json save() const override
Saves the node into a json object.
static constexpr size_t INPUT_PORT_INDEX_VECTORNAV_BINARY_OUTPUT
Flow (VectorNavBinaryOutput)
std::shared_ptr< const BaroPressObs > convert2BaroPressObs(const std::shared_ptr< const VectorNavBinaryOutput > &vnObs) const
Converts the VectorNavBinaryOutput to a BaroPressObs observation.
~VectorNavBinaryConverter() override
Destructor.
PosVelSource _posVelSource
The selected PosVel source in the GUI.
std::string type() const override
String representation of the Class Type.
bool _forceStatic
GUI option. If checked forces position to a static value and velocity to 0.
bool _useCompensatedData
Whether to extract the compensated data or the uncompensated.
bool initialize() override
Initialize the node.
VectorNavBinaryConverter(VectorNavBinaryConverter &&)=delete
Move constructor.
void guiConfig() override
ImGui config window which is shown on double click.
PosVelSource
Enum specifying the source for the PosVelAtt conversion.
@ PosVelSource_Gnss2
Take only GNSS2 values into account.
@ PosVelSource_Gnss1
Take only GNSS1 values into account.
@ PosVelSource_Ins
Take only INS values into account.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.