Class Canandcoder.Faults

java.lang.Object
com.reduxrobotics.sensors.canandcoder.Canandcoder.Faults
Enclosing class:
Canandcoder

public static class Canandcoder.Faults extends Object
A class to hold device faults for the Canandcoder. Returned by Canandcoder.getStickyFaults() and Canandcoder.getActiveFaults().
  • Constructor Summary

    Constructors
    Constructor
    Description
    Faults(byte faultField)
    Constructor for the CanandcoderFaults object.
    Faults(byte faultField, boolean valid)
    Constructor for the CanandcoderFaults object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Faults

      public Faults(byte faultField, boolean valid)
      Constructor for the CanandcoderFaults 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 CanandcoderFaults 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)