|
|
|
@ -18,7 +18,7 @@ extern const AP_HAL::HAL& hal;
@@ -18,7 +18,7 @@ extern const AP_HAL::HAL& hal;
|
|
|
|
|
*/ |
|
|
|
|
void NavEKF2_core::calcGpsGoodToAlign(void) |
|
|
|
|
{ |
|
|
|
|
const auto &gps = AP::dal().gps(); |
|
|
|
|
const auto &gps = dal.gps(); |
|
|
|
|
|
|
|
|
|
if (inFlight && assume_zero_sideslip() && !use_compass()) { |
|
|
|
|
// this is a special case where a plane has launched without magnetometer
|
|
|
|
@ -72,7 +72,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -72,7 +72,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (gpsDriftFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, |
|
|
|
|
dal.snprintf(prearm_fail_string, |
|
|
|
|
sizeof(prearm_fail_string), |
|
|
|
|
"GPS drift %.1fm (needs %.1f)", (double)gpsDriftNE, (double)(3.0f*checkScaler)); |
|
|
|
|
gpsCheckStatus.bad_horiz_drift = true; |
|
|
|
@ -103,7 +103,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -103,7 +103,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (gpsVertVelFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, |
|
|
|
|
dal.snprintf(prearm_fail_string, |
|
|
|
|
sizeof(prearm_fail_string), |
|
|
|
|
"GPS vertical speed %.2fm/s (needs %.2f)", (double)fabsf(gpsVertVelFilt), (double)(0.3f*checkScaler)); |
|
|
|
|
gpsCheckStatus.bad_vert_vel = true; |
|
|
|
@ -124,7 +124,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -124,7 +124,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (gpsHorizVelFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, |
|
|
|
|
dal.snprintf(prearm_fail_string, |
|
|
|
|
sizeof(prearm_fail_string), |
|
|
|
|
"GPS horizontal speed %.2fm/s (needs %.2f)", (double)gpsDriftNE, (double)(0.3f*checkScaler)); |
|
|
|
|
gpsCheckStatus.bad_horiz_vel = true; |
|
|
|
@ -143,7 +143,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -143,7 +143,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (hAccFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, |
|
|
|
|
dal.snprintf(prearm_fail_string, |
|
|
|
|
sizeof(prearm_fail_string), |
|
|
|
|
"GPS horiz error %.1fm (needs %.1f)", (double)hAcc, (double)(5.0f*checkScaler)); |
|
|
|
|
gpsCheckStatus.bad_hAcc = true; |
|
|
|
@ -159,7 +159,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -159,7 +159,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
} |
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (vAccFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, |
|
|
|
|
dal.snprintf(prearm_fail_string, |
|
|
|
|
sizeof(prearm_fail_string), |
|
|
|
|
"GPS vert error %.1fm (needs < %.1f)", (double)vAcc, (double)(7.5f * checkScaler)); |
|
|
|
|
gpsCheckStatus.bad_vAcc = true; |
|
|
|
@ -172,7 +172,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -172,7 +172,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (gpsSpdAccFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, |
|
|
|
|
dal.snprintf(prearm_fail_string, |
|
|
|
|
sizeof(prearm_fail_string), |
|
|
|
|
"GPS speed error %.1f (needs < %.1f)", (double)gpsSpdAccuracy, (double)(1.0f*checkScaler)); |
|
|
|
|
gpsCheckStatus.bad_sAcc = true; |
|
|
|
@ -185,7 +185,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -185,7 +185,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (hdopFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, sizeof(prearm_fail_string), |
|
|
|
|
dal.snprintf(prearm_fail_string, sizeof(prearm_fail_string), |
|
|
|
|
"GPS HDOP %.1f (needs 2.5)", (double)(0.01f * gps.get_hdop())); |
|
|
|
|
gpsCheckStatus.bad_hdop = true; |
|
|
|
|
} else { |
|
|
|
@ -197,7 +197,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -197,7 +197,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (numSatsFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, sizeof(prearm_fail_string), |
|
|
|
|
dal.snprintf(prearm_fail_string, sizeof(prearm_fail_string), |
|
|
|
|
"GPS numsats %u (needs 6)", gps.num_sats()); |
|
|
|
|
gpsCheckStatus.bad_sats = true; |
|
|
|
|
} else { |
|
|
|
@ -215,7 +215,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -215,7 +215,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// Report check result as a text string and bitmask
|
|
|
|
|
if (yawFail) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, |
|
|
|
|
dal.snprintf(prearm_fail_string, |
|
|
|
|
sizeof(prearm_fail_string), |
|
|
|
|
"Mag yaw error x=%.1f y=%.1f", |
|
|
|
|
(double)magTestRatio.x, |
|
|
|
@ -227,7 +227,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
@@ -227,7 +227,7 @@ void NavEKF2_core::calcGpsGoodToAlign(void)
|
|
|
|
|
|
|
|
|
|
// assume failed first time through and notify user checks have started
|
|
|
|
|
if (lastGpsVelFail_ms == 0) { |
|
|
|
|
AP::dal().snprintf(prearm_fail_string, sizeof(prearm_fail_string), "EKF starting GPS checks"); |
|
|
|
|
dal.snprintf(prearm_fail_string, sizeof(prearm_fail_string), "EKF starting GPS checks"); |
|
|
|
|
lastGpsVelFail_ms = imuSampleTime_ms; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -264,7 +264,7 @@ void NavEKF2_core::calcGpsGoodForFlight(void)
@@ -264,7 +264,7 @@ void NavEKF2_core::calcGpsGoodForFlight(void)
|
|
|
|
|
|
|
|
|
|
// get the receivers reported speed accuracy
|
|
|
|
|
float gpsSpdAccRaw; |
|
|
|
|
if (!AP::dal().gps().speed_accuracy(gpsSpdAccRaw)) { |
|
|
|
|
if (!dal.gps().speed_accuracy(gpsSpdAccRaw)) { |
|
|
|
|
gpsSpdAccRaw = 0.0f; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -324,9 +324,9 @@ void NavEKF2_core::detectFlight()
@@ -324,9 +324,9 @@ void NavEKF2_core::detectFlight()
|
|
|
|
|
bool largeHgtChange = false; |
|
|
|
|
|
|
|
|
|
// trigger at 8 m/s airspeed
|
|
|
|
|
if (AP::dal().airspeed_sensor_enabled()) { |
|
|
|
|
const auto *airspeed = AP::dal().airspeed(); |
|
|
|
|
if (airspeed->get_airspeed() * AP::dal().get_EAS2TAS() > 10.0f) { |
|
|
|
|
if (dal.airspeed_sensor_enabled()) { |
|
|
|
|
const auto *airspeed = dal.airspeed(); |
|
|
|
|
if (airspeed->get_airspeed() * dal.get_EAS2TAS() > 10.0f) { |
|
|
|
|
highAirSpd = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -383,7 +383,7 @@ void NavEKF2_core::detectFlight()
@@ -383,7 +383,7 @@ void NavEKF2_core::detectFlight()
|
|
|
|
|
|
|
|
|
|
// If more than 5 seconds since likely_flying was set
|
|
|
|
|
// true, then set inFlight true
|
|
|
|
|
if (AP::dal().get_time_flying_ms() > 5000) { |
|
|
|
|
if (dal.get_time_flying_ms() > 5000) { |
|
|
|
|
inFlight = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -478,7 +478,7 @@ void NavEKF2_core::detectOptFlowTakeoff(void)
@@ -478,7 +478,7 @@ void NavEKF2_core::detectOptFlowTakeoff(void)
|
|
|
|
|
{ |
|
|
|
|
if (!onGround && !takeOffDetected && (imuSampleTime_ms - timeAtArming_ms) > 1000) { |
|
|
|
|
// we are no longer confidently on the ground so check the range finder and gyro for signs of takeoff
|
|
|
|
|
const auto &ins = AP::dal().ins(); |
|
|
|
|
const auto &ins = dal.ins(); |
|
|
|
|
Vector3f angRateVec; |
|
|
|
|
Vector3f gyroBias; |
|
|
|
|
getGyroBias(gyroBias); |
|
|
|
|