|
Re: Encoder's PID functional but getRate method not-functional???
I think in your code you want to set the setpoint to rpm, not rpm over 60 or anything like that. Another problem could be that you set the PID controller to be continuous.
What kind of encoder are you using? is it an actual shaft encoder or a light sensor? I would be careful about using the getRate method, as this depends on the distance per pulse, which is not really defined for a shooter. In our code, we use the formula 60.0/getPeriod()/countsPerRev to find the rpm of the shooter and then use that in our PID input. It may be easier to implement all of this in a PIDSubsystem.
If you print spinnerEncoder.get() in your teleopPeriodic method, does it count now while the wheel is spinning, even if not with PID?
|