Class SwerveEncoders

java.lang.Object
org.team1126.lib.swerve.hardware.SwerveEncoders

public final class SwerveEncoders extends Object
Contains implementations for absolute encoders to be used with the SwerveAPI.
  • Method Details

    • sparkMaxEncoder

      public static SwerveEncoders.SwerveEncoder.Ctor sparkMaxEncoder(double offset, boolean inverted)
      Configures a Spark Max attached duty cycle absolute encoder.
      Parameters:
      offset - Offset of the magnet in rotations.
      inverted - If the encoder is inverted.
    • sparkFlexEncoder

      public static SwerveEncoders.SwerveEncoder.Ctor sparkFlexEncoder(double offset, boolean inverted)
      Configures a Spark Flex attached duty cycle absolute encoder.
      Parameters:
      offset - Offset of the magnet in rotations.
      inverted - If the encoder is inverted.
    • canandmag

      public static SwerveEncoders.SwerveEncoder.Ctor canandmag(int id, double offset, boolean inverted)
      Configures a Canandmag.
      Parameters:
      id - CAN ID of the device, as configured in Alchemist.
      offset - Offset of the magnet in rotations.
      inverted - If the encoder is inverted.
    • cancoder

      public static SwerveEncoders.SwerveEncoder.Ctor cancoder(int id, double offset, boolean inverted)
      Configures a CANcoder.
      Parameters:
      id - CAN ID of the device, as configured in Phoenix Tuner.
      offset - Offset of the magnet in rotations.
      inverted - If the encoder is inverted.