mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-14 10:00:35 +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
@@ -152,10 +152,10 @@ void HomePosition::fillLocalHomePos(home_position_s &home, float x, float y, flo
|
||||
|
||||
void HomePosition::fillGlobalHomePos(home_position_s &home, const vehicle_global_position_s &gpos)
|
||||
{
|
||||
fillGlobalHomePos(home, gpos.lat, gpos.lon, gpos.alt);
|
||||
fillGlobalHomePos(home, gpos.lat, gpos.lon, (double)gpos.alt);
|
||||
}
|
||||
|
||||
void HomePosition::fillGlobalHomePos(home_position_s &home, double lat, double lon, float alt)
|
||||
void HomePosition::fillGlobalHomePos(home_position_s &home, double lat, double lon, double alt)
|
||||
{
|
||||
home.lat = lat;
|
||||
home.lon = lon;
|
||||
@@ -189,7 +189,7 @@ void HomePosition::setInAirHomePosition()
|
||||
ref_pos.reproject(home.x - lpos.x, home.y - lpos.y, home_lat, home_lon);
|
||||
|
||||
const float home_alt = gpos.alt + home.z;
|
||||
fillGlobalHomePos(home, home_lat, home_lon, home_alt);
|
||||
fillGlobalHomePos(home, home_lat, home_lon, (double)home_alt);
|
||||
|
||||
setHomePosValid();
|
||||
home.timestamp = hrt_absolute_time();
|
||||
@@ -206,8 +206,8 @@ void HomePosition::setInAirHomePosition()
|
||||
double home_lon;
|
||||
ref_pos.reproject(home.x - lpos.x, home.y - lpos.y, home_lat, home_lon);
|
||||
|
||||
const float home_alt = _gps_alt + home.z;
|
||||
fillGlobalHomePos(home, home_lat, home_lon, home_alt);
|
||||
const double home_alt = _gps_alt + (double)home.z;
|
||||
fillGlobalHomePos(home, home_lat, home_lon, (double)home_alt);
|
||||
|
||||
setHomePosValid();
|
||||
home.timestamp = hrt_absolute_time();
|
||||
@@ -304,9 +304,9 @@ void HomePosition::update(bool set_automatically, bool check_if_changed)
|
||||
sensor_gps_s vehicle_gps_position;
|
||||
_vehicle_gps_position_sub.copy(&vehicle_gps_position);
|
||||
|
||||
_gps_lat = static_cast<double>(vehicle_gps_position.lat) * 1e-7;
|
||||
_gps_lon = static_cast<double>(vehicle_gps_position.lon) * 1e-7;
|
||||
_gps_alt = static_cast<float>(vehicle_gps_position.alt) * 1e-3f;
|
||||
_gps_lat = vehicle_gps_position.latitude_deg;
|
||||
_gps_lon = vehicle_gps_position.longitude_deg;
|
||||
_gps_alt = vehicle_gps_position.altitude_msl_m;
|
||||
_gps_eph = vehicle_gps_position.eph;
|
||||
_gps_epv = vehicle_gps_position.epv;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user