mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 11:13: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
@@ -2351,10 +2351,10 @@ MavlinkReceiver::handle_message_hil_gps(mavlink_message_t *msg)
|
||||
|
||||
gps.device_id = device_id.devid;
|
||||
|
||||
gps.lat = hil_gps.lat;
|
||||
gps.lon = hil_gps.lon;
|
||||
gps.alt = hil_gps.alt;
|
||||
gps.alt_ellipsoid = hil_gps.alt;
|
||||
gps.latitude_deg = hil_gps.lat * 1e-7;
|
||||
gps.longitude_deg = hil_gps.lon * 1e-7;
|
||||
gps.altitude_msl_m = hil_gps.alt * 1e-3;
|
||||
gps.altitude_ellipsoid_m = hil_gps.alt * 1e-3;
|
||||
|
||||
gps.s_variance_m_s = 0.25f;
|
||||
gps.c_variance_rad = 0.5f;
|
||||
|
||||
@@ -71,9 +71,9 @@ private:
|
||||
|
||||
msg.time_usec = gps.timestamp;
|
||||
msg.fix_type = gps.fix_type;
|
||||
msg.lat = gps.lat;
|
||||
msg.lon = gps.lon;
|
||||
msg.alt = gps.alt;
|
||||
msg.lat = static_cast<int32_t>(round(gps.latitude_deg * 1e7));
|
||||
msg.lon = static_cast<int32_t>(round(gps.longitude_deg * 1e7));
|
||||
msg.alt = static_cast<int32_t>(round(gps.altitude_msl_m * 1e3)); // convert [m] to [mm]
|
||||
msg.eph = gps.hdop * 100; // GPS HDOP horizontal dilution of position (unitless)
|
||||
msg.epv = gps.vdop * 100; // GPS VDOP vertical dilution of position (unitless)
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@ private:
|
||||
if (_sensor_gps_sub.update(&gps)) {
|
||||
msg.time_usec = gps.timestamp;
|
||||
msg.fix_type = gps.fix_type;
|
||||
msg.lat = gps.lat;
|
||||
msg.lon = gps.lon;
|
||||
msg.alt = gps.alt;
|
||||
msg.lat = static_cast<int32_t>(round(gps.latitude_deg * 1e7));
|
||||
msg.lon = static_cast<int32_t>(round(gps.longitude_deg * 1e7));
|
||||
msg.alt = static_cast<int32_t>(round(gps.altitude_msl_m * 1e3)); // convert [m] to [mm]
|
||||
msg.eph = gps.hdop * 100; // GPS HDOP horizontal dilution of position (unitless)
|
||||
msg.epv = gps.vdop * 100; // GPS VDOP vertical dilution of position (unitless)
|
||||
|
||||
@@ -85,7 +85,7 @@ private:
|
||||
|
||||
msg.cog = math::degrees(matrix::wrap_2pi(gps.cog_rad)) * 1e2f;
|
||||
msg.satellites_visible = gps.satellites_used;
|
||||
msg.alt_ellipsoid = gps.alt_ellipsoid;
|
||||
msg.alt_ellipsoid = static_cast<int32_t>(round(gps.altitude_ellipsoid_m * 1e3)); // convert [m] to [mm]
|
||||
msg.h_acc = gps.eph * 1e3f; // position uncertainty in mm
|
||||
msg.v_acc = gps.epv * 1e3f; // altitude uncertainty in mm
|
||||
msg.vel_acc = gps.s_variance_m_s * 1e3f; // speed uncertainty in mm
|
||||
|
||||
@@ -165,12 +165,12 @@ private:
|
||||
}
|
||||
|
||||
if (vehicle_gps_position.fix_type >= 2) {
|
||||
msg.latitude = vehicle_gps_position.lat;
|
||||
msg.longitude = vehicle_gps_position.lon;
|
||||
msg.latitude = static_cast<int32_t>(round(vehicle_gps_position.latitude_deg * 1e7));
|
||||
msg.longitude = static_cast<int32_t>(round(vehicle_gps_position.longitude_deg * 1e7));
|
||||
|
||||
// altitude_geodetic
|
||||
if (vehicle_gps_position.fix_type >= 3) {
|
||||
msg.altitude_geodetic = vehicle_gps_position.alt * 1e-3f;
|
||||
msg.altitude_geodetic = static_cast<float>(round(vehicle_gps_position.altitude_msl_m)); // [m]
|
||||
}
|
||||
|
||||
// horizontal_accuracy
|
||||
|
||||
@@ -86,9 +86,9 @@ private:
|
||||
// Required update for dynamic message is 5 [Hz]
|
||||
mavlink_uavionix_adsb_out_dynamic_t dynamic_msg = {
|
||||
.utcTime = static_cast<uint32_t>(vehicle_gps_position.time_utc_usec / 1000000ULL),
|
||||
.gpsLat = vehicle_gps_position.lat,
|
||||
.gpsLon = vehicle_gps_position.lon,
|
||||
.gpsAlt = vehicle_gps_position.alt_ellipsoid,
|
||||
.gpsLat = static_cast<int32_t>(round(vehicle_gps_position.latitude_deg * 1e7)),
|
||||
.gpsLon = static_cast<int32_t>(round(vehicle_gps_position.longitude_deg * 1e7)),
|
||||
.gpsAlt = static_cast<int32_t>(round(vehicle_gps_position.altitude_ellipsoid_m * 1e3)), // convert [m] to [mm]
|
||||
.baroAltMSL = static_cast<int32_t>(vehicle_air_data.baro_pressure_pa / 100.0f), // convert [Pa] to [mBar]
|
||||
.accuracyHor = static_cast<uint32_t>(vehicle_gps_position.eph * 1000.0f), // convert [m] to [mm]
|
||||
.accuracyVert = static_cast<uint16_t>(vehicle_gps_position.epv * 100.0f), // convert [m] to [cm]
|
||||
|
||||
Reference in New Issue
Block a user