50 return "Data Provider";
85 if (j.contains(
"FileReader"))
122 std::vector<std::string> splittedString =
str::split(line,
",");
123 if (splittedString.size() == 7)
125 std::size_t pos_star = splittedString.back().find(
'*');
126 if (pos_star != std::string::npos)
128 int64_t crc = std::strtol(splittedString[6].substr(pos_star + 1).c_str(),
nullptr, 16);
131 pos_star = line.find(
'*');
132 for (
unsigned int i = 1; i < pos_star; i++)
157 std::vector<std::string> splittedString =
str::split(line,
",");
158 if (splittedString.size() == 12)
160 std::size_t pos_star = splittedString[11].find(
'*');
161 if (pos_star != std::string::npos)
163 int64_t crc = std::strtol(splittedString[11].substr(pos_star + 1).c_str(),
nullptr, 16);
166 pos_star = line.find(
'*');
167 for (
unsigned int i = 1; i < pos_star; i++)
173 _currentDate.day = std::stoi(splittedString[9].substr(0, 2));
174 _currentDate.month = std::stoi(splittedString[9].substr(2, 2));
175 _currentDate.year = std::stoi(splittedString[9].substr(4, 2));
195 auto obs = std::make_shared<PosVel>();
200 std::vector<std::string> splittedData;
206 double lat_rad = 0.0;
207 double lon_rad = 0.0;
220 line.erase(line.begin(), std::ranges::find_if(line, [](
int ch) { return std::isgraph(ch); }));
224 if (splittedData[0].substr(0, 1) ==
"$")
233 if (splittedData.size() != 15) {
continue; }
235 std::size_t pos_star = splittedData[14].find(
'*');
236 int64_t crc = std::strtol(splittedData[14].substr(pos_star + 1).c_str(),
nullptr, 16);
239 pos_star = line.find(
'*');
240 for (
unsigned int i = 1; i < pos_star; i++)
246 hour = std::stoi(splittedData[1].substr(0, 2));
247 minute = std::stoi(splittedData[1].substr(2, 2));
248 second = std::stod(splittedData[1].substr(4));
249 double newSOD = hour * 24 * 60.0 + minute * 60.0 + second;
259 double lat1 = std::stod(splittedData[2].substr(0, 2));
260 double lat2 = std::stod(splittedData[2].substr(2));
262 lat_rad = (lat1 + lat2 / 60.0) / 180.0 * M_PI;
264 if (splittedData[3] ==
"S")
269 double lon1 = std::stoi(splittedData[4].substr(0, 3));
270 double lon2 = std::stod(splittedData[4].substr(3));
272 lon_rad = (lon1 + lon2 / 60.0) / 180.0 * M_PI;
274 if (splittedData[5] ==
"W")
279 hgt = std::stod(splittedData[9]) + std::stod(splittedData[11]);
284 else if (splittedData[0].substr(3, 3) ==
"ZDA")
292 else if (splittedData[0].substr(3, 3) ==
"RMC")
303 Eigen::Vector3d lla_pos{ lat_rad, lon_rad, hgt };
304 Eigen::Vector3d n_vel{ std::nan(
""), std::nan(
""), std::nan(
"") };
306 hour, minute, second,
309 obs->setPosition_lla(lla_pos);
311 obs->setVelocity_n(n_vel);
Transformation collection.
nlohmann::json json
json namespace
Utility class for logging to console and file.
#define LOG_DEBUG
Debug information. Should not be called on functions which receive observations (spamming)
#define LOG_TRACE
Detailled info to trace the execution of the program. Should not be called on functions which receive...
File Reader for NMEA files.
Position and Velocity Storage Class.
Utility functions for working with std::strings.
Keeps track of the current real/simulation time.
bool initialize()
Initialize the file reader.
void restore(const json &j)
Restores the node from a json object.
std::string _path
Path to the file.
FileType
File Type Enumeration.
auto eof() const
Check whether the end of file is reached.
@ PATH_CHANGED
The path changed and exists.
GuiResult guiConfig(const char *vFilters, const std::vector< std::string > &extensions, size_t id, const std::string &nameId)
ImGui config.
void resetReader()
Moves the read cursor to the start.
auto & getline(std::string &str)
Reads a line from the filestream.
json save() const
Saves the node into a json object.
void deinitialize()
Deinitialize the file reader.
The class is responsible for all time-related tasks.
bool setDateFromZDA(const std::string &line)
Set date info from ZDA steam.
double _oldSoD
Second of day (SOD) from last GGA stream. This variable is used to check if SOD is increasing,...
bool _hasValidDate
Checks whether a ZDA or RMC time tag was read so that UTC can be reconstructed together with the GGA ...
void restore(const json &j) override
Restores the node from a json object.
void deinitialize() override
Deinitialize the node.
bool initialize() override
Initialize the node.
static std::string typeStatic()
String representation of the Class Type.
struct NAV::NmeaFile::@035207343112113160312011275043304125120067020170 _currentDate
Current date.
NmeaFile()
Default constructor.
json save() const override
Saves the node into a json object.
~NmeaFile() override
Destructor.
std::shared_ptr< const NodeData > pollData()
Polls data from the file.
static constexpr size_t OUTPUT_PORT_INDEX_NMEA_POS_OBS
Flow (PosVel)
void guiConfig() override
ImGui config window which is shown on double click.
bool resetNode() override
Resets the node. Moves the read cursor to the start.
static std::string category()
String representation of the Class Category.
bool setDateFromRMC(const std::string &line)
Set date info from RMC steam.
std::string type() const override
String representation of the Class Type.
void readHeader() override
Read the Header of the file.
FileType determineFileType() override
Determines the type of the file.
bool doDeinitialize(bool wait=false)
Asks the node worker to deinitialize the node.
ImVec2 _guiConfigDefaultWindowSize
Node(std::string name)
Constructor.
std::string nameId() const
Node name and id.
std::string name
Name of the Node.
bool doReinitialize(bool wait=false)
Asks the node worker to reinitialize the node.
void invokeCallbacks(size_t portIndex, const std::shared_ptr< const NodeData > &data)
Calls all registered callbacks on the specified output port.
bool _hasConfig
Flag if the config window should be shown.
static std::string type()
Returns the type of the data class.
OutputPin * CreateOutputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier, OutputPin::PinData data=static_cast< void * >(nullptr), int idx=-1)
Create an Output Pin object.
void ApplyChanges()
Signals that there have been changes to the flow.
static std::vector< std::string > split(const std::string &str, const std::string &delimiter)
Splits a string into parts at a delimiter.
@ UTC
Coordinated Universal Time.