So as some of the more seasoned programmers may know, there is a way to tune PID mathematically. This is called the Zeigler-Nichols method. The only downside, is that a lot of teams don’t have access to the equipment needed to find the kU or tU. Which means that we don’t have access to such information.
So I was wondering, could we find these two variables with arrays in robotC, or would I have to buy an oscilloscope, and take measurements for crest-crest time on the tU. As for the kU, how would I find the constant amplitude? I wish vex would have given us some of this data. Unless it is dependent upon robot types.
Correct me if I’m wrong, but wouldn’t the appropriate way to find this be to take whatever it is you’re tuning, set Ki and Kd to 0, slowly turn up Kp until you get the oscillation you’re supposed to with Ziegler-Nicholas, and then just use a ruler and a stopwatch (or have the code spit out time values every time it reverses direction) to find Ku and Tu? And then from there use the various equations to get your other values?
EDIT: It wouldn’t even be a ruler, I believe you’d just spit out your encoder (or whatever) value every time it reverses direction.
You are attempting to tune a complete system so, no, there won’t be any “standard” values you can just plug in. All control systems can be simplified to an input (or multiple inputs) and an output (or mutiple outputs) and stuff happening between, which can vary a lot. More often than not optimal tuning methods just provide a starting point for real world adjustments. Sometimes control loop tuning parameters are tweaked in real time according to load variations too so finding a magic set of numbers for all occasions isn’t likely.
The resonant frequency can be obtained fairly readily by measuring output response to an input step change. Log the position data periodically (search for posts on this topic, it’s pretty easy to achieve in robotC) and plot. No need for an oscilloscope and if your position is from a digital encoder then perhaps an oscilloscope is of limited use anyway.
No need for an oscilloscope. Use write debug stream info and you can use real data and logs to find the critical values.
Thanks for all of the replies,
I was completely misinformed as to how I would find these. Thanks to everyone that helped!
I have just written a pid processor and am trying to tune the constants. This thread has some similar discussions:
https://vexforum.com/t/has-anyone-tried-ziegler-nichols-pid-tuning/26858/1
I think program is still the best way to find the empirical values for zi method. I am still working on writing the program. Once a stable PID processor for the base is constructed, creating something wingus and dingus did last year for programming skills will be easier.
What exactly did they do last year?
A piece of elegant programming work. Three programming skill pieces I would watch all the time: 7856 programming run of toss up, 1103 round up and this.
I didn’t understand what you were referencing, but now I do. I completely agree that a well-tuned PID loop will make for an awesome autonomous writer. In fact, I am working on one currently :D!