Class CANrange

All Implemented Interfaces:
CommonDevice, Sendable, AutoCloseable

public class CANrange extends CoreCANrange implements Sendable, AutoCloseable
WPILib-integrated version of CoreCANrange.
  • Constructor Details

    • CANrange

      public CANrange(int deviceId)
      Constructs a new CANrange object.

      Constructs the device using the default CAN bus for the system (see CANBus()).

      Parameters:
      deviceId - ID of the device, as configured in Phoenix Tuner
    • CANrange

      @Deprecated(since="2026", forRemoval=true) public CANrange(int deviceId, String canbus)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructing devices with a CAN bus string is deprecated for removal in the 2027 season. Construct devices using a CANBus instance instead.
      Constructs a new CANrange object.
      Parameters:
      deviceId - ID of the device, as configured in Phoenix Tuner
      canbus - Name of the CAN bus this device is on. Possible CAN bus strings are:
      • "rio" for the native roboRIO CAN bus
      • CANivore name or serial number
      • SocketCAN interface (non-FRC Linux only)
      • "*" for any CANivore seen by the program
      • empty string (default) to select the default for the system:
        • "rio" on roboRIO
        • "can0" on Linux
        • "*" on Windows
    • CANrange

      public CANrange(int deviceId, CANBus canbus)
      Constructs a new CANrange object.
      Parameters:
      deviceId - ID of the device, as configured in Phoenix Tuner
      canbus - The CAN bus this device is on
  • Method Details

    • none

      public static CANrange none()
      Constructs a stubbed-out CANrange, where all status signals, controls, configs, etc. perform no action and immediately return OK. This can be used to silence error messages for devices that have been completely removed from the robot.
      Returns:
      Stubbed-out CANrange
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • initSendable

      public void initSendable(SendableBuilder builder)
      Specified by:
      initSendable in interface Sendable