we are doing atmospheric research with UAV at my university. I implemented a Pixhawk 2 in our UAV a short while ago and I noticed that Arduplane somehow calculates a wind direction.

It would be very interesting for us to compare these values with those produced by our own sensor payload. Can anybody point me to a documentation explaining the way the EKF calculates this? I searched the Arduplane documentation as well as the source code but found nothing…
I read through http://ardupilot.org/dev/docs/extended-kalman-filter.html#extended-kalman-filter but this doesn’t really explain how the EKF works.

My problems in finding an answer may have to do with me being a natural scientist with only rudimentary knowledge in programming languages, so if anybody is able to help me I would be truly grateful.

I don’t know the EKF, but in laymans terms the wind vector is calculated by the difference between the groundspeed vector and airspeed vector. The groundspeed vector is known from the GPS, and airspeed vector is known from the airspeed sensor and compass module. See the reference below for a more thorough explanation.

Hello, I’m also a researcher, at Virginia Tech University in the USA. I’m in Aerospace engineering, working on algorithms to estimate the wind from sensors and the plane’s own-motion. I know the details of how EKFs work… but it’s not exactly something I can briefly explain clearly. (I’ll give it my best shot below)

Would you be willing to share what kind of wind sensors you’re flying, and other details? If you’d prefer to talk offline, my email is hgm at-sign vt dot edu.

My best shot at an EKF and how it does the wind:
An EKF mathematically combines two sources of imperfect knowledge: 1) What our (theoretical) dynamic models say a plane should do, given the inputs (throttle, aileron, etc), and 2) what our (noisy) sensors say the plane actually does. The EKF combines each of these, giving more weight to the more exact (less-uncertain) sensors to produce a best-guess at (that’s the “estimate of”) the true plane motion. It also tells us how much it believes in it’s best guess. (that’s the estimate’s uncertainty)

The wind estimate is calculated accordingly: Our (theoretical, low-quality) model of the wind is that “it will blow exactly how it blew last time we calculated an estimate.” Because it’s not a really great guess, we give it high uncertainty. Then, when the filter sees a difference in the airspeed and the groundspeed… it can choose to “explain” it by either assuming it was noise in some sensors, or “explain” it by changing it’s estimate of the wind. So when you plot VWN and VWE, you’re plotting this estimate.