Class TunablePID
java.lang.Object
org.firstinspires.ftc.teamcode.fy23.processors.TunablePID
A simple PID algorithm that allows its constants to be changed on the fly. Useful for tuning
them in a TeleOp to instantly see the results of changes. It can also import a
PIDConsts
.
Implementation based on this pseudocode from GM0.
Positive error = positive correction.-
Constructor Summary
ConstructorDescriptionTunablePID
(double kP, double kI, double maxI, double kD) TunablePID
(double kP, double kI, double maxI, double kD, com.qualcomm.robotcore.util.ElapsedTime stopwatch) TunablePID
(PIDConsts pidConsts) TunablePID
(PIDConsts pidConsts, com.qualcomm.robotcore.util.ElapsedTime stopwatch) -
Method Summary
Modifier and TypeMethodDescriptionvoid
double
correctFor
(double error) int
correctFor
(int error) double
double
kD()
double
kI()
double
kP()
double
maxI()
void
setkD
(double kD) void
setkI
(double kI) void
setkP
(double kP) void
setmaxI
(double maxI)
-
Constructor Details
-
TunablePID
public TunablePID(double kP, double kI, double maxI, double kD, com.qualcomm.robotcore.util.ElapsedTime stopwatch) -
TunablePID
public TunablePID(double kP, double kI, double maxI, double kD) -
TunablePID
-
TunablePID
-
-
Method Details
-
clearIntegral
public void clearIntegral() -
correctFor
public double correctFor(double error) -
correctFor
public int correctFor(int error) -
kP
public double kP() -
setkP
public void setkP(double kP) -
kI
public double kI() -
setkI
public void setkI(double kI) -
maxI
public double maxI() -
setmaxI
public void setmaxI(double maxI) -
kD
public double kD() -
setkD
public void setkD(double kD) -
currentIntegralValue
public double currentIntegralValue()
-