From 27a3b5fb36f734ca925b24d73fd2cc030f51a531 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <tridge@samba.org>
Date: Thu, 10 Apr 2014 06:49:13 +1000
Subject: [PATCH] AP_AHRS: fixed wind reporting with EKF and no airspeed sensor

the EKF does not estimate wind without an airspeed sensor
---
 libraries/AP_AHRS/AP_AHRS_NavEKF.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libraries/AP_AHRS/AP_AHRS_NavEKF.cpp b/libraries/AP_AHRS/AP_AHRS_NavEKF.cpp
index 9647d30d5..cb19b212b 100644
--- a/libraries/AP_AHRS/AP_AHRS_NavEKF.cpp
+++ b/libraries/AP_AHRS/AP_AHRS_NavEKF.cpp
@@ -122,7 +122,9 @@ float AP_AHRS_NavEKF::get_error_yaw(void)
 // return a wind estimation vector, in m/s
 Vector3f AP_AHRS_NavEKF::wind_estimate(void)
 {
-    if (!using_EKF()) {
+    if (!using_EKF() || !_airspeed || !_airspeed->use()) {
+        // EKF does not estimate wind speed when there is no airspeed
+        // sensor active
         return AP_AHRS_DCM::wind_estimate();
     }
     Vector3f wind;
-- 
GitLab