Class CANBus

java.lang.Object
com.reduxrobotics.canand.CANBus

public class CANBus extends Object
Class representing CAN buses that may exist on a robot. Currently, only the Rio's onboard CAN bus is supported.
  • Method Details

    • getRioBus

      public static CANBus getRioBus()
      Returns a CANBus object representing the roboRIO's onboard bus.
      Returns:
      an object representing the Rio's bus (descriptor = 0)
    • byDescriptor

      public static CANBus byDescriptor(byte busDescriptor)
      Returns a CANBus object corresponding to a specific bus descriptor value. It is generally preferable to use this function instead of the constructor to avoid object creation churn.
      Parameters:
      busDescriptor - the descriptor value
      Returns:
      a new CANBus object associated with that bus descriptor. Equality can be checked between two CANBus objects with equals(java.lang.Object)
    • getDescriptor

      public byte getDescriptor()
      Returns the descriptor ID associated with the CAN bus object. Generally not needed to be used directly.
      Returns:
      the descriptor ID.
    • equals

      public boolean equals(Object other)
      Returns whether two CANBus objects refer to the same bus.
      Overrides:
      equals in class Object
      Parameters:
      other - other CANBus object to compare against
      Returns:
      whether or not they refer to the same bus