Class AbstractFaultMonitor
- java.lang.Object
-
- com.lightningrobotics.common.fault.AbstractFaultMonitor
-
- Direct Known Subclasses:
FaultMonitor
,TimedFaultMonitor
,UnchangingFaultMonitor
public abstract class AbstractFaultMonitor extends java.lang.Object
BaseLightningFaultCodes.Code
checking functionality
-
-
Field Summary
Fields Modifier and Type Field Description protected LightningFaultCodes.Code
code
protected boolean
fatal
protected java.lang.String
msg
-
Constructor Summary
Constructors Constructor Description AbstractFaultMonitor(LightningFaultCodes.Code code)
Creates a new non-fatal abstract fault monitorAbstractFaultMonitor(LightningFaultCodes.Code code, java.lang.String msg)
Creates a new non-fatal abstract fault monitorAbstractFaultMonitor(LightningFaultCodes.Code code, java.lang.String msg, boolean fatal)
Creates a new abstract fault monitor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
check()
Checks if the fault should be written, and writes the fault if it shouldabstract boolean
checkFault()
To be overridden, determines if fault should be writtenvoid
trigger()
Writes the fault.
-
-
-
Field Detail
-
code
protected LightningFaultCodes.Code code
-
msg
protected java.lang.String msg
-
fatal
protected boolean fatal
-
-
Constructor Detail
-
AbstractFaultMonitor
public AbstractFaultMonitor(LightningFaultCodes.Code code, java.lang.String msg, boolean fatal)
Creates a new abstract fault monitor- Parameters:
code
- TheLightningFaultCodes.Code
to be monitoredmsg
- The message to use should the fault be writtenfatal
- If the fault is fatal and should stop the robot
-
AbstractFaultMonitor
public AbstractFaultMonitor(LightningFaultCodes.Code code, java.lang.String msg)
Creates a new non-fatal abstract fault monitor- Parameters:
code
- TheLightningFaultCodes.Code
to be monitoredmsg
- The message to use should the fault be written
-
AbstractFaultMonitor
public AbstractFaultMonitor(LightningFaultCodes.Code code)
Creates a new non-fatal abstract fault monitor- Parameters:
code
- TheLightningFaultCodes.Code
to be monitored
-
-
Method Detail
-
checkFault
public abstract boolean checkFault()
To be overridden, determines if fault should be written- Returns:
- True if the fault should be written, false otherwise
-
check
public boolean check()
Checks if the fault should be written, and writes the fault if it should- Returns:
- True if the fault should be written, false otherwise
-
trigger
public void trigger()
Writes the fault. If the fault is fatal, cancles and disables theCommandScheduler
-
-