0.4.1
Loading...
Searching...
No Matches
VectorNavDataLogger.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 VectorNavDataLogger.hpp
10/// @brief Data Logger for VectorNav observations
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2020-03-17
13
14#pragma once
15
19
20namespace NAV
21{
22class NodeData;
23
24/// Data Logger for VectorNav observations
25class VectorNavDataLogger : public Node, public FileWriter, public CommonLog
26{
27 public:
28 /// @brief Default constructor
30 /// @brief Destructor
31 ~VectorNavDataLogger() override;
32 /// @brief Copy constructor
34 /// @brief Move constructor
36 /// @brief Copy assignment operator
38 /// @brief Move assignment operator
40
41 /// @brief String representation of the Class Type
42 [[nodiscard]] static std::string typeStatic();
43
44 /// @brief String representation of the Class Type
45 [[nodiscard]] std::string type() const override;
46
47 /// @brief String representation of the Class Category
48 [[nodiscard]] static std::string category();
49
50 /// @brief ImGui config window which is shown on double click
51 /// @attention Don't forget to set _hasConfig to true in the constructor of the node
52 void guiConfig() override;
53
54 /// @brief Saves the node into a json object
55 [[nodiscard]] json save() const override;
56
57 /// @brief Restores the node from a json object
58 /// @param[in] j Json object with the node state
59 void restore(const json& j) override;
60
61 /// @brief Called when a new link is to be established
62 /// @param[in] startPin Pin where the link starts
63 /// @param[in] endPin Pin where the link ends
64 /// @return True if link is allowed, false if link is rejected
65 bool onCreateLink(OutputPin& startPin, InputPin& endPin) override;
66
67 /// @brief Function called by the flow executer after finishing to flush out remaining data
68 void flush() override;
69
70 private:
71 /// @brief Initialize the node
72 bool initialize() override;
73
74 /// @brief Deinitialize the node
75 void deinitialize() override;
76
77 /// @brief Write Observation to the file
78 /// @param[in] queue Queue with all the received data messages
79 /// @param[in] pinIdx Index of the pin the data is received on
80 void writeObservation(InputPin::NodeDataQueue& queue, size_t pinIdx);
81
82 /// @brief Flag to write the header once
83 bool _headerWritten = false;
84};
85
86} // namespace NAV
Common logging variables like time into run and local positions.
File Writer class.
nlohmann::json json
json namespace
Node Class.
CommonLog(const CommonLog &)=delete
Copy constructor.
FileWriter(const FileWriter &)=delete
Copy constructor.
Input pins of nodes.
Definition Pin.hpp:491
TsDeque< std::shared_ptr< const NAV::NodeData > > NodeDataQueue
Node data queue type.
Definition Pin.hpp:707
Parent class for all data transmitted over Flow pins.
Definition NodeData.hpp:28
Node(std::string name)
Constructor.
Definition Node.cpp:30
Output pins of nodes.
Definition Pin.hpp:338
static std::string category()
String representation of the Class Category.
VectorNavDataLogger(VectorNavDataLogger &&)=delete
Move constructor.
void restore(const json &j) override
Restores the node from a json object.
void guiConfig() override
ImGui config window which is shown on double click.
~VectorNavDataLogger() override
Destructor.
VectorNavDataLogger & operator=(const VectorNavDataLogger &)=delete
Copy assignment operator.
bool onCreateLink(OutputPin &startPin, InputPin &endPin) override
Called when a new link is to be established.
std::string type() const override
String representation of the Class Type.
VectorNavDataLogger & operator=(VectorNavDataLogger &&)=delete
Move assignment operator.
void deinitialize() override
Deinitialize the node.
VectorNavDataLogger(const VectorNavDataLogger &)=delete
Copy constructor.
void flush() override
Function called by the flow executer after finishing to flush out remaining data.
static std::string typeStatic()
String representation of the Class Type.
bool _headerWritten
Flag to write the header once.
bool initialize() override
Initialize the node.
void writeObservation(InputPin::NodeDataQueue &queue, size_t pinIdx)
Write Observation to the file.
json save() const override
Saves the node into a json object.
VectorNavDataLogger()
Default constructor.