Difference between revisions of "PID Control"

From FRC11 - Mentor Wiki
Jump to navigation Jump to search
Line 40: Line 40:
  
 
* Cover use of the [https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html PIDF controller] built into the Talon SRX controllers by descriptive text here.  
 
* Cover use of the [https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html PIDF controller] built into the Talon SRX controllers by descriptive text here.  
−
* Maybe include advanced treatment (noise filtering, especially for D, windowing for I, cascading controllers?) and possibly info about the mentor PID Controller code when completed.  
+
* Maybe include advanced treatment (noise filtering, especially for D, cascading controllers?) and possibly info about the mentor PID Controller code when completed.  
−
* Additional topics: tips for tuning, keeping away from D unless necessary, typical places to apply on the robot.
+
* Additional topics: tips for tuning, typical places to apply on the robot.
 
* banding the PID control (I.e) multiple DLOs) to create a stronger response
 
* banding the PID control (I.e) multiple DLOs) to create a stronger response
−
* oscillations
+
 
−
* can’t correct with > 100% effort
 
  
 
[[Category:Programming]]
 
[[Category:Programming]]

Revision as of 19:21, 8 December 2021

Intro

PID Control is a closed loop control architecture that uses monitoring and feedback to improve control of a process variable - that is something you wish to control. It is more robust than open loop controllers that have a set it and forget it type of mentality, which do not monitor what is happening.

Before learning about PID Control, it is important to know where it fits in with other types of control options. The introduction to PID is on this other page.

See page: Intro to Control Theory and PID Loops

Tips and Guides

  • PID control works best if the underlying control mechanism does a decent job first
  • That way, the correction constants can be tuned to correct disturbances, and not to control the system for its default behavior.
  • This implies that your feed-forward/open loop/bias component should be calculated appropriately, and not rely on the PID portion to perform basic operation. Proper bias is an important element of the controller, and will allow you to focus efforts on tuning for step changes or variability, and not for basic performance. It is unnatural to combine them into the P, I, and D, and it will complicate the tuning process considerably if you do not account for a proper bias.
  • Get your bias right before tuning P, I, or D. If the bias is incorrect, you will have a hard time tuning with only P.
  • Tune P before I or D. P should generally be the largest input to correct the error, and should be tuned first. If you have to retune P, you will likely need to retune I and then D.
  • Tune I before D. I should be used to help with variation and unexpected inputs, that can be corrected over time. If you have to retune I, you will likely need to retune D.
  • Consider if windowing would be helpful. Windowing limits the impact of lengthy error accumulation, reducing windup, or effects after the problem has been corrected. However, if the window is too small, it may not guarantee that you ever reach the goal (setpoint).
  • D often does not need to be used
  • Only use D values if you have issues with oscillation, and are confident that is the best approach after considering:
  • Is your I value too high?
  • Would windowing the I integration to only recent samples help?
  • The Derivative component D is often subject to noise and can be difficult to control
  • You can perform noise filtering to get improvements at a cost of slightly delayed response for the D component. Usually the delayed response is insignificant.
  • When tuning, be mindful of what is available for corrections:
    • Know that you cannot correct with MORE than 100% of max positive output or MORE than of 100% max negative output.
    • Negative output is any output that causes the process variable to lessen
    • Note that either the max positive or max negative output may be nil (zero)
For example, when heating to a specific temperature, the best you may want to do when it is already too hot, is to turn off the heating element (not introduce cooling). Similarly, when cooling, you may only want to turn off cooling and not want to introduce heating when it has gotten too cold.

Resources

Links:

To Do:

  • Cover use of the PIDF controller built into the Talon SRX controllers by descriptive text here.
  • Maybe include advanced treatment (noise filtering, especially for D, cascading controllers?) and possibly info about the mentor PID Controller code when completed.
  • Additional topics: tips for tuning, typical places to apply on the robot.
  • banding the PID control (I.e) multiple DLOs) to create a stronger response