# Model-based Ziegler-Nichols tuning of a hover PID controller

Doing a fun project to reconnect with my engineering training: I would like to design a control scheme for hovering in-place at a set altitude with a vertically-oriented propeller, rocket, etc. Right now I'm not even worried about lateral motion, just the vertical component. My plan is to use PID control and tune with the Ziegler-Nichols method for no-overshoot. The system is so simple I can write down a model of the P-only controlled system rather than tune experimentally. Just using Newton's 2nd law and ignoring aerodynamic effects:

\begin{align} m x^{\prime\prime} & = g m + T \\ x^{\prime\prime} & = g + \frac{K(x - x_{target})}{m} \end{align}

Where $g$ is gravity, $m$ is mass, $x$ is height, and $T = K(x-x_{target})$ because my thrust is proportional to the error times the gain $K$. Using $sin(\omega t)$ as a trial solution I get:

\begin{align} \omega & = \textstyle\sqrt{\frac{K}{m}} \\ T_u & = 2\pi\textstyle\sqrt{\frac{m}{K}} \end{align}

However it seems like I get free choice of the ultimate gain $K$, since any choice of $K$ causes the system to oscillate, as far as I can tell. What am I missing?

The reason that your system oscillates regardless of the value of $K$ that you choose is because there is no energy loss in your model. All of the energy is stored as potential gravitational energy (which can be ignored for now), kinetic energy in the mass, and "potential" energy in the proportional control (it acts like a spring in your system connecting the mass to the desired position). So if your system starts where $x \neq x_{target}$ you can think of it as pulling and releasing a spring (without any friction).
$mx'' + bx' = gm + T$
As for what value to pick for $b$, who knows? It will depend largely on the aerodynamics of your aircraft. Ziegler-Nichols will work for this system.