mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 16:33:34 +08:00
SensorGps.msg: switch to double precision for lat/lon/alt
To match https://github.com/PX4/PX4-GPSDrivers/pull/132 - adding high precision RTK lat/lon/alt components
This commit is contained in:
committed by
Beat Küng
parent
f82785a322
commit
f000238987
@@ -242,7 +242,7 @@ build_gps_response(uint8_t *buffer, size_t *size)
|
||||
msg.gps_speed_H = (uint8_t)(speed >> 8) & 0xff;
|
||||
|
||||
/* Get latitude in degrees, minutes and seconds */
|
||||
double lat = ((double)(gps.lat)) * 1e-7d;
|
||||
double lat = gps.latitude_deg;
|
||||
|
||||
/* Set the N or S specifier */
|
||||
msg.latitude_ns = 0;
|
||||
@@ -265,7 +265,7 @@ build_gps_response(uint8_t *buffer, size_t *size)
|
||||
msg.latitude_sec_H = (uint8_t)(lat_sec >> 8) & 0xff;
|
||||
|
||||
/* Get longitude in degrees, minutes and seconds */
|
||||
double lon = ((double)(gps.lon)) * 1e-7d;
|
||||
double lon = gps.longitude_deg;
|
||||
|
||||
/* Set the E or W specifier */
|
||||
msg.longitude_ew = 0;
|
||||
@@ -285,7 +285,7 @@ build_gps_response(uint8_t *buffer, size_t *size)
|
||||
msg.longitude_sec_H = (uint8_t)(lon_sec >> 8) & 0xff;
|
||||
|
||||
/* Altitude */
|
||||
uint16_t alt = (uint16_t)(gps.alt * 1e-3f + 500.0f);
|
||||
uint16_t alt = (uint16_t)(round(gps.altitude_msl_m) + 500.0);
|
||||
msg.altitude_L = (uint8_t)alt & 0xff;
|
||||
msg.altitude_H = (uint8_t)(alt >> 8) & 0xff;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user