|
|
|
@ -422,23 +422,27 @@ bool NavEKF2_core::assume_zero_sideslip(void) const
@@ -422,23 +422,27 @@ bool NavEKF2_core::assume_zero_sideslip(void) const
|
|
|
|
|
return dal.get_fly_forward() && dal.get_vehicle_class() != AP_DAL::VehicleClass::GROUND; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// set the LLH location of the filters NED origin
|
|
|
|
|
// sets the local NED origin using a LLH location (latitude, longitude, height)
|
|
|
|
|
// returns false if absolute aiding and GPS is being used or if the origin is already set
|
|
|
|
|
bool NavEKF2_core::setOriginLLH(const Location &loc) |
|
|
|
|
{ |
|
|
|
|
if (PV_AidingMode == AID_ABSOLUTE && !extNavUsedForPos) { |
|
|
|
|
// reject attempts to set the origin if GPS is being used
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
EKF_origin = loc; |
|
|
|
|
ekfGpsRefHgt = (double)0.01 * (double)EKF_origin.alt; |
|
|
|
|
// define Earth rotation vector in the NED navigation frame at the origin
|
|
|
|
|
calcEarthRateNED(earthRateNED, loc.lat); |
|
|
|
|
validOrigin = true; |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
return setOrigin(loc); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set the NED origin to be used until the next filter reset
|
|
|
|
|
void NavEKF2_core::setOrigin(const Location &loc) |
|
|
|
|
// sets the local NED origin using a LLH location (latitude, longitude, height)
|
|
|
|
|
// returns false if the origin has already been set
|
|
|
|
|
bool NavEKF2_core::setOrigin(const Location &loc) |
|
|
|
|
{ |
|
|
|
|
// if the origin is valid reject setting a new origin
|
|
|
|
|
if (validOrigin) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
EKF_origin = loc; |
|
|
|
|
// if flying, correct for height change from takeoff so that the origin is at field elevation
|
|
|
|
|
if (inFlight) { |
|
|
|
@ -453,6 +457,8 @@ void NavEKF2_core::setOrigin(const Location &loc)
@@ -453,6 +457,8 @@ void NavEKF2_core::setOrigin(const Location &loc)
|
|
|
|
|
// put origin in frontend as well to ensure it stays in sync between lanes
|
|
|
|
|
frontend->common_EKF_origin = EKF_origin; |
|
|
|
|
frontend->common_origin_valid = true; |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// record a yaw reset event
|
|
|
|
|