|
|
|
@ -24,8 +24,8 @@ void Sub::set_home_to_current_location_inflight()
@@ -24,8 +24,8 @@ void Sub::set_home_to_current_location_inflight()
|
|
|
|
|
{ |
|
|
|
|
// get current location from EKF
|
|
|
|
|
Location temp_loc; |
|
|
|
|
if (inertial_nav.get_location(temp_loc)) { |
|
|
|
|
const struct Location &ekf_origin = inertial_nav.get_origin(); |
|
|
|
|
Location ekf_origin; |
|
|
|
|
if (ahrs.get_location(temp_loc) && ahrs.get_origin(ekf_origin)) { |
|
|
|
|
temp_loc.alt = ekf_origin.alt; |
|
|
|
|
if (!set_home(temp_loc, false)) { |
|
|
|
|
// ignore this failure
|
|
|
|
@ -38,7 +38,7 @@ bool Sub::set_home_to_current_location(bool lock)
@@ -38,7 +38,7 @@ bool Sub::set_home_to_current_location(bool lock)
|
|
|
|
|
{ |
|
|
|
|
// get current location from EKF
|
|
|
|
|
Location temp_loc; |
|
|
|
|
if (inertial_nav.get_location(temp_loc)) { |
|
|
|
|
if (ahrs.get_location(temp_loc)) { |
|
|
|
|
|
|
|
|
|
// Make home always at the water's surface.
|
|
|
|
|
// This allows disarming and arming again at depth.
|
|
|
|
@ -98,6 +98,6 @@ bool Sub::set_home(const Location& loc, bool lock)
@@ -98,6 +98,6 @@ bool Sub::set_home(const Location& loc, bool lock)
|
|
|
|
|
bool Sub::far_from_EKF_origin(const Location& loc) |
|
|
|
|
{ |
|
|
|
|
// check distance to EKF origin
|
|
|
|
|
const struct Location &ekf_origin = inertial_nav.get_origin(); |
|
|
|
|
return (ekf_origin.get_distance(loc) > EKF_ORIGIN_MAX_DIST_M); |
|
|
|
|
Location ekf_origin; |
|
|
|
|
return ahrs.get_origin(ekf_origin) && (ekf_origin.get_distance(loc) > EKF_ORIGIN_MAX_DIST_M); |
|
|
|
|
} |
|
|
|
|