Team5830 / 2022-Rapid-React

Team 5830's robot code for FIRST Rapid React (2022)
MIT License
0 stars 0 forks source link

Tune PID flywheel control #33

Open asteele11 opened 2 years ago

asteele11 commented 2 years ago

This requires changing the P, I, D values as well as the feedforward value so that the flywheel gets to the target speed quickly. The speeds reported to smartdashboard currently don't account for the (3:1) gear ratio on the flywheel. Steps:

  1. Add a button to run the flywheel_test command, this should load the parameters (including the target speed) from the SmartDashboard and start the flywheel.
  2. Use the 'Easy Shooter' button which just sets the percent of the motor value, record the speed value that the flywheel reaches. This will just be an initial value that we can target.
  3. Adjust the PID and feedforward values. This link gives a description of steps to follow: https://docs.wpilib.org/en/stable/docs/software/advanced-controls/introduction/tuning-pid-controller.html?highlight=pid%20tuning The basic idea is to set FF, I and D to zero and then turn P up until the flywheel oscillates about the setpoint. Keeping the P value the same then increase D until the oscillations damp out. With these two parameters set adjusting I (and/or the FF value) should help to reduce any offset from the target value.