frc3512 / Robot-2015

The source code for the 2015 FRC robot.
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Apply Feed Forward to Control Loops #1

Open calcmogul opened 9 years ago

calcmogul commented 9 years ago

The elevator PID loop would behave more predictably if a feed forward were applied. P, I, and D wouldn't need to be nearly as high as they are now. If we compensate for gravity in the feed forward, we won't need two PID profiles anymore. This would also fix the motion profile autonomous driving, which is currently unpredictable.

In order to have enough control over what is applied to the motor in each loop iteration, I think we'll need to go back to PID on the roboRIO instead of offloading it to the CAN Talons; they don't have the right feed forward implementation. There is a PIDController class in the RobotModules project that could be used instead of WPILib's, since WPILib's PIDController class suffers from the same problem that the CAN Talons do.

RogShotz commented 8 years ago

Is this still an issue, we should review this, and if not remove it from the issue box.

calcmogul commented 8 years ago

Yes it is. Instead of using a custom PID controller though, you can now simply override CalculateFeedForward() to make your own feed forward that compensates for gravity. Doing so would also fix the need for separate PID constants for the elevator going up versus down.