Has anyone tried Ziegler-Nichols PID Tuning?

As title states, has anyone tried it? I’ve heard mixed levels of approval.

Yep. Worked like a champ the first year. However the second year, there was a bit unsettled/overshoot and it was tough to find the critical oscillation point. The arm always wanted to dampen itself down. The drive part worked, but the arm was off a wee bit but not very noticeable. It may be due to a larger mass of the arm in year 2 over year 1.

Also, make sure your units are correct when figuring out the period at the point of critical oscillation. That messed up the calculations the first time around.

Follow the instructions you found in the Aura text and do the following:

  1. Log your time, position, (cleaned/slewed) motor power, current error, and factors of kp, ki, and kd at a fairly small time interval. Use the debug stream for this. Tuning only requires kp at first.
  2. Copy/paste into Excel (or open office), clean up any noise in the data.
  3. Graph it. Look at the oscillations and over or undershoot.
  4. Adjust kp upward and repeat. Find the critical oscillation point of kp (when it does not damp/settle any more)
  5. Get the period between peaks from the data
  6. Do the math the formulas tell you
  7. Adjust/tweak from there…

You can see the impact of the ki and kd in excel a bit more to see how much each is affecting the results. If ki is uncapped, then you have some over application of the integral making it too much of a factor.

If the kp or ki factors are too large or if kd is too small, you will see the “braking” happening too late and attempt to stop the arm/drive just a few milliseconds before your target. That will lead to offshoot.

Have fun!

This was the news I was expecting to hear, thanks!

Also, what is this Aura text? I found the method through research I’ve been doing about tuning PID controllers, most of it unrelated to robotics.

I’d love to take credit, but we haven’t actually published any PID tuning instructions.

George from 2921 wrote a guide here which mentions the Ziegler-Nichols method.

Z-N method is what we used to do the initial tuning of the VEX IQ motors.

Since our control loop uses more than just PID in that motor, we used Z-N to just get us the critical damping conditions, then moved on to a custom algorithm to adjust Velocity feed forward gain and the “Velocity + Position” lop gains.

Z-N is a very good method to tune traditional PID loop gains. If you can’t hone in on a good set of gains using Z-N, then there are probably some mechanical adjustments (gear ratio, inertia matching) that you need to make to your system.

Thanks for the responses and tips. I’ll definitely be trying it out later in the year (read: once the robot is built).

It would be nice to hear more about how you approached this. Did you tune the motors under load or free running? Does the motor modify the algorithm based on history, i.e… does it modify the constants to improve performance over time when the motor is used in a particular application. It would be interesting to try and apply the same techniques to the 393 motor.

We did tuning under load on our dynomometer. After initial tuning, we tested the response at various loading conditions, including free speed, but our main testing was focused around the band on either side of 80% power.

SIDE NOTE FOR THOSE OF THAT MAY NOT KNOW THIS - The power curve on a DC motor is a parabola. Max power happens at about 50% speed. Since it is a parabola, 80% max power happens at speeds both faster and slower than max power.

It is not an adaptive method, so no it does not use an algorithm based on total history. Our main objective was to make the motor behave consistently under a multitude of battery conditions and loading conditions.

In addition to the two stage PID I briefly described in the earlier post, we use a motion planner in between the brain and motor. The brain tells the motor how far and what speed it would like the motor to go. The motor then plans the motion path (a double linear velocity planning profile) and executes the motion path accordingly.

It is definitely possible to get the 393 motor to do this algorithm, but it will have to be done in the Cortex since neither the 393 motor nor the Motor Controller 29 have the ability to do PID or motion planning.