Class LightningFaultCodes
- java.lang.Object
-
- com.lightningrobotics.common.fault.LightningFaultCodes
-
public class LightningFaultCodes extends java.lang.Object
Class representing a set of fault codes, or enumerated things that can go wrong. e.g. an encoder fault. We can usefault monitoring
to keep tabs on these potential problems and to associate a name and error message with a problem that could happen. For example, if we are applying power to a motor, but the encoder is not moving, we can write the Encoder Fault to show that something is wrong.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LightningFaultCodes.Code
A base class that represents a single fault code
-
Constructor Summary
Constructors Constructor Description LightningFaultCodes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addFaultCode(LightningFaultCodes.Code code)
Adds a fault code to the registrystatic void
addFaultCode(java.lang.String name)
Adds a fault code to the registry.static void
addFaultCode(java.lang.String name, boolean state)
Adds a fault code to the registrystatic java.util.List<LightningFaultCodes.Code>
getCodes()
Get a list of all fault codesstatic LightningFaultCodes.Code
getFaultCode(java.lang.String name)
Retrieve a specific fault code
-
-
-
Method Detail
-
addFaultCode
public static void addFaultCode(java.lang.String name, boolean state)
Adds a fault code to the registry- Parameters:
name
- name of the fault code to be addedstate
- initial state of the fault code
-
addFaultCode
public static void addFaultCode(java.lang.String name)
Adds a fault code to the registry. The state of this code will be false- Parameters:
name
- the name of the fault code to be added
-
addFaultCode
public static void addFaultCode(LightningFaultCodes.Code code)
Adds a fault code to the registry- Parameters:
code
- fault code to be added
-
getFaultCode
public static LightningFaultCodes.Code getFaultCode(java.lang.String name)
Retrieve a specific fault code- Parameters:
name
- the name of the fault code- Returns:
- an object representing the fault code
-
getCodes
public static java.util.List<LightningFaultCodes.Code> getCodes()
Get a list of all fault codes- Returns:
- a list of all of the fault codes
-
-