I was just perusing some of the EMC docs, and wound up on the PID hal component docs and source. I have never quite understood the behavior of the D term.
To (over) simplify: error = commanded - feedback errorD = error - previous error output = error * P + errorI * I + errorD * D Let's look at a couple cases : 1. commanded pos is 5.0, feedback is now 4.8, it was 4.8 last servo cycle. So, error is -0.1, previous error is -.2, so errorD is -0.1 - (-0.2) = +.1 Now, errorD is multiplied by the P term and adds a positive value to the output. This seems wrong, as the error is decreasing with movement in the positive direction, so you would actually want to add a negative adjustment to the output to avoid overshooting the commanded position. Here's another: commanded position is 5.0, and not changing. A disturbance has occurred, and the feedback is now 4.9, so the machine just bumped in the minus direction. error is -0.1, previous error was zero. errorD is -0.1 -(0) = -0.1 This adds a negative adjustment to the output, which is forcing it in the wrong direction. It should be moved to the positive to correct the disturbance. Any comments on this? This was mostly derived from the comments, as the actual code is a bit more complex, and seems to involve derivatives of both commanded and feedback, rather than looking at just error and previous error. I will have to try negative D values to see what they might do. Jon ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers