Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3232,7 +3232,7 @@ void display()
std::vector<double> timestamps;
for (const auto& gnss : tls_registration.gnss.gnss_poses)
{
lla_points.emplace_back(gnss.lat, gnss.lon, gnss.alt);
lla_points.emplace_back(gnss.lat, gnss.lon, gnss.h_wgs84);
intensity.push_back(gnss.hdop);
timestamps.push_back(gnss.timestamp);
}
Expand Down
6 changes: 4 additions & 2 deletions core/include/Core/gnss.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class GNSS
struct GlobalPose
{
double timestamp;
double lat;
double lon;
double lat; // WGS-84 Ellipsoid
double lon; // WGS-84 Ellipsoid
double h_wgs84; // height above WGS-84 ellipsoid
double undulation;
double alt;
double hdop;
double satelites_tracked;
Expand Down
1 change: 1 addition & 0 deletions core/include/Core/nmea.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace hd_mapping::nmea
int fix_quality;
int satellites_tracked;
double age_of_data;
double undulation;
};

//! Breaks a line from an NMEA file into its components.
Expand Down
12 changes: 8 additions & 4 deletions core/src/gnss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,14 @@ bool GNSS::load_raw_data_from_gnss(const std::vector<std::string>& input_file_na
std::istringstream(strs[3]) >> gp.alt;
std::istringstream(strs[4]) >> gp.hdop;
std::istringstream(strs[5]) >> gp.satelites_tracked;
std::istringstream(strs[6]) >> gp.height;
std::istringstream(strs[6]) >> gp.undulation;
std::istringstream(strs[7]) >> gp.age;
std::istringstream(strs[8]) >> gp.time;
std::istringstream(strs[9]) >> gp.fix_quality;
if (std::isfinite(gp.lat) && std::isfinite(gp.lon) && std::isfinite(gp.alt) && gp.lat != 0.0 && gp.lon != 0.0)
if (std::isfinite(gp.lat) && std::isfinite(gp.lon) && std::isfinite(gp.alt) && gp.lat != 0.0 && gp.lon != 0.0 &&
std::isfinite(gp.undulation))
{
gp.h_wgs84 = gp.alt + gp.undulation;
gnss_poses.push_back(gp);
}
}
Expand Down Expand Up @@ -295,7 +297,7 @@ bool GNSS::project_to_mercator_projection()

double get_ellipsoid_height(const GNSS::GlobalPose& pose)
{
return pose.alt + pose.height;
return pose.h_wgs84;
}

bool GNSS::project_using_proj()
Expand Down Expand Up @@ -492,10 +494,12 @@ bool GNSS::load_raw_data_from_nmea(const std::vector<std::string>& input_file_na
gp.age = gga->age_of_data;
gp.time = 0; // todo convert to seconds from string
gp.fix_quality = gga->fix_quality;
gp.undulation = gga->undulation;

// register if there is not nans
if (gp.lat == gp.lat && gp.lon == gp.lon && gp.alt == gp.alt)
if (gp.lat == gp.lat && gp.lon == gp.lon && gp.alt == gp.alt && gp.undulation == gp.undulation)
{
gp.h_wgs84 = gp.alt + gp.undulation;
gnss_poses.push_back(gp);
}
}
Expand Down
1 change: 1 addition & 0 deletions core/src/nmea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ namespace hd_mapping::nmea
data.hdop = fields[8].empty() ? 0.0 : std::stod(fields[8]);
data.fix_quality = fields[6].empty() ? 0 : std::stoi(fields[6]);
data.satellites_tracked = fields[7].empty() ? 0 : std::stoi(fields[7]);
data.undulation = fields[11].empty() ? 0.0 : std::stod(fields[11]);
data.age_of_data = fields.size() > 13 && !fields[13].empty() ? std::stod(fields[13]) : -1.0;

return data;
Expand Down
Loading