ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Support MAV_CMD_EXTERNAL_WIND_ESTIMATE

Open python36 opened this issue 1 year ago • 1 comments

When flying without a GPS receiver, drift correction does not work properly because the autopilot does not have information about the wind speed and direction. I can get wind information using online services (e.g. windy.com) and with this command set a custom wind speed and direction, which will greatly improve drift correction.

This is very important when flying without GPS.

python36 avatar Aug 15 '24 13:08 python36

@peterbarker I make a new commit taking into account your proposals.

python36 avatar Aug 20 '24 09:08 python36

Should we have a timeout on the use of this wind estimate?

IMHO it is likely that the estimate will be closer to truth than 0 wind velocity unless the wind is rapidly changing which will mess with dead reckoning no mater what you do.

LupusTheCanine avatar Aug 31 '24 22:08 LupusTheCanine

Playing with MAVProxy command: long EXTERNAL_WIND_ESTIMATE 10 0 30

AHRS_EKF_TYPE of 0 (DCM)

On ground With AIRSPEED_USE of zero: image

On ground With AIRSPEED_USE of one: image

In-flight when loitering with a 5m/s wind from 180 (with airspeed) image

In-flight when loitering with a 5/m/s wind from 180, without airspeed: image

peterbarker avatar Sep 02 '24 03:09 peterbarker

@priseborough I notice in your branch here: https://github.com/priseborough/ardupilot/commits/pr-ekfWindStateUpdate-rebase04/ that you seem to be doing the same thing, but with EKF3 instead of DCM how close is that to being ready? Should we merge the DCM only PR first and then layer yours on top?

tridge avatar Sep 02 '24 23:09 tridge

@tridge do you want to try Pauls branch in SITL, with DCM fallback disabled?

tridge avatar Sep 02 '24 23:09 tridge

@python36 what sorts of boards are you running this on? We're wondering how to guard the feature compilation-wise, whether to say >1024MB instead of DCM (need to change the latter when EKF3 supports it).

peterbarker avatar Sep 02 '24 23:09 peterbarker

@priseborough I notice in your branch here: https://github.com/priseborough/ardupilot/commits/pr-ekfWindStateUpdate-rebase04/ that you seem to be doing the same thing, but with EKF3 instead of DCM how close is that to being ready? Should we merge the DCM only PR first and then layer yours on top?

@tridge My branch is very close. I'm in the process of finalising autotests. I vote we merge this first and I'll rebase and deal with the AHRS library conflicts.

priseborough avatar Sep 03 '24 01:09 priseborough

FYI the https://github.com/priseborough/ardupilot/commits/pr-ekfWindStateUpdate-rebase04/ branch bundles a few dead reckoning inprovements:

Enables a VTOL to fly using dead reckoning when GPS is unavailable provided the origin is set before flight. Keeps the last known local position after dropping out of dead reckoning when going from forward flight to VTOL modes. Uses MAV_CMD_EXTERNAL_POSITION_ESTIMATE messages to update the wind estimate. Uses MAV_CMD_EXTERNAL_WIND_ESTIMATE messages to update EKF3 wind estimates also using the accuracy fields to set the wind state covariances. Vehicle velocity is also updated to be consistent with the wind and airspeed.

priseborough avatar Sep 03 '24 01:09 priseborough

@python36 what sorts of boards are you running this on? We're wondering how to guard the feature compilation-wise, whether to say >1024MB instead of DCM (need to change the latter when EKF3 supports it).

I am using fmuv3 board so I have 2MB of flash on board. I created a new commit.

python36 avatar Sep 03 '24 06:09 python36

Merged, thanks!

peterbarker avatar Sep 04 '24 00:09 peterbarker

Merged, thanks!

🎉🎉🎉 Thanks all. @peterbarker Thank you very much

python36 avatar Sep 04 '24 05:09 python36

This is a very interesting feature but one question I have about the implementation is why was MAV_CMD_EXTERNAL_WIND_ESTIMATE used? It's really not a command so it probably should have been provided using a new mavlink message.

rmackay9 avatar Nov 06 '24 02:11 rmackay9