Class HardwareStamp
java.lang.Object
frc.spectrumLib.params.HardwareStamp
Ties the pit-saved file of a hard-stop group (swerve offsets, soft limits) to the robot it was
saved on, so a controller moved to another robot does not bring that robot's values with it.
The identity is a set of numbers the robot's own devices hold, read at boot before anything
writes them. A saved file records the readings that this robot can show at later boots (the
afterSave list). At boot, the file is used only if the readings match one of them.
Otherwise, or if the devices could not be read, the file is refused, an alert is raised and the
values come from git.
The readings are a logged input (Params/Hardware/<name>). No WPILib here, so the rules
can be unit tested.
-
Constructor Summary
ConstructorsConstructorDescriptionHardwareStamp(String name, String what, double[] atBoot, double tolerance, Supplier<List<double[]>> afterSave) -
Method Summary
-
Constructor Details
-
HardwareStamp
public HardwareStamp(String name, String what, double[] atBoot, double tolerance, Supplier<List<double[]>> afterSave) - Parameters:
name- the log key, e.g.SwerveMagnetOffsetswhat- what the readings are, for messages, e.g."swerve CANcoder magnet offsets"atBoot- the readings, or null if a device did not answertolerance- how far a reading may be from a stamped one and still matchafterSave- the readings this robot may show at a later boot, given what is about to be saved; called on the main thread when a save is prepared
-
-
Method Details
-
name
-
atBoot
public double[] atBoot()The readings at boot, or null if a device did not answer.
-