48 return "Data Provider";
83 if (j.contains(
"FileReader"))
120 std::vector<std::string> splittedString =
str::split(line,
",");
121 if (splittedString.size() == 7)
123 std::size_t pos_star = splittedString.back().find(
'*');
124 if (pos_star != std::string::npos)
126 int64_t crc = std::strtol(splittedString[6].substr(pos_star + 1).c_str(),
nullptr, 16);
129 pos_star = line.find(
'*');
130 for (
unsigned int i = 1; i < pos_star; i++)
155 std::vector<std::string> splittedString =
str::split(line,
",");
156 if (splittedString.size() == 12)
158 std::size_t pos_star = splittedString[11].find(
'*');
159 if (pos_star != std::string::npos)
161 int64_t crc = std::strtol(splittedString[11].substr(pos_star + 1).c_str(),
nullptr, 16);
164 pos_star = line.find(
'*');
165 for (
unsigned int i = 1; i < pos_star; i++)
171 _currentDate.day = std::stoi(splittedString[9].substr(0, 2));
172 _currentDate.month = std::stoi(splittedString[9].substr(2, 2));
173 _currentDate.year = std::stoi(splittedString[9].substr(4, 2));
193 auto obs = std::make_shared<PosVel>();
198 std::vector<std::string> splittedData;
204 double lat_rad = 0.0;
205 double lon_rad = 0.0;
218 line.erase(line.begin(), std::ranges::find_if(line, [](
int ch) { return std::isgraph(ch); }));
222 if (splittedData[0].starts_with(
"$"))
231 if (splittedData.size() != 15) {
continue; }
233 std::size_t pos_star = splittedData[14].find(
'*');
234 int64_t crc = std::strtol(splittedData[14].substr(pos_star + 1).c_str(),
nullptr, 16);
237 pos_star = line.find(
'*');
238 for (
unsigned int i = 1; i < pos_star; i++)
244 hour = std::stoi(splittedData[1].substr(0, 2));
245 minute = std::stoi(splittedData[1].substr(2, 2));
246 second = std::stod(splittedData[1].substr(4));
247 double newSOD = hour * 24 * 60.0 + minute * 60.0 + second;
257 double lat1 = std::stod(splittedData[2].substr(0, 2));
258 double lat2 = std::stod(splittedData[2].substr(2));
260 lat_rad = (lat1 + lat2 / 60.0) / 180.0 * M_PI;
262 if (splittedData[3] ==
"S")
267 double lon1 = std::stoi(splittedData[4].substr(0, 3));
268 double lon2 = std::stod(splittedData[4].substr(3));
270 lon_rad = (lon1 + lon2 / 60.0) / 180.0 * M_PI;
272 if (splittedData[5] ==
"W")
277 hgt = std::stod(splittedData[9]) + std::stod(splittedData[11]);
282 else if (splittedData[0].substr(3, 3) ==
"ZDA")
290 else if (splittedData[0].substr(3, 3) ==
"RMC")
301 Eigen::Vector3d lla_pos{ lat_rad, lon_rad, hgt };
302 Eigen::Vector3d n_vel{ std::nan(
""), std::nan(
""), std::nan(
"") };
304 hour, minute, second,
307 obs->setPosition_lla(lla_pos);
309 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.
OutputPin * CreateOutputPin(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.
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.
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.