I am having a similar problem to the one found in this
http://www.chiefdelphi.com/forums/sh...d.php?t=114061 thread; I want to be able to run multiple different PID loops from the same subsystem. Does anyone know a relatively modular way to create as many PID loops as you want? I'm not sure if it's as straightforward as this:
- Create a PIDController object, handing it the proper P,I, and D values, as well as instances of the following two classes:
- Create a class extending PIDSource and hand it the value of the controller in PIDget()
- Create a class extending PIDOutput and have it change some value inside of PIDWrite()
- Use the output of the controllers as needed
I'm struggling to find much documentation or examples regarding these classes and methods, and I'm not sure if that's actually what they do, I'll admit it's basically a guess as to what they are. If anyone could let me know if I'm thinking along the right lines or if I'm misunderstanding these functions that would be great. I may need to implement as many as 3 different PID loops to control the same hardware depending on the scenario, some of them combined with others. Thanks.
EDIT: I ended up just wrapping PIDOutput in a class I called PIDHandler which simply returns the output of the controller in a getValue() method as the "output". I then was able to use those raw outputs in my calculations.