Servers by jDrones

New fixed wing PID system and autotune

Last month we finally merged the new fixed wing control code slated for the ArduPilot plane 4.1 release. This provides a major improvement in several areas:

  • much better manual PID tuning, with clearer parameters and much improved filtering
  • new fixed wing AUTOTUNE system which produces a much better tune for a wider range of aircraft

The key change in the PIDs is we are switching to use the same PID code that is used for VTOL aircraft in ArduPilot. This leverages the great work that @Leonardthall has done to improve that PID system for the 4.1 release and gives us a common framework.

Old PID System
The old fixed wing PID system had some unusual properties that were left over from the very early days of ArduPilot. Specifically, the feed-forward gain was calculated using a combination of the P, I, D and time-constant. This was originally done to preserve parameter value behaviour for people running very early versions of ArduPilot. That odd feed-forward calculation did work, but made it harder to properly tune the aircraft for someone who does understand how PIDs work. For example, if you increased RLL2SRV_D in the old code to get a bit more damping then that would also, as a side effect, decrease the feed-forward gain, which is probably not what the user really wanted.

New PID System
The new PID system uses new names for the rate gains. For example, the full set of roll controller gains are now:


The same parameters are available for pitch, but with a PTCH prefix instead of RLL.
The RMAX and TCONST parameters are the same as before, and are the key parameters for determining the feel of the tune. If you want a very sharp response then you need a high RMAX and a low TCONST. For a gentle tune (eg. a glider) use low RMAX and high TCONST.
The rate PID itself now has 4 gain parameters, FF, P, I and D. In nearly all fixed wing aircraft the FF (feed-forward) term dominates, and is the most important parameter to get right. Luckily you can read the right FF value from any log where the pilot has commanded a sustained rate in the axis of the FF (eg. commanded a full right roll, or pitch up).
The P and D terms are the correction terms, and they are the ones that will most likely drive an oscillation if you push them too high. That is why we have a new slew limiter feature that can detect this oscillation and automatically back off the P and D components of the PID to reduce the oscillation.

New Fixed Wing AUTOTUNE Mode
Along with the new PID system we also have a new AUTOTUNE mode. This is a big improvement over the old AUTOTUNE, and is able to correctly setup your FF parameters as well as P, I and D. It should work on a much wider range of aircraft than the old AUTOTUNE.
As always, please report any issues you find with the new code! If you’d like to try it then just load the ‘latest’ firmware and go for it! Post any issues here.
When you update it will auto-convert your old PIDs to the new system.


Is this model able to be imported into UE4 to run with Airsim (in place of their default quadcopter)?

it would take a lot of work to replace the quad with a fixed wing in airsim. It would be a great project, but not easy.

How much is alot of work? And you mean mainly editing the json and c++ files? I have about a week or two - I’m a graduate aerospace engineer at the moment, needing this for school - to dedicate towards getting the model (I’m experienced with UE4 and somewhat with C++, not so much with air sim or ardupilot though)

yes, just need to replace the quadrotor model with a fixed wing model, and also work out a takeoff process and ground interaction. Good luck with it!

1 Like

Anyone knows when the motor is spinning randomly in 4.1 dev when the plane is disarmed?
It seems it’s doing this only when in RTL failsafe mode.

fly witn 4.1.0 beta. Matek f405 wing. sonicmodell binary 1200
Run new autotune. Not found any big improvement for traditional 4 channel plane
here logs!AuFPVI_eDaZbhbwWqZzoPirkPVgl2g?e=Sscwi8
plane have jerks on roll axis

and here video of flying

Servers by jDrones