Class Canandgyro.Faults

java.lang.Object
com.reduxrobotics.sensors.canandgyro.Canandgyro.Faults
All Implemented Interfaces:
StructSerializable, WPISerializable
Enclosing class:
Canandgyro

public static class Canandgyro.Faults extends Object implements StructSerializable
A class to hold device faults for the Canandgyro, as returned by Canandgyro.getStickyFaults() and Canandgyro.getActiveFaults().
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    This field is necessary for WPILib structs to work around Java type erasure.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    boolean
    Returns the acceleration flag which will raise if acceleration has been sensed to saturate (potentially degrading accuracy.)
    boolean
    Returns the angular velocity saturation flag which will raise if angular velocity has been sensed to saturate (potentially degrading accuracy.)
    boolean
    Returns the calibrating flag, which will raise if the device is currently calibrating.
    boolean
    Returns the CAN general error flag, which will raise if the device has encountered a bus fault.
    boolean
    Returns the CAN ID conflict flag, which is set to true if there is a CAN id conflict.
    int
    Returns the faults bitfield as an integer.
    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 out of temperature spec flag, which will raise if the device is above 95 degrees Celsius.
    boolean
    Returns the power cycle fault flag, which is set to true when the device first boots.

    Methods inherited from class java.lang.Object

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

    • struct

      public static final CanandgyroFaultsStruct struct
      This field is necessary for WPILib structs to work around Java type erasure.
  • Constructor Details

    • Faults

      public Faults(int faultField, boolean valid)
      Constructor for the Canandgyro.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

    • faultBitField

      public int faultBitField()
      Returns the faults bitfield as an integer.

      Which bits corresponds to which fault is documented in the online message spec.

      Returns:
      faults bitfield
    • 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 has encountered a bus fault. This typically indicates a physical wiring issue on the robot, such as loose connections or an intermittently shorting CAN bus
      Returns:
      fault state
    • outOfTemperatureRange

      public boolean outOfTemperatureRange()
      Returns the out of temperature spec flag, which will raise if the device is above 95 degrees Celsius. This may be of concern if the device 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
    • calibrating

      public boolean calibrating()
      Returns the calibrating flag, which will raise if the device is currently calibrating.
      Returns:
      fault state
    • angularVelocitySaturation

      public boolean angularVelocitySaturation()
      Returns the angular velocity saturation flag which will raise if angular velocity has been sensed to saturate (potentially degrading accuracy.)
      Returns:
      fault state
    • accelerationSaturation

      public boolean accelerationSaturation()
      Returns the acceleration flag which will raise if acceleration has been sensed to saturate (potentially degrading accuracy.)
      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)