Skip to content

Commit

Permalink
Fix gps latitude and longitude
Browse files Browse the repository at this point in the history
  • Loading branch information
SijmenHuizenga committed Aug 21, 2020
1 parent 66858ef commit 465e9e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AirSim/AirLib/include/common/EarthUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ class EarthUtils {
double sin_c = sin(c), cos_c = cos(c);
double lat_rad, lon_rad;
if (!Utils::isApproximatelyZero(c)) { //avoids large changes?
lat_rad = asin(cos_c * home_geo_point.sin_lat + (y_rad * sin_c * home_geo_point.cos_lat) / c);
lon_rad = (home_geo_point.lon_rad + atan2(x_rad * sin_c, c * home_geo_point.cos_lat * cos_c - y_rad * home_geo_point.sin_lat * sin_c));
lat_rad = asin(cos_c * home_geo_point.sin_lat + (x_rad * sin_c * home_geo_point.cos_lat) / c);
lon_rad = (home_geo_point.lon_rad + atan2(y_rad * sin_c, c * home_geo_point.cos_lat * cos_c - x_rad * home_geo_point.sin_lat * sin_c));

return GeoPoint(Utils::radiansToDegrees(lat_rad), Utils::radiansToDegrees(lon_rad), home_geo_point.home_geo_point.altitude + v.z());
} else
Expand Down

0 comments on commit 465e9e5

Please sign in to comment.