Package ca.team3161.lib.robot.pid
Interface PID<T extends edu.wpi.first.wpilibj.PIDSource,V extends java.lang.Number>
-
- Type Parameters:
T
- the type of sensor used as input to this PID system.V
- the type of value read from the sensor used as input to this PID system.
- All Known Implementing Classes:
AbstractPID
,PIDulum
,SimplePID
,TractionController
,VelocityController
public interface PID<T extends edu.wpi.first.wpilibj.PIDSource,V extends java.lang.Number>
A PID loop, which uses a PIDSrc and a set of constants to iteratively determine output values with which a system can reach and maintain a target value.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
atTarget()
Check if this PID has reached its target value.void
clear()
Reset the state of this PID loop.float
getkD()
Get the Derivative constant for this PID.float
getkI()
Get the Integral constant for this PID.float
getkP()
Get the Proportional constant for this PID.PIDSrc<T,V>
getSrc()
Get the source sensor of this PID.V
pid(V target)
Iterate the PID loop.void
setkD(float kD)
Set the Derivative constant for this PID.void
setkI(float kI)
Set the Integral constant for this PID.void
setkP(float kP)
Set the Proportional constant for this PID.
-
-
-
Method Detail
-
clear
void clear()
Reset the state of this PID loop.
-
pid
V pid(V target)
Iterate the PID loop.- Parameters:
target
- the desired target value. Units depend on the context of this PID- Returns:
- the output value to set to eg a SpeedController to reach the specified target
-
getSrc
PIDSrc<T,V> getSrc()
Get the source sensor of this PID.- Returns:
- the PIDSrc (PID source sensor) used by this PID loop
-
atTarget
boolean atTarget()
Check if this PID has reached its target value.- Returns:
- whether this PID loop has reached the specified target value
-
setkP
void setkP(float kP)
Set the Proportional constant for this PID.- Parameters:
kP
- the Proportional constant.
-
getkP
float getkP()
Get the Proportional constant for this PID.- Returns:
- the Proportional constant.
-
setkI
void setkI(float kI)
Set the Integral constant for this PID.- Parameters:
kI
- the Integral constant.
-
getkI
float getkI()
Get the Integral constant for this PID.- Returns:
- the Integral constant.
-
setkD
void setkD(float kD)
Set the Derivative constant for this PID.- Parameters:
kD
- the Derivative constant.
-
getkD
float getkD()
Get the Derivative constant for this PID.- Returns:
- the Derivative constant.
-
-