Tuning the Heading PID
Purpose
The heading PID ensures the robot maintains its rotational alignment, correcting deviations from its desired heading.
Setup
- Open FTC Dashboard and go to the Follower tab.
- Enable
useHeading
and disable all other checkboxes. - Run the
StraightBackAndForth
OpMode. - Ensure the timer for autonomous OpModes is disabled.
Tuning Process
- Rotate the robot manually from one corner and observe its correction response.
- The robot should correct its heading smoothly without moving laterally.
- Adjust the PID constants (
headingPIDF
) in the FollowerConstants tab of FTC Dashboard.- Goal: Reduce oscillations while maintaining precise alignment.
Testing
Repeat the tuning process with varying rotation angles and directions to ensure consistent performance.
Input Tuned Values
- Open the
FConstants
class and navigate to thestatic{}
block. - Then, on a new line, add
FollowerConstants.headingPIDFCoefficients = new CustomPIDFCoefficients(P,I,D,F);
, withP
,I
,D
, andF
being the values you tuned for and inputted into FTC Dashboard.
Note: In Step 2, you only need to make a new line if you are not using the quickstart, otherwise, you can just modify the line that already does this.
Secondary PIDF Tuning
If you are going to use the secondary PIDF for heading error, you can tune the secondary PIDF coefficients by following the same process as the primary PIDF coefficients.
Input them into the FollowerConstants.secondaryHeadingPIDFCoefficients
in the FConstants
class the same way that the primary PIDF coefficients are inputted.
Congratulations, you’ve completed the Heading PIDF tuning!
Now, move onto the next section to tune your Drive PIDF Tuning.