Wrote up a wind estimator today. It is based off of a simple model which requires very little inputs from sensors.
psi - true heading (not course over ground)
theta - pitch
airspeed
GPS lat and long
It is a simple model. The wind model has no dynamics which helps simplify the solution. This asusmption is mostly true beings the wind direction and velocity doesn't change all that much for a given flight. The filter starts off by assuming the soltion is a zero wind scenario and then moves towards reality. It takes about 2-3 seconds to converge.
The non-linear state update equations are as follows:
Pn_dot = Vair*cos(psi)*cos(theta) - Wn
Pe_dot = Vair*sin(psi)*cos(theta) - We
Wn_dot = 0
We_dot = 0
Notice the filter resolves on a wind velocity of 15 ft/s and 090 deg heading.
Pretty slick how quickly it finds a solution.
Comments
As for Covariance. In practice I never calculate aka estimate the covariance. I always just tune the numbers in practice (or simulation if you have it). That will get you really close. I suck at statistics but I can fiddle with numbers and get it working in about 3 seconds.
I agree with you. The problem of estimating the wind is easy if you have an airspeed sensor, and it is trivial if you have a magnetometer, too.
We do not have either a magnetometer or an airspeed sensor on the UAV DevBoard, so the focus of windspeed estimation for us is to first estimate the airspeed. We need the plane to be making some pitching or yawing movements to do that, anything but a straight line. As soon as we have an airspeed estimate, we can then estimate wind speed. We do some smoothing of the wind speed estimates, so it takes a few turns to get initialized. But once we have a good estimate of the wind, we then can make continual estimates of the airspeed, even when traveling in a straight line, by subtracting the wind vector from the ground speed vector. An occasional turn provides updates for our wind estimate.
Best regards,
Bill
Nice work.
Regarding Paul Bizard's comment, the UAV DevBoard team has developed and successfully tested a 3D wind estimator that works without an airspeed sensor, magnetometer, or true heading. Inputs are GPS course and speed over ground, and the direction cosine matrix.
In our case, we developed a DCM based algorithm, because the UAV DevBoard takes a minimalist approach, it does not have an airspeed sensor or a magnetometer. All we have are accelerometers, gyros, and a GPS. So, we squeeze everything we can out of the direction cosines.
We estimate all three components of the wind, including the Z (or lift) component, which will be helpful for sailplane pilots.
Here is a link to the theory.
Here is a cross link to our posting.
Best regards,
Bill
Since you have all this information however, is the EKF possibly a little overkill? Since most GPS give you NED velocity (Ublox does at least), then the velocity of the plane in NE space is:
Vplane,N = Vair,N + Vwind,N
or
Vplane,N = Vair*cos(psi)cos(theta) + Vwind,N
Likewise,
Vplane,E = Vair*sin(psi)cos(theta) + Vwind,E
You know Vplane,N and Vplane,E from your GPS NED output velocity.
You know Vair from some pitot tube or lookup table against throttle
You know psi from your magnetometer (assume know pitch from IMU)
The only remaining unknowns are Vwind N, E, which are just solved as:
Vwind,N = Vplane,N - Vair*cos(psi)cos(theta)
Vwind,E = Vplane,E - Vair*sin(psi)cos(theta)
You can filter these with a low pass if they are too noisy, but that would be less computationally taxing then the EKF.
Or, I could've missed something...thanks for posting the matlab code BTW...
wind EKF.txt