Skip to content

Commit

Permalink
SITL: parse home coordinates as double (not float) to avoid precision…
Browse files Browse the repository at this point in the history
… loss
  • Loading branch information
fabio-d authored and peterbarker committed Jan 5, 2019
1 parent 1755f5b commit 8ff9923
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/SITL/SIM_Aircraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ bool Aircraft::parse_home(const char *home_str, Location &loc, float &yaw_degree
}

memset(&loc, 0, sizeof(loc));
loc.lat = static_cast<int32_t>(strtof(lat_s, nullptr) * 1.0e7f);
loc.lng = static_cast<int32_t>(strtof(lon_s, nullptr) * 1.0e7f);
loc.alt = static_cast<int32_t>(strtof(alt_s, nullptr) * 1.0e2f);
loc.lat = static_cast<int32_t>(strtod(lat_s, nullptr) * 1.0e7);
loc.lng = static_cast<int32_t>(strtod(lon_s, nullptr) * 1.0e7);
loc.alt = static_cast<int32_t>(strtod(alt_s, nullptr) * 1.0e2);

if (loc.lat == 0 && loc.lng == 0) {
// default to CMAC instead of middle of the ocean. This makes
Expand Down

0 comments on commit 8ff9923

Please sign in to comment.