Class TuneValue

java.lang.Object
frc.spectrumLib.telemetry.TuneValue

public class TuneValue extends Object
A numeric value that is published to SmartDashboard and can be modified at runtime without redeploying code. Useful for tuning PID gains, speeds, and other constants during development. Place a call to update() or pass getSupplier() inside a command to read the latest value each loop.
  • Constructor Details

    • TuneValue

      public TuneValue(String name, double defaultValue)
      Creates a TuneValue, publishing defaultValue to SmartDashboard under name.
      Parameters:
      name - SmartDashboard key
      defaultValue - Initial value written to SmartDashboard
  • Method Details

    • update

      public Double update()
      Reads the current value from SmartDashboard and caches it locally.
      Returns:
      the latest value from SmartDashboard
    • getSupplier

      public DoubleSupplier getSupplier()
      Returns a DoubleSupplier that calls update() each time it is queried, suitable for passing to command factories that accept live-updating suppliers.
      Returns:
      a supplier backed by this TuneValue
    • getValue

      public double getValue()
      Current value, refreshed on each call to update().
    • getName

      public String getName()
      SmartDashboard key under which this value is published and read.