The Simulated weather for Sunday was Rain all day. The Reality was that after 10am it did not really rain again until 4:00pm. So I went flying. I'm currently working on altitude hold, but the wind was really gusty gusting from 5 to 20mph. A helicopter takes less energy to fly when moving than when it is hovering. If you try to hover in one spot with gusty winds the helicopter balloons up and down as the wind speed increases and decreases. This makes it very hard to sort out the altitude hold loop as you are never sure if the up and down is wind or oscillation's. I could hover lower and get a better handle on how the altitude loop gain is but until I have it hovering at high (recoverable) altitude I'm not going to play with the altitude hold down low. The altitude hold will have to wait until a calmer day.
So since I could not do altitude hold I thought I'd work on heading hold. In flying around with the magnetic heading hold engaged the helicopter seems relatively stable but the tail wandered a few degrees each way. I always thought that it was some local magnetic variation, that may contribute, but in looking at the data the tail target vs actual error is often 3 to 6 degrees and it wanders a bit. It seems to hold an offset. The standard way to fix this in a control loop is to add some integral error term and the result is The oscillation's you see on the left. So I turn down the I term (to 5% of the P term) and turn up the D term and its better, but still not ideal. You can still see some 3 to 4 second oscillations when steady and a fair bit of overshoot when perturbed. I'd been doing the default PID tuning of turning the P gain up to the point where it just starts to oscillate and taking the Ziegler-Nichols values you can find on the web. I conceptually understand what is going on, but this is straining my control system theory. (My only official control theory class was all done as laplace transforms in 1983) Early in my professional career(1985 to 1991) I did a fair number of analog and mixed analog/digital control systems, but always with a adult supervision from a controls person. Since 1991 I've mostly been a software coder. So in trying to relearn all of this I have a several specific questions that I'd love have any lurking control theory guys help me with.
Most control theory books, articles and tuning discussions assume you have a linear plant. In reality most of my "Plants" will be integral in nature. IE I do not control the thing I'm trying to close the loop on directly, I really control the acceleration or rate. So there are one or two physical integrals between my control input and the thing I want to control. See the example to the left.
If I just close the loop around the whole thing, its going to be really unstable. So my plan was to have Target Position yield Target Velocity Target Velocity yield target Pitch and Target Pitch yield Pitch Rate. This would have hard limits for each intermediate step. IE max velocity will be 5m/sec, regardless of the position error. Clearly every intermediate step in this will have a proportional gain term, any advice on which ones should have integral terms and when I should reset the integrals to zero?
I'm also struggling with a stupid simple question I have about PID terminology. You can express a PID as
or You can express a PID loop as
control = (P*Error)+(I*Integral )+(D*difference_or_rate)
When you look at the standard Ziegler-Nichols chart :
for PID P = .6Gu I=2/PU D=PU/8 Is this for the first form or the second? When you measure Pu I assume Pu is the oscillation period in samples (this is a discrete system), or have I made a wrong assumption here?
Lastly is the guidance for standard linear PID tuning even valid for this sort of plant? If not can one provide some guidance on tuning such loops?