Package edu.wpi.first.wpilibj
Class SynchronousPID
- java.lang.Object
-
- edu.wpi.first.wpilibj.SendableBase
-
- edu.wpi.first.wpilibj.PIDBase
-
- edu.wpi.first.wpilibj.SynchronousPID
-
- All Implemented Interfaces:
PIDInterface
,PIDOutput
,Sendable
,AutoCloseable
public class SynchronousPID extends PIDBase
Class implements a synchronous PID control loop.Provides a calculate method for the user to call at their desired update rate.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.wpi.first.wpilibj.PIDBase
PIDBase.AbsoluteTolerance, PIDBase.NullTolerance, PIDBase.PercentageTolerance, PIDBase.Tolerance
-
-
Field Summary
-
Fields inherited from class edu.wpi.first.wpilibj.PIDBase
kDefaultPeriod, m_enabled, m_pidInput, m_pidOutput, m_pidWriteMutex, m_setpointTimer, m_thisMutex
-
-
Constructor Summary
Constructors Constructor Description SynchronousPID(double Kp, double Ki, double Kd, double Kf, PIDSource source, PIDOutput output)
Allocate a PID object with the given constants for P, I, and D.SynchronousPID(double Kp, double Ki, double Kd, PIDSource source, PIDOutput output)
Allocate a PID object with the given constants for P, I, and D.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
calculate()
Read the input, calculate the output accordingly, and write to the output.void
free()
Free the PID object.-
Methods inherited from class edu.wpi.first.wpilibj.PIDBase
calculateFeedForward, get, getAvgError, getContinuousError, getD, getDeltaSetpoint, getError, getF, getI, getP, getSetpoint, initSendable, onTarget, pidWrite, reset, setAbsoluteTolerance, setContinuous, setContinuous, setD, setF, setI, setInputRange, setOutputRange, setP, setPercentTolerance, setPID, setPID, setSetpoint, setTolerance, setToleranceBuffer
-
Methods inherited from class edu.wpi.first.wpilibj.SendableBase
addChild, close, getName, getSubsystem, setName, setName, setName, setSubsystem
-
-
-
-
Constructor Detail
-
SynchronousPID
public SynchronousPID(double Kp, double Ki, double Kd, PIDSource source, PIDOutput output)
Allocate a PID object with the given constants for P, I, and D.- Parameters:
Kp
- the proportional coefficientKi
- the integral coefficientKd
- the derivative coefficientsource
- The PIDSource object that is used to get valuesoutput
- The PIDOutput object that is set to the output percentage
-
SynchronousPID
public SynchronousPID(double Kp, double Ki, double Kd, double Kf, PIDSource source, PIDOutput output)
Allocate a PID object with the given constants for P, I, and D.- Parameters:
Kp
- the proportional coefficientKi
- the integral coefficientKd
- the derivative coefficientKf
- the feed forward termsource
- The PIDSource object that is used to get valuesoutput
- The PIDOutput object that is set to the output percentage
-
-
Method Detail
-
free
public void free()
Free the PID object.- Overrides:
free
in classSendableBase
-
-