![]() |
PIDController class (PIDSource/PIDOutput interfaces?)
I was looking at the WPILib codebase and saw that their PIDController class uses the PIDSource and PITOutput interfaces for I/O to/from the control loop. However I was surprised to see that no WPILib classes actually inherit from these interfaces.
Is the intention that I should inherit from PIDSource and PIDOutput as necessary? Ex: Code:
class PIDEncoder : public Encoder, public PIDSourceThanks |
Re: PIDController class (PIDSource/PIDOutput interfaces?)
Give it a try and see what happens. Tell me how its goes, I am starting to look at the same thing now.
also Quote:
|
Re: PIDController class (PIDSource/PIDOutput interfaces?)
Quote:
|
Re: PIDController class (PIDSource/PIDOutput interfaces?)
The idea is that you create subclasses of whatever you want to read inheriting PIDSource and whatever you want to control inheriting PIDOutput. They provide the methods to get the values from the sensor and provide output values for the controlled thing.
It works that way because a single sensor might not be used, but maybe some group of sensors, or a camera X position, or something more complex. And the thing being controlled may be more complex then just a motor. We'll try to post an example later today. |
| All times are GMT -5. The time now is 10:35 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi