Class TurningRatePIDProcessor
- java.lang.Object
-
- org.team1540.rooster.drive.pipeline.PIDProcessor<TankDriveData,TankDriveData>
-
- org.team1540.rooster.drive.pipeline.TurningRatePIDProcessor
-
- All Implemented Interfaces:
Function<TankDriveData,TankDriveData>,Processor<TankDriveData,TankDriveData>
public class TurningRatePIDProcessor extends PIDProcessor<TankDriveData,TankDriveData>
Modifies velocity set-points to keep a desired turning rate. ThisProcessoraccepts aTankDriveDataand uses the turning rate as an input to the loop.- See Also:
Processor,PIDProcessor
-
-
Constructor Summary
Constructors Constructor Description TurningRatePIDProcessor(@NotNull DoubleSupplier yawRateSupplier, double p, double i, double d, boolean invertSides)Creates a newTurningRateClosedLoopProcessor.TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p)Creates a newTurningRateClosedLoopProcessorwith P and I D coefficients of 0 that does not invert sides.TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p, boolean invertSides)Creates a newTurningRateClosedLoopProcessorwith I and D coefficients of 0.TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p, double i)Creates a newTurningRateClosedLoopProcessorwith a D coefficient of 0 that does not invert sides.TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p, double i, boolean invertSides)Creates a newTurningRateClosedLoopProcessorwith a D coefficient of 0.TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p, double i, double d)Creates a newTurningRateClosedLoopProcessorthat does not invert sides.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TankDriveDatacreateOutput(TankDriveData data, double loopOutput)Create the processor output.protected doublegetError(TankDriveData data)Extract the PID loop target from the data passed to the processor, and calculate the current error.-
Methods inherited from class org.team1540.rooster.drive.pipeline.PIDProcessor
apply, getError, getIAccum, reset
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.team1540.rooster.functional.Processor
followedBy, process
-
-
-
-
Constructor Detail
-
TurningRatePIDProcessor
public TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p)
Creates a newTurningRateClosedLoopProcessorwith P and I D coefficients of 0 that does not invert sides.- Parameters:
yawRateSupplier- ADoubleSupplierthat supplies the current yaw rate in radians per second.p- The P coefficient of the PID loop.
-
TurningRatePIDProcessor
public TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p, double i)
Creates a newTurningRateClosedLoopProcessorwith a D coefficient of 0 that does not invert sides.- Parameters:
yawRateSupplier- ADoubleSupplierthat supplies the current yaw rate in radians per second.p- The P coefficient of the PID loop.i- The I coefficient of the PID loop.
-
TurningRatePIDProcessor
public TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p, double i, double d)
Creates a newTurningRateClosedLoopProcessorthat does not invert sides.- Parameters:
yawRateSupplier- ADoubleSupplierthat supplies the current yaw rate in radians per second.p- The P coefficient of the PID loop.i- The I coefficient of the PID loop.d- The D coefficient of the PID loop.
-
TurningRatePIDProcessor
public TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p, boolean invertSides)
Creates a newTurningRateClosedLoopProcessorwith I and D coefficients of 0.- Parameters:
yawRateSupplier- ADoubleSupplierthat supplies the current yaw rate in radians per second.p- The P coefficient of the PID loop.invertSides- Whether to invert the output of the PID loop before sending it onwards.
-
TurningRatePIDProcessor
public TurningRatePIDProcessor(DoubleSupplier yawRateSupplier, double p, double i, boolean invertSides)
Creates a newTurningRateClosedLoopProcessorwith a D coefficient of 0.- Parameters:
yawRateSupplier- ADoubleSupplierthat supplies the current yaw rate in radians per second.p- The P coefficient of the PID loop.i- The I coefficient of the PID loop.invertSides- Whether to invert the output of the PID loop before sending it onwards.
-
TurningRatePIDProcessor
public TurningRatePIDProcessor(@NotNull @NotNull DoubleSupplier yawRateSupplier, double p, double i, double d, boolean invertSides)Creates a newTurningRateClosedLoopProcessor.- Parameters:
yawRateSupplier- ADoubleSupplierthat supplies the current yaw rate in radians per second.p- The P coefficient of the PID loop.i- The I coefficient of the PID loop.d- The D coefficient of the PID loop.invertSides- Whether to invert the output of the PID loop before sending it onwards.
-
-
Method Detail
-
getError
protected double getError(TankDriveData data)
Description copied from class:PIDProcessorExtract the PID loop target from the data passed to the processor, and calculate the current error.- Specified by:
getErrorin classPIDProcessor<TankDriveData,TankDriveData>- Parameters:
data- The data instance that was passed to the processor'sapply()method.- Returns:
- The error.
-
createOutput
protected TankDriveData createOutput(TankDriveData data, double loopOutput)
Description copied from class:PIDProcessorCreate the processor output.- Specified by:
createOutputin classPIDProcessor<TankDriveData,TankDriveData>- Parameters:
data- The data instance that was passed to the processor'sapply()method.loopOutput- The output of the PID loop- Returns:
- The processor's output; this will be returned from the the processor's
apply()method.
-
-