Introduction to PID Tuning
Overview
Pedro Pathing relies on Proportional-Integral-Derivative (PID) controllers to ensure precise path-following performance. This guide will walk you through tuning the various PID controllers for translational, heading, drive, and centripetal corrections.
One vs. Two PID Systems
In Pedro Pathing, you can choose between using one or two PID controllers for each correction type:
-
Single PID System (Default):
- A single PID is responsible for managing all errors.
- Recommended for simplicity and most use cases.
-
Two PID System:
- Includes a main PID for handling larger errors and a secondary PID for smaller corrections.
- To enable this system:
- Open
FConstants
. - Set any of the following booleans to
true
by adding, in a new line in thestatic{}
block:FollowerConstants.useSecondaryTranslationalPID = true
FollowerConstants.useSecondaryHeadingPID = true
FollowerConstants.useSecondaryDrivePID = true
- Tune both the main and secondary PIDs:
- Main PID: Moves the error into the secondary PID’s range without causing overshoot.
- Secondary PID: Corrects small errors quickly and minimizes oscillations.
- Open
Tuning Steps Overview
Each PID has a specific purpose and is tuned independently:
- Translational PID: Maintains the robot on its path.
- Heading PID: Controls rotational alignment.
- Drive PID: Manages braking and acceleration along the path.
- Centripetal Force Correction: Corrects for deviations on curved paths.
Proceed through the following sections to tune each PID.