Sub: fixed longitude wrap

This commit is contained in:
Andrew Tridgell 2021-06-23 12:28:03 +10:00 committed by Peter Barker
parent 396094a82c
commit 702f95d4c6
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ Vector3f Sub::pv_location_to_vector(const Location& loc)
origin.zero(); origin.zero();
} }
float alt_above_origin = pv_alt_above_origin(loc.alt); // convert alt-relative-to-home to alt-relative-to-origin float alt_above_origin = pv_alt_above_origin(loc.alt); // convert alt-relative-to-home to alt-relative-to-origin
return Vector3f((loc.lat-origin.lat) * LATLON_TO_CM, (loc.lng-origin.lng) * LATLON_TO_CM * scaleLongDown, alt_above_origin); return Vector3f((loc.lat-origin.lat) * LATLON_TO_CM, Location::diff_longitude(loc.lng,origin.lng) * LATLON_TO_CM * scaleLongDown, alt_above_origin);
} }
// pv_alt_above_origin - convert altitude above home to altitude above EKF origin // pv_alt_above_origin - convert altitude above home to altitude above EKF origin