# PID Control - Actuator non-linearity

I'm writing code for a PID controller. The system is a "see-saw" with a motor attached to a propeller on one end and nothing on the other - you can call it a 1DOF helicopter. I use an angle sensor positioned on the rotation axis to get the reading and generate the P, I and D values accordingly. The "plant" (what I'm controlling) is the motor's RPM...

After a lot of effort, I'm still unable to stabilize the system. Now I'm thinking... It's the thrust that generates angle change - but the relationship between motor RPM and generated propeller thrust isn't linear - can this be the cause ?

• Start with a P-only controller and try and get that stable. If it's oscillating then reduce the gain. If it's working it should settle down with an offset from your target setpoint. Then you can introduce the integral term to iron out the error. (I've never tried to do what you're trying to do.) Dec 25, 2018 at 23:32
• "(I've never tried to do what you're trying to do.)" What exactly do you mean ? Dec 25, 2018 at 23:43
• I've never built a PID propeller controller. I've done temperature (and some servo control) but they're relatively simple. Dec 25, 2018 at 23:46
• You have a serious complicating factor in this plant, one that has stymied many a aerospace engineer. A propeller close to the ground has very little lift, and it greatly increases once it goes up in the air. This is called “ground effect” and it means that the gain of your plant will have a very nonlinear dependency on the angle. Dec 26, 2018 at 0:14
• Edgar, in my experience the opposite is true. I've found drones and things to have more thrust just above the ground. This may not hold when the prop is actually touching the ground, but still.
– Drew
Dec 26, 2018 at 2:50

Your problem is that the plant you're controlling is high order. While non-linearity can be a complicating factor, it doesn't usually prevent stability once the time constants have been sorted out.

Let's put aside for the moment whether your PID electrical output is controlling the motor voltage or the motor current. Let's assume it's somehow magically controlling the propeller thrust.

The thrust provides acceleration, which integrates to velocity, which integrates to angle. So here you have two integrations, or 180 degrees phase shift. Any lags in the system will increase the phase shift further. So you have a system that will naturally want to be unstable. You are going to have to design stability into it.

Now consider your motor. I'd imagine you're controlling the voltage. There are several integrations yet to get to motor speed and so thrust, making the whole system higher order.

If the corner frequencies of your motor electrical 'input to thrust' co-incide with those of your 'thrust to angular position' system, then you have a very high order system that will be nigh on untameable. The trick is to move the two responses apart in frequency, a divide and conquer approach, often by speeding up one response and slowing down the other. A PID controller has only the D term to tame one order. It's usually not sufficient to cope with a high order system, you will need to design and add additional phase leads.

How to do that systematically, because with a high order system, hope'n'poke is almost always doomed to failure? Start by characterising the system open loop. Find the motor input that just makes it balance, then vary the motor input at various rates and measure the corresponding output variations. It can help for this stage of the process to reconfigure your see-saw so it's a pendulum. This guarantees the stability, and allows you to make measurements without it hitting the endstops, a form of nonlinearity that really messes things up. The extra stability of the pendulum is easily modelled, allowed for and removed.

Then hit google for what to do with this set of open-loop measurements. I usually use the Bode plot to see what's happening, but cleverer people just go straight in with Routh Horowitz. It's not easy, people do PhDs on and around these topics, but it is possible. And it does tend to need a mathematical systematic approach.

Finally, a note on non-linearity. It changes the gain of the system. As the position of the closed loop time constants depend on the total gain, they move about as the gain varies. A successful system design will place the time constants far enough apart that the system stays stable, even with their maximum excursion. Obviously, that needs a good understanding of where they are in the open loop.

• I don't control the voltage - it's a brushless motor. I give PWM commands to a brushless speed controller at 400 Hz which in turn commutates the motor. I understand that the dynamics of the systems are rather complicated - but this is exactly what simple 8 bit microcontrollers do when they control < 15 \$ drones... Dec 26, 2018 at 12:28
• @shaiko A simple 8 bit MCU can still implement an algorithm sufficiently more advanced than simple PID. If you delve into what exactly the ESC is doing, I think you'll find it's controlling the effective voltage to the motor by PWM'ing the phases, and is then commutating according to its back EMF, so you still have integrations to get from command to speed. A sensored motor with position feedback would be capable of tighter control. You still have to understand what's happening open loop before you close it, unless you are very lucky or inspired. Dec 26, 2018 at 13:42