Class Canandcolor.Faults
java.lang.Object
com.reduxrobotics.sensors.canandcolor.Canandcolor.Faults
- Enclosing class:
- Canandcolor
A class to hold device faults for the
Canandcolor
, as returned by
Canandcolor.getStickyFaults()
and Canandcolor.getActiveFaults()
.-
Constructor Summary
ConstructorDescriptionFaults
(byte faultField, boolean valid) Constructor for theCanandcolor.Faults
object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the CAN general error flag, which will raise if the device 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 color sensor hardware fault flag, which will raise if the color sensor is unreadable.boolean
Returns the proximity sensor hardware fault flag, which will raise if the proximity sensor is unreadable.boolean
Returns the temperature range flag, which will raise if the device is not between 0-70 degrees Celsius.boolean
Returns the power cycle fault flag, which is set to true when the device first boots.
-
Constructor Details
-
Faults
public Faults(byte faultField, boolean valid) Constructor for theCanandcolor.Faults
object.- Parameters:
faultField
- The byte from which to extract faults.valid
- whether the data bitfield is valid (and not just uninited data)
-
-
Method Details
-
powerCycle
public boolean powerCycle()Returns the power cycle fault flag, which is set to true when the device first boots. Clearing sticky faults and then checking this flag can be used to determine if the device 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 device 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 device 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 device is not between 0-70 degrees Celsius. This may be of concern if the device is near very active motors.- Returns:
- fault state
-
hardwareFaultProximity
public boolean hardwareFaultProximity()Returns the proximity sensor hardware fault flag, which will raise if the proximity sensor is unreadable.- Returns:
- fault state
-
hardwareFaultColor
public boolean hardwareFaultColor()Returns the color sensor hardware fault flag, which will raise if the color sensor is unreadable.- 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)
-