Translational
Tuning the translational PID
Purpose
The translational PID ensures the robot follows a straight path without lateral deviation. It corrects the robot’s position along an imaginary forward line from its starting position.
Setup
- Open Panels. If you haven't used Panels before, you can read their documentation on the "Panels" tab of this website.
- On your Driver Hub or Driver Station, and connect a gamepad to it. Make sure to press "start" + "a" on the gamepad.
- Select the
Tuning
Opmode. Use your gamepad to selectManual
. Then, selectTranslational
. - Ensure that the timer for autonomous OpModes is disabled. Otherwise, the OpMode will automatically stop after 30 seconds.
- Run the run the
Translational
tuner autonomous OpMode.
Note that while running the TranslationalTuner
OpMode, the robot will stay in place. This is intentional.
Tuning Process
Follow this video to help you tune the PID:
- Push the robot left or right at varying amounts and observe how the robot corrects back to its starting position.
- Adjust the PID constants (
translationalPIDFCoefficients
) in the FollowerConstants tab of Panels to ensure that the robot can accurately correct back to its starting position with minimal oscillations. For example, if the robot has too many oscillations while correcting back to its starting position, lower the P value. On the other hand, if the robot corrects back to its starting location too slowly, increase the P value. If you do not have prior experience with tuning PIDs, we reccommend that you check out the resources provided at the bottom of the PID Tuners page to learn more about tuning PIDs.
If you have a dual PID system enabled, it is recommended to first tune the main PID, translationalPIDFCoefficients
, to ensure that the robot can smoothly correct from large errors. Then, tune the secondary PID, secondaryTranslationalPIDFCoefficients
, so the robot can smoothly correct from smaller errors.
Note: Don't worry if the robot doesn't correct its heading. We are only tuning for the translational PID: whether the robot corrects left/right appropriately.
Warning: After adjusting a value in Panels, hit "enter" in order to save it and cause the robot to correct differently. However, any values you modify through Panels are not saved into your code! In order to transfer the values you just tuned on Panels into your code, go to the Update Tuned Values section to learn more.
Feedforward Adjustments (Optional)
If additional feedforward is needed, use translationalPIDFFeedForward
for corrections in the robot’s movement direction. Avoid modifying the feedforward term directly in the PIDF.
Update Tuned values Into Your Code
- Once you are satisfied with your translationalPIDF values, head over to the
Constants
file. - Navigate to the line
.translationalPIDFCoefficients(new PIDFCoefficients(0.1, 0, 0.01, 0))
- Update the parameters in
new PIDFCoefficients(0.1, 0, 0.01, 0)
with thetranslationalPIDFCoefficients
values,P, I, D, F
, you tuned on Panels in that order. - If you are using the dual PID system, add the line
.secondaryTranslationalPIDFCoefficients(new PIDFCoefficients(0.1,0,0.01,0))
and update thesecondaryTranslationalPIDF
values you tuned on Panels.
Congratulations, you’ve completed the translational PIDF tuning!
Troubleshooting
If you encounter a problem while tuning the translational PID, check out the troubleshooting page.
Last updated on