Class PreMatchChecks
Checks that run while the robot is disabled and add
up to one GO / NO-GO.
Each check gives PASS, WARN, FAIL or SKIP with a one-line reason. The robot is NO-GO while any check fails; warnings are shown but do not change GO. Results are outputs, never inputs to anything: the checks are advisory and never stop the robot from enabling.
Outputs, under the prefix given (e.g. PreMatch):
GoandReason: the verdict and one line saying why, on NetworkTables for Elastic and the pit app.Summary: one line per check,"FAIL CAN: ...", on NetworkTables too.Checks/<name>/StatusandChecks/<name>/Reason.Active: whether the checks are running (disabled, before a match starts). While not, the last results stay published but nothing is re-judged.
A failing check raises a HIGH alert and a warning a MEDIUM one, both cleared on enable: in a match the subsystems' own alerts speak for themselves. Once a match has started (the first enable with the FMS attached), the checks stay quiet until the FMS detaches, so the disabled gap between auto and teleop raises nothing; the pre-match results stay published as they were.
One check is evaluated per loop, in turn, so the cost is one check's work whatever the number
registered. Every check's Check.observe(double) still runs every loop.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOne line: GO or NO-GO, and the first failing (else warning) check's reason.booleanisGo()Whether no check fails (and every check has been judged since the robot disabled).booleanWhether a match has started (enabled with the FMS attached) and the FMS is still attached.voidperiodic(boolean disabled, boolean fmsAttached, double nowSeconds) Runs the checks.voidperiodic(boolean disabled, double nowSeconds) Runs the checks with no FMS attached.Adds a check.The latest result of a check, or null before it has been judged since the last disable.
-
Constructor Details
-
PreMatchChecks
- Parameters:
prefix- log key prefix, e.g."PreMatch"
-
-
Method Details
-
register
Adds a check. Call at startup, before the firstperiodic(boolean, double).- Parameters:
name- short display name, also its log path (Checks/<name>/...)check- the check- Returns:
- this, for chaining
-
periodic
public void periodic(boolean disabled, double nowSeconds) Runs the checks with no FMS attached. Call once per loop on the main thread, after this loop's inputs are read.- Parameters:
disabled- whether the robot is disabled; the checks judge only thennowSeconds- this loop's robot time
-
periodic
public void periodic(boolean disabled, boolean fmsAttached, double nowSeconds) Runs the checks. Call once per loop on the main thread, after this loop's inputs are read.- Parameters:
disabled- whether the robot is disabled; the checks judge only then, and not between the periods of a matchfmsAttached- whether the FMS is attached, a logged inputnowSeconds- this loop's robot time
-
isMatchStarted
public boolean isMatchStarted()Whether a match has started (enabled with the FMS attached) and the FMS is still attached. -
isGo
public boolean isGo()Whether no check fails (and every check has been judged since the robot disabled). -
getReason
One line: GO or NO-GO, and the first failing (else warning) check's reason. -
resultOf
The latest result of a check, or null before it has been judged since the last disable.
-