Class CancoderWrapper

java.lang.Object
com.team2813.lib2813.vendor.ctre.encoder.CancoderWrapper
All Implemented Interfaces:
com.team2813.lib2813.control.Encoder

public class CancoderWrapper extends Object implements com.team2813.lib2813.control.Encoder
A wrapper for CANcoder that implements Encoder.

Represents a CAN-based magnetic encoder that provides absolute and relative position along with filtered velocity.

  • Constructor Details

    • CancoderWrapper

      public CancoderWrapper(int deviceId, CANBus canbus)
      Creates an instance for a CANcoder on the specified CAN bus.
      Parameters:
      deviceId - the configured ID of the CANcoder
      canbus - the CAN bus the device is on
    • CancoderWrapper

      @Deprecated(forRemoval=true) public CancoderWrapper(int deviceId, String canbusName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructing CancoderWrapper with a CAN bus string is deprecated for removal in the 2027 season. Construct instances using a CANBus instance instead.
      Creates an instance for a CANcoder on the specified CAN bus name.
      Parameters:
      deviceId - the configured ID of the CANcoder
      canbusName - the name of the CAN bus the device is on
    • CancoderWrapper

      public CancoderWrapper(int deviceId)
      Creates an instance for a CANcoder on the default CAN bus.
      Parameters:
      deviceId - the configured ID of the CANcoder
  • Method Details

    • getPositionMeasure

      public Angle getPositionMeasure()
      Specified by:
      getPositionMeasure in interface com.team2813.lib2813.control.Encoder
    • setPosition

      public void setPosition(Angle position)
      Specified by:
      setPosition in interface com.team2813.lib2813.control.Encoder
    • encoder

      public CANcoder encoder()
    • getVelocityMeasure

      public AngularVelocity getVelocityMeasure()
      Specified by:
      getVelocityMeasure in interface com.team2813.lib2813.control.Encoder
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object