Skip to content

Commit 9c644df

Browse files
committed
Add getGeoidalSeparation
1 parent 64b146b commit 9c644df

File tree

11 files changed

+75
-19
lines changed

11 files changed

+75
-19
lines changed

Firmware/RTK_Everywhere/GNSS.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ typedef enum
2121
class GNSS
2222
{
2323
protected:
24-
float _altitude; // Altitude in meters
24+
double _altitude; // Altitude in meters
25+
double _geoidalSeparation; // Geoidal separation in meters
2526
float _horizontalAccuracy; // Horizontal position accuracy in meters
2627
double _latitude; // Latitude in degrees
2728
double _longitude; // Longitude in degrees
@@ -166,6 +167,9 @@ class GNSS
166167
// Returns the fix type or zero if not online
167168
virtual uint8_t getFixType();
168169

170+
// Returns the geoidal separation
171+
virtual double getGeoidalSeparation();
172+
169173
// Returns the hours of 24 hour clock or zero if not online
170174
virtual uint8_t getHour();
171175

Firmware/RTK_Everywhere/GNSS_LG290P.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ class GNSS_LG290P : GNSS
230230
// Returns the fix type or zero if not online
231231
uint8_t getFixType();
232232

233+
// Returns the geoidal separation
234+
double getGeoidalSeparation();
235+
233236
// Returns the hours of 24 hour clock or zero if not online
234237
uint8_t getHour();
235238

Firmware/RTK_Everywhere/GNSS_LG290P.ino

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,16 @@ uint8_t GNSS_LG290P::getFixType()
829829
return 0;
830830
}
831831

832+
//----------------------------------------
833+
// Returns the geoidal separation in meters or zero if the GNSS is offline
834+
//----------------------------------------
835+
double GNSS_LG290P::getGeoidalSeparation()
836+
{
837+
if (online.gnss)
838+
return (_lg290p->getGeoidalSeparation());
839+
return (0);
840+
}
841+
832842
//----------------------------------------
833843
// Get the horizontal position accuracy
834844
// Returns the horizontal position accuracy or zero if offline

Firmware/RTK_Everywhere/GNSS_Mosaic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,9 @@ class GNSS_MOSAIC : GNSS
699699
// Returns the fix type or zero if not online
700700
uint8_t getFixType();
701701

702+
// Returns the geoidal separation
703+
double getGeoidalSeparation();
704+
702705
// Returns the hours of 24 hour clock or zero if not online
703706
uint8_t getHour();
704707

Firmware/RTK_Everywhere/GNSS_Mosaic.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,14 @@ uint8_t GNSS_MOSAIC::getFixType()
952952
return _fixType;
953953
}
954954

955+
//----------------------------------------
956+
// Returns the geoidal separation in meters or zero if the GNSS is offline
957+
//----------------------------------------
958+
double GNSS_MOSAIC::getGeoidalSeparation()
959+
{
960+
return _geoidalSeparation;
961+
}
962+
955963
//----------------------------------------
956964
// Returns the hours of 24 hour clock or zero if not online
957965
//----------------------------------------
@@ -2527,7 +2535,8 @@ void GNSS_MOSAIC::storeBlock4007(SEMP_PARSE_STATE *parse)
25272535
{
25282536
_latitude = sempSbfGetF8(parse, 16) * 180.0 / PI; // Convert from radians to degrees
25292537
_longitude = sempSbfGetF8(parse, 24) * 180.0 / PI;
2530-
_altitude = (float)sempSbfGetF8(parse, 32);
2538+
_altitude = sempSbfGetF8(parse, 32); // Ellipsoidal height
2539+
_geoidalSeparation = (double)sempSbfGetF4(parse, 40); // Geoid undulation
25312540
_horizontalAccuracy = ((float)sempSbfGetU2(parse, 90)) / 100.0; // Convert from cm to m
25322541

25332542
// NrSV is the total number of satellites used in the PVT computation.

Firmware/RTK_Everywhere/GNSS_None.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,14 @@ class GNSS_None : public GNSS
234234
return _fixType;
235235
}
236236

237+
// Get the geoidal separation
238+
// Outputs:
239+
// Returns the geoidal separation in meters or zero if the GNSS is offline
240+
double getGeoidalSeparation()
241+
{
242+
return _geoidalSeparation;
243+
}
244+
237245
// Returns the hours of 24 hour clock or zero if not online
238246
uint8_t getHour()
239247
{

Firmware/RTK_Everywhere/GNSS_UM980.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ class GNSS_UM980 : GNSS
241241
// Returns the fix type or zero if not online
242242
uint8_t getFixType();
243243

244+
// Returns the geoidal separation
245+
double getGeoidalSeparation();
246+
244247
// Returns the hours of 24 hour clock or zero if not online
245248
uint8_t getHour();
246249

Firmware/RTK_Everywhere/GNSS_UM980.ino

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,16 @@ uint8_t GNSS_UM980::getFixType()
586586
return 0;
587587
}
588588

589+
//----------------------------------------
590+
// Returns the geoidal separation in meters or zero if the GNSS is offline
591+
//----------------------------------------
592+
double GNSS_UM980::getGeoidalSeparation()
593+
{
594+
if (online.gnss)
595+
return (_um980->getGeoidalSeparation());
596+
return (0);
597+
}
598+
589599
//----------------------------------------
590600
// Get the horizontal position accuracy
591601
// Returns the horizontal position accuracy or zero if offline

Firmware/RTK_Everywhere/GNSS_ZED.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@ class GNSS_ZED : GNSS
491491
// Returns the fix type or zero if not online
492492
uint8_t getFixType();
493493

494+
// Returns the geoidal separation
495+
double getGeoidalSeparation();
496+
494497
// Returns the hours of 24 hour clock or zero if not online
495498
uint8_t getHour();
496499

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,14 @@ uint8_t GNSS_ZED::getFixType()
936936
return (_fixType);
937937
}
938938

939+
//----------------------------------------
940+
// Returns the geoidal separation in meters or zero if the GNSS is offline
941+
//----------------------------------------
942+
double GNSS_ZED::getGeoidalSeparation()
943+
{
944+
return _geoidalSeparation;
945+
}
946+
939947
//----------------------------------------
940948
// Get the horizontal position accuracy
941949
// Returns the horizontal position accuracy or zero if offline
@@ -2542,7 +2550,8 @@ void storePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
25422550
//----------------------------------------
25432551
void GNSS_ZED::storePVTdataRadio(UBX_NAV_PVT_data_t *ubxDataStruct)
25442552
{
2545-
_altitude = ubxDataStruct->height / 1000.0;
2553+
_altitude = (double)ubxDataStruct->height / 1000.0; // Height above ellipsoid in mm
2554+
_geoidalSeparation = (double)(ubxDataStruct->height - ubxDataStruct->hMSL) / 1000.0;
25462555

25472556
_day = ubxDataStruct->day;
25482557
_month = ubxDataStruct->month;

0 commit comments

Comments
 (0)