Fixed-wing Tuning: PI-control or Feed Forward?

I have been flying fixed wings with INAV for a while now. The default control loops are PIDFF controllers: Proportional, Integral, Derivative and Feed Forward. But the auto-tuning process is only identifying the feed-forward gains and rate setpoints. The PID-gains are left to be set by the user if desired, but the defaults are usually fine.

It is actually not that hard to stabilize an airplane with INAV. If you just use a feed-forward gain, together with attitude stabilization, the airplane will probably fly fine. Auto-tuning helps to identify the 'correct' feed-forward gain, which will increase controller performance.

There is a fundamental problem with feed-forward control however. As the name suggests, it is not using feedback. The only way feedback is applied, is by the PID gains. However, in default INAV settings, their role remains relatively small compared to the feed-forward effect. Making the PID gains more dominant also results in ugly step responses when combined with feed-forward.

A different take on PI-control

In classical control theory examples, the I-gain is usually explained as the one that removes steady-state errors. It is typical to leave the I-gain small, to make sure it does not interfere with the PD- (and FF-) gains. That also makes it slower to respond to steady-state errors.

I came to the realization that for rate control of a first-order system (ailerons to rollrate is a typical example), it is possible to get exactly the same response with a FF-only-controller and a PI-controller. It is even possible to prove this mathematically.

The example I will use is about a step response on rollrate. Say we want to go from 0 deg/s rollrate to 30 deg/s rollrate. With a feed-forward-only controller, we can calculate the aileron deflection multiplying the feed-forward gain with 30 deg/s. With the aileron deflection constant, the roll rate will follow a first-order response and then stabilize at 30 deg/s.

But if we use a PI-controller instead, and choose the P- and I-gains carefully, it is possible to get exactly the same response on rollrate. Of course this is all very theoretical.

Derivation of the P- and I-gain

We can model the rollrate response as a first order system:

Where is the steady-state rollrate for an aileron deflection of 1. The input of our controller is a rollrate setpoint. If we use a feed-forward controller, the transfer function becomes:

To make the output rollrate follow the input rollrate setpoint, we simply use .

If we apply a PI-controller in front of the first-order model, the transfer function becomes:

We choose to be , similar to the feed-forward method. This causes the immediate response (when the integral is still zero) to match the output of the feed-forward controller.

To make this a close loop system, we apply negative feedback:

We then choose such that . If we apply this substitution, we can simplify the equation:

And then we get exactly the same response as a pure feed-forward controller! In itself that's not super exciting, why go through all this trouble to get the same response... The real benefit appears when we look at disturbance rejection later.

For now, it's important to realize how to obtain the P- and I-gains. The P-gain is effectively the same as the feed-forward gain. The I-gain is a function of and . By the dependence on , the I-gain relates to the characteristics of the first order system. This parameter could be identified from a flight test by looking at a pure step response on rollrate.

Step response

By simulating the first-order system and applying a PI-controller with these calculated gains, we can see that sum of the P- and I-terms remains constant. The rollrate response is exactly the same as with a feed-forward controller.

Disturbance rejection

The PI controller really starts shining when we look at disturbance rejection. We simulate a rollrate disturbance at time zero, while the setpoint remains 0 deg/s.

Increase response time

And the benefits don't stop there. With these PI-gains, the response is similar to feed-forward. We can actually make the system respond faster by increasing both and . This makes both step response and disturbance rejection faster. This is really only limited by the response time and saturation limits of the actuators. For the following step response and disturbance rejection examples, the gains were both multiplied by 3.

Does it really work?

I think I have seen enough to try and see how this behaves in the real world. Initially I will only try it on a roll response. I have some data from previous flights where I did a pure step input on roll, so that should give me enough information to choose and . I need to be careful about delays introduced by the actuators (the servo's are not infinitely fast). I also need to make sure the I-term saturation is not going to do something unexpected. Lastly, I need to be careful with actuator saturation. Only the actuator deflections that are actually achieved should be taken into account by the integrator.