A new output will only be calculated when sample_time seconds has passed: pid. To achieve this, set sample_time to the amount of time there should be between each update and then call the PID every time in the program loop. The PID works best when it is updated at regular intervals. The PID class implements _call_(), which means that to compute a new output value, you simply call the object like this: output = pid ( current_value ) The basics update ( control )Ĭomplete API documentation can be found here. update ( 0 ) while True : # Compute new output from the PID according to the systems current value control = pid ( v ) # Feed the PID output to the system and get its current value v = controlled_system. Usage is very simple: from simple_pid import PID pid = PID ( 1, 0.1, 0.05, setpoint = 1 ) # Assume we have a system we want to control in controlled_system v = controlled_system. If you want a PID controller without external dependencies that just works, this is for you! The PID was designed to be robust with help from Brett Beauregards guide. ![]() A simple and easy to use PID controller in Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |