0.4.1
Loading...
Searching...
No Matches
KmlLogger.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 KmlLogger.hpp
10/// @brief Data Logger for Pos data as KML (Keyhole Markup Language) files (input for Google Earth)
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2024-06-04
13
14#pragma once
15
16#include <memory>
20#include <Eigen/src/Core/Matrix.h>
21
22namespace NAV
23{
24class NodeData;
25
26/// Data Logger for Pos data as KML files (input for Google Earth)
27class KmlLogger : public Node, public FileWriter
28{
29 public:
30 /// @brief Default constructor
31 KmlLogger();
32 /// @brief Destructor
33 ~KmlLogger() override;
34 /// @brief Copy constructor
35 KmlLogger(const KmlLogger&) = delete;
36 /// @brief Move constructor
37 KmlLogger(KmlLogger&&) = delete;
38 /// @brief Copy assignment operator
39 KmlLogger& operator=(const KmlLogger&) = delete;
40 /// @brief Move assignment operator
42
43 /// @brief String representation of the Class Type
44 [[nodiscard]] static std::string typeStatic();
45
46 /// @brief String representation of the Class Type
47 [[nodiscard]] std::string type() const override;
48
49 /// @brief String representation of the Class Category
50 [[nodiscard]] static std::string category();
51
52 /// @brief ImGui config window which is shown on double click
53 /// @attention Don't forget to set _hasConfig to true in the constructor of the node
54 void guiConfig() override;
55
56 /// @brief Saves the node into a json object
57 [[nodiscard]] json save() const override;
58
59 /// @brief Restores the node from a json object
60 /// @param[in] j Json object with the node state
61 void restore(const json& j) override;
62
63 /// @brief Function called by the flow executer after finishing to flush out remaining data
64 void flush() override;
65
66 private:
67 /// @brief Initialize the node
68 bool initialize() override;
69
70 /// @brief Deinitialize the node
71 void deinitialize() override;
72
73 /// @brief Function to call to add a new pin
74 /// @param[in, out] node Pointer to this node
75 static void pinAddCallback(Node* node);
76 /// @brief Function to call to delete a pin
77 /// @param[in, out] node Pointer to this node
78 /// @param[in] pinIdx Input pin index to delete
79 static void pinDeleteCallback(Node* node, size_t pinIdx);
80
81 /// One data set of positions for each pin in Latitude [deg], Longitude [deg], Height above Mean Sea Level [m]
82 std::vector<std::vector<Eigen::Vector3d>> _positionData;
83
84 /// @brief Write Observation to the file
85 /// @param[in] queue Queue with all the received data messages
86 /// @param[in] pinIdx Index of the pin the data is received on
87 void writeObservation(InputPin::NodeDataQueue& queue, size_t pinIdx);
88
89 /// @brief Dynamic input pins
90 /// @attention This should always be the last variable in the header, because it accesses others through the function callbacks
92};
93
94} // namespace NAV
Inputs pins which can be added dynamically.
File Writer class.
nlohmann::json json
json namespace
Node Class.
FileWriter(const FileWriter &)=delete
Copy constructor.
TsDeque< std::shared_ptr< const NAV::NodeData > > NodeDataQueue
Node data queue type.
Definition Pin.hpp:707
KmlLogger & operator=(const KmlLogger &)=delete
Copy assignment operator.
~KmlLogger() override
Destructor.
Definition KmlLogger.cpp:42
void restore(const json &j) override
Restores the node from a json object.
Definition KmlLogger.cpp:87
std::string type() const override
String representation of the Class Type.
Definition KmlLogger.cpp:52
json save() const override
Saves the node into a json object.
Definition KmlLogger.cpp:75
static void pinDeleteCallback(Node *node, size_t pinIdx)
Function to call to delete a pin.
static std::string typeStatic()
String representation of the Class Type.
Definition KmlLogger.cpp:47
KmlLogger(KmlLogger &&)=delete
Move constructor.
static std::string category()
String representation of the Class Category.
Definition KmlLogger.cpp:57
static void pinAddCallback(Node *node)
Function to call to add a new pin.
KmlLogger & operator=(KmlLogger &&)=delete
Move assignment operator.
gui::widgets::DynamicInputPins _dynamicInputPins
Dynamic input pins.
Definition KmlLogger.hpp:91
void guiConfig() override
ImGui config window which is shown on double click.
Definition KmlLogger.cpp:62
std::vector< std::vector< Eigen::Vector3d > > _positionData
One data set of positions for each pin in Latitude [deg], Longitude [deg], Height above Mean Sea Leve...
Definition KmlLogger.hpp:82
void deinitialize() override
Deinitialize the node.
bool initialize() override
Initialize the node.
void flush() override
Function called by the flow executer after finishing to flush out remaining data.
KmlLogger()
Default constructor.
Definition KmlLogger.cpp:31
KmlLogger(const KmlLogger &)=delete
Copy constructor.
void writeObservation(InputPin::NodeDataQueue &queue, size_t pinIdx)
Write Observation to the file.
Parent class for all data transmitted over Flow pins.
Definition NodeData.hpp:28
Node(std::string name)
Constructor.
Definition Node.cpp:30
Inputs pins which can be added dynamically.