|
Velocity-based PID with the WPILib PIDController Class
Greetings all!
We're trying to implement velocity-based PID loop using the supplied WPILib PIDController class. We've had limited success, but it's still not working quite the way we want it to.
We wrote a wrapper class called PIDEncoder which passes GetRate() from the Encoder class to PIDGet()
We then translate our joystick axes to desired wheel speeds, and pass those into our PIDController SetPoints.
The problem is that our wheel speeds never reach our desired SetPoints. When our SetPoint is 10000 counts per second for instance, our wheels only reach about 5000 counts per second.
Right off the bat, many of you will suggest we up our P constant, however increasing it any more results in our wheels oscillating very badly, especially at low speeds.
Can anyone else share some of their experience in getting velocity-based PID to work with the supplied WPILib?
At this point, I'm not sure if I can simply tune the PID constants to get it working the way we want it to, or if we need to tweak the PID Controller class itself - i.e. getting the Proportional response to be non-linear. Should we only be using the I term?
System specs:
-4 x US Digital 256 CPR Encoders (included with ToughBoxes)
-4 x 8" Wheel via 1:1 chain + sprockets to unmodified ToughBox w/ 1 CIM
-1 ToughBox/CIM combo per wheel
-P = 0.00014, I = 0, D = 0
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
|