Heading
The heading PIDF corrects for the robot's heading while following the path.
Setup
- Open Panels. If you haven't used Panels before, you can read the documentation on the Panels tab of this website (You can switch on the Top Left of the Website).
- On your Driver Hub or Driver Station, select the
Tuning
Opmode and then chooseHeadingTuner
. - Ensure that the timer for autonomous OpModes is disabled. Otherwise, the OpMode will automatically stop after 30 seconds.
- Run the run the
HeadingTuner
autonomous OpMode.
Note that while running the Heading Tuner
OpMode, the robot will stay in place. This is intentional.
Tuning Process
Follow this video to help you tune the PIDF:
- Turn the robot left or right at varying amounts and observe how the robot turns back to its starting heading.
- Adjust the PIDF constants (
headingPIDFCoefficients
) 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 PIDFs, we reccommend that you check out the resources provided at the bottom of the PIDF Tuners page to learn more about tuning PIDFs.
If you have a dual PIDF system enabled, it is recommended to first tune the main PIDF, headingPIDFCoefficients
, to ensure that the robot can smoothly correct back from large errors. Then, tune the secondary PIDF, secondaryHeadingPIDFCoefficients
, so the robot can smoothly correct from smaller errors.
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 the feedforward term directly in the headingPIDFCoefficients
and/or secondaryHeadingPIDFCoefficients
if
you are using dual PID.
Update Tuned values Into Your Code
- Once you are satisfied with your headingPIDF values, head over to the
Constants
file. - Navigate to the line
.headingPIDFCoefficients(new PIDFCoefficients(0.1, 0, 0.01, 0))
- Update the parameters in
new PIDFCoefficients(0.1, 0, 0.01, 0)
with theheadingPIDFCoefficients
values,P, I, D, F
, you tuned on Panels in that order. - If you are using the dual PIDF system, add the line
.secondaryHeadingPIDFCoefficients(new PIDFCoefficients(0.1,0,0.01,0))
and update thesecondaryHeadingPIDF
values you tuned on Panels.
Troubleshooting
If you encounter a problem while tuning the heading PIDF, check out the troubleshooting page.
Last updated on