Goal
Use the WPILib 2027 tunables API (org.wpilib.tunable, in the tunables-java alpha-7 jar) for values that we change at runtime from a dashboard.
Candidates in the current code:
- The hand-made NT trigger topics.
Drive publishes and subscribes Triggers/Align Encoders. RobotStats does the same for Triggers/Clear Robot Stats. Each one uses a publisher, a subscriber, a Trigger, and a manual reset to false.
- Hard-coded gains in
DriveCommands (ANGLE_KP, ANGLE_KD, ANGLE_MAX_VELOCITY, ANGLE_MAX_ACCELERATION) and the trajectory PID gains in Drive (8.01).
Relevant API, checked with javap: Tunables.addDouble(name, default), Tunables.addBoolean(...), Tunables.publishDouble(name, getter, setter). TunableDouble implements DoubleSupplier. wpilibj includes NetworkTablesTunableBackend.
Caveats
Goal
Use the WPILib 2027 tunables API (
org.wpilib.tunable, in thetunables-javaalpha-7 jar) for values that we change at runtime from a dashboard.Candidates in the current code:
Drivepublishes and subscribesTriggers/Align Encoders.RobotStatsdoes the same forTriggers/Clear Robot Stats. Each one uses a publisher, a subscriber, aTrigger, and a manual reset tofalse.DriveCommands(ANGLE_KP,ANGLE_KD,ANGLE_MAX_VELOCITY,ANGLE_MAX_ACCELERATION) and the trajectory PID gains inDrive(8.01).Relevant API, checked with
javap:Tunables.addDouble(name, default),Tunables.addBoolean(...),Tunables.publishDouble(name, getter, setter).TunableDoubleimplementsDoubleSupplier. wpilibj includesNetworkTablesTunableBackend.Caveats
Logger.processInputs, or we should use AdvantageKit'sLoggedNetworkNumber/LoggedNetworkBooleaninstead. Decide this first. If we need a wrapper for every value anyway,LoggedNetwork*may be simpler than tunables.periodic().