Package frc.spectrumLib.util
Class CachedDouble
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.spectrumLib.util.CachedDouble
- All Implemented Interfaces:
Sendable,Subsystem,DoubleSupplier
Caches a DoubleSupplier so its value is computed at most once per scheduler iteration.
SubsystemBase registers the instance with the scheduler on construction, and that is what calls
periodic() to clear the cache.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublevoidperiodic()Drops the cached value so the nextgetAsDouble()reads the source again.Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
CachedDouble
-
-
Method Details
-
periodic
public void periodic()Drops the cached value so the nextgetAsDouble()reads the source again. -
getAsDouble
public double getAsDouble()- Specified by:
getAsDoublein interfaceDoubleSupplier
-