mirror of
https://github.com/Team4388/Robot-Essentials.git
synced 2026-06-08 16:28:02 -06:00
Calibration constants class and tunablenumber
TunableNumber utility - change constant from shuffleboard Added calibration constants class
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user