Calibration constants class and tunablenumber

TunableNumber utility - change constant from shuffleboard

Added calibration constants class
This commit is contained in:
Zach Wilke
2025-10-28 17:26:20 -06:00
parent 03847680e7
commit 74693cd56d
2 changed files with 36 additions and 0 deletions
@@ -102,6 +102,11 @@ public final class Constants {
}
public static final class CalibrationConstants{
public static final double FIXED_DISTANCE_Y = 0;
public static final double FIXED_DISTANCE_X = 0;
}
public static final class LEDConstants {
public static final int LED_SPARK_ID = 9;
@@ -0,0 +1,31 @@
package frc4388.utility.configurable;
import frc4388.robot.constants.Constants;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
import edu.wpi.first.wpilibj.shuffleboard.ComplexWidget;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
public class TunableNumber {
private final String name;
private final ShuffleboardTab tab;
private final double defaultValue;
private GenericEntry entry;
public TunableNumber(String tabName, String name, double defaultValue) {
this.name = name;
this.tab = Shuffleboard.getTab(tabName);
this.defaultValue = defaultValue;
this.entry = tab.add(name, defaultValue)
.withWidget(BuiltInWidgets.kTextView)
.getEntry();
}
public double get() {
return entry.getDouble(defaultValue);
}
public void set(double value) {
entry.setDouble(value);
}
}