Class CANdle

All Implemented Interfaces:
CommonDevice, Sendable, AutoCloseable

public class CANdle extends CoreCANdle implements Sendable, AutoCloseable
WPILib-integrated version of CoreCANdle.
  • Field Details

  • Constructor Details

    • CANdle

      public CANdle(int deviceId)
      Constructs a new CANdle 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
    • CANdle

      @Deprecated(since="2026", forRemoval=true) public CANdle(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 CANdle 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
    • CANdle

      public CANdle(int deviceId, CANBus canbus)
      Constructs a new CANdle 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 CANdle none()
      Constructs a stubbed-out CANdle, 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 CANdle
    • close

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

      Clears all animations on the CANdle. This is equivalent to applying an EmptyAnimation to all the animation slots on the CANdle.
      Returns:
      Status code of the first failed control call, or OK if all succeeded
    • initSendable

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