Skip to content

Wind Estimation and Barometer Compensation ​

A multirotor needs no airspeed sensor for the EKF to work out what wind it is flying in — how strong, and from where.

That estimate does two jobs:

  • Gives the pilot a real-time reference
  • Compensates for wind disturbing the barometer: when the controller is exposed to airflow, pressure readings get pushed around, which shows up as a few metres of climb or sink after fast forward flight slows down

There are three steps: airframe drag coefficient, propeller drag coefficient, then barometer compensation.

1. Working out the airframe drag coefficient ​

1. Weigh it ​

Weigh the aircraft with its battery, in kg.

2. Measure the frontal and side areas ​

Take two photos from a few metres away — one of the front, one of the side — and use them to measure the frontal and side areas. An online tool can overlay a grid on the photo or trace the outline:

  • Add grid to image (free): scale the grid to a known dimension of the aircraft in cm, count the squares covering the airframe (propellers excluded) and that count is the area in cm²
  • SketchAndCalc (one-hour free trial): draw a polygon around the airframe outline and read the area in cm² straight off

▲ Grid overlaid on the photo — count the squares covering the airframe

▲ Tracing the outline in SketchAndCalc, which shows the area directly

Divide the area in cm² by 10000 to get m².

3. Enter the parameters ​

ParameterHow to calculate
EK3_DRAG_BCOEF_Xweight (kg) ÷ frontal area (m²)
EK3_DRAG_BCOEF_Yweight (kg) ÷ side area (m²)

The IRIS in the photo, as an example:

ItemValue
Weight1.45 kg
Frontal area203 cm² = 0.0203 m²
Side area217 cm² = 0.0217 m²
EK3_DRAG_BCOEF_X1.45 ÷ 0.0203 = 71.4
EK3_DRAG_BCOEF_Y1.45 ÷ 0.0217 = 66.8

2. Working out the propeller drag coefficient ​

The propeller drag coefficient, EK3_DRAG_MCOEF, can only come from flight testing. The calculation and how to read it are covered in this official ArduPilot video.

  1. Pick an open site with little wind
  2. Optional: set LOG_DISARMED = 1 and LOG_REPLAY = 1 so you can replay the flight afterwards
  3. Arm and take off in Loiter (so the EKF position estimate stays good) and fly to the middle of the test area
  4. Switch to AltHold and let the aircraft drift downwind so you can see the wind direction and strength
  5. Point the nose into wind, hold full pitch stick to accelerate upwind until acceleration stops
  6. Release pitch, let it decelerate and drift back downwind to the start line
  7. Reposition the aircraft somewhere comfortable
  8. Yaw 90° (clockwise, say) so one side faces the wind, hold full roll stick to accelerate, release and drift back
  9. Reposition again
  10. Repeat step 8 with the tail into wind (accelerate by pulling back)
  11. Repeat step 8 with the other side into wind (accelerate with the opposite roll direction)
  12. Land, then download the onboard log — see downloading flash logs

TIP

EK3_DRAG_MCOEF normally ends up somewhere between 0.1 and 1.0.

3. Watching wind speed and direction live in the ground station ​

Once enabled, the estimated wind goes to the ground station in the MAVLink WIND message.

In Mission Planner: Flight Data screen, Quick tab, double-click any value and pick wind_dir or wind_vel.

▲ Bringing up wind direction and speed on the Quick tab in Mission Planner

4. Reading wind speed from a log ​

The EKF wind estimate is logged in the XKF2 message — look at VWN (north wind) and VWE (east wind).

▲ Expanding XKF2 in the log browser and ticking VWN / VWE

5. Barometer position error compensation ​

With a wind estimate you can compensate the pressure error wind causes at each barometer, in four directions (front, back, left, right). The calculation is shown in this official ArduPilot video.

1. Test flights ​

Fly once with the nose into wind, once tail into wind, once right side into wind and once left side into wind, then download the onboard log.

2. Work out the position error coefficient for each direction ​

  • Get air density in kg/m³ from an air density calculator
  • Static pressure error (Pa) = −height × gravitational acceleration × air density
  • Dynamic pressure = 0.5 × air density × wind speed²
  • Position error coefficient = static pressure error ÷ dynamic pressure

NOTE

The coefficient should land between -1 and +1.

3. Enable compensation and enter the coefficients ​

Set BARO1_WCF_ENABLE to 1, then restart the controller.

Parameters for the first barometer:

ParameterDirection
BARO1_WCF_FWDPositive X (front)
BARO1_WCF_BCKNegative X (back)
BARO1_WCF_RGTPositive Y (right)
BARO1_WCF_LFTNegative Y (left)
BARO1_WCF_UPPositive Z (up)
BARO1_WCF_DNNegative Z (down)

NOTE

With more than one barometer, the prefix becomes BARO2_WCF_*, BARO3_WCF_* and so on — each one is calculated and entered separately.