Quote:
Originally Posted by Tominator368
- 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 just want to address items 2 and 3 of this. If you do decide to go your own route. The PIDSource and PIDoutput are small classes that need to be extended. The controller will send the output to the PIDOutput. It will call the PIDWrite(), and so you would presumably use this to write to the motors.
The PIDSource is a bit trickier. The pidGet() method should just return the sensor data. All in all they're both just wrappers of data that allow the PIDController class a fixed class to interact with. You may also want to just consider anonymous classes. They simplify your overall project structure.