Class Canandmag.Faults
java.lang.Object
com.reduxrobotics.sensors.canandmag.Canandmag.Faults
- Enclosing class:
- Canandmag
A class to hold device faults for the
Canandmag
.
Returned by Canandmag.getStickyFaults()
and Canandmag.getActiveFaults()
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the CAN general error flag, which will raise if the encoder cannot RX packets reliably.boolean
Returns the CAN ID conflict flag, which is set to true if there is a CAN id conflict.boolean
Flag if any faults data has been received at all from the device.boolean
Returns the hardware fault flag, which will raise if a hardware issue is detected.boolean
Returns the magnet out of range flag, which will raise if the measured shaft's magnet is not detected.boolean
Returns the temperature range flag, which will raise if the encoder is not between 0-70 degrees Celsius.boolean
Returns the power cycle fault flag, which is set to true when the encoder first boots.boolean
Returns the undervolt flag, which will raise if the encoder is experiencing brownout conditions.
-
Constructor Details
-
Faults
public Faults(byte faultField, boolean valid) Constructor for the CanandmagFaults object.- Parameters:
faultField
- The byte from which to extract faults.valid
- Whether or not the data is valid (and not from some initialization value)
-
Faults
public Faults(byte faultField) Constructor for the CanandmagFaults object.- Parameters:
faultField
- The byte from which to extract faults.
-
-
Method Details
-
powerCycle
public boolean powerCycle()Returns the power cycle fault flag, which is set to true when the encoder first boots. Clearing sticky faults and then checking this flag can be used to determine if the encoder rebooted.- Returns:
- fault state
-
canIDConflict
public boolean canIDConflict()Returns the CAN ID conflict flag, which is set to true if there is a CAN id conflict. In practice, you should physically inspect the encoder to ensure it's not flashing blue.- Returns:
- fault state
-
canGeneralError
public boolean canGeneralError()Returns the CAN general error flag, which will raise if the encoder cannot RX packets reliably. This is usually due to wiring issues, such as a shorted CAN bus.- Returns:
- fault state
-
outOfTemperatureRange
public boolean outOfTemperatureRange()Returns the temperature range flag, which will raise if the encoder is not between 0-70 degrees Celsius. This may be of concern if the encoder is near very active motors.- Returns:
- fault state
-
hardwareFault
public boolean hardwareFault()Returns the hardware fault flag, which will raise if a hardware issue is detected. Generally will raise if the device's controller cannot read the physical sensor itself.- Returns:
- fault state
-
magnetOutOfRange
public boolean magnetOutOfRange()Returns the magnet out of range flag, which will raise if the measured shaft's magnet is not detected. This will match the encoder's LED shining red in normal operation.- Returns:
- fault state
-
underVolt
public boolean underVolt()Returns the undervolt flag, which will raise if the encoder is experiencing brownout conditions.- Returns:
- fault state
-
faultsValid
public boolean faultsValid()Flag if any faults data has been received at all from the device. This will be faults until the first status frame arrives either after the start of robot code or after sticky faults have been cleared.- Returns:
- if fault data has actually been received (and thus if the other fields are valid)
-