Class DeviceHealthCheck
- All Implemented Interfaces:
Check
A device is missing once its connected input has been false for MISSING_HOLD_SECONDS, or if it has never answered. A reset counts only while the device is
connected, and only once it has been connected for ARM_SECONDS at a stretch: Phoenix
reports its first contact with a device as a reset, and a disconnected device's flags mean
nothing. A device arms once per boot and stays armed through a dropout, since a brownout reboot
reports its reset on the first loop back.
A missing device fails the check unless its DeviceHealthCheck.Device.missingIs(Supplier) says otherwise (a camera
that is only logged, not used, warns or is left out). A reboot in the last RECENT_REBOOT_SECONDS warns: the device works now, but its power wiring needs a look before it
browns out in a match.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne device: its name, its group, and where its logged state comes from. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublePhoenix's first-contact reset report arrives well inside this.static final doubleA one-loop dropout is not a missing device; half a second of silence is.static final doubleCovers the previous match and the queue before this one. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(String group, String name, BooleanSupplier connected) Adds a device.voidaddMechanism(Mechanism m, String group) Adds a mechanism's leader and followers from its loggedMotorInputs.evaluate(double now) Judges the robot now.voidobserve(double now) Called every loop, enabled or not, for checks that must see every loop: a reset flag that is true for one loop, or a condition that has to hold for some time.
-
Field Details
-
MISSING_HOLD_SECONDS
public static final double MISSING_HOLD_SECONDSA one-loop dropout is not a missing device; half a second of silence is.- See Also:
-
ARM_SECONDS
public static final double ARM_SECONDSPhoenix's first-contact reset report arrives well inside this.- See Also:
-
RECENT_REBOOT_SECONDS
public static final double RECENT_REBOOT_SECONDSCovers the previous match and the queue before this one.- See Also:
-
-
Constructor Details
-
DeviceHealthCheck
- Parameters:
what- what the devices are, for the pass message, e.g."CAN devices"
-
-
Method Details
-
add
Adds a device.- Parameters:
group- its bus, or another grouping shown in the reasonname- its name in messagesconnected- its logged connected input- Returns:
- the device, to add a reset input or change its severity
-
addMechanism
-
observe
public void observe(double now) Description copied from interface:CheckCalled every loop, enabled or not, for checks that must see every loop: a reset flag that is true for one loop, or a condition that has to hold for some time. Keep it cheap. -
evaluate
Description copied from interface:CheckJudges the robot now. Called only while disabled, and not every loop:PreMatchChecksspreads the checks across loops.
-