Package frc.robot.subsystems.swervedrive.swerve.encoders

## Class CTRECANCoder

- java.lang.Object
- - frc.robot.subsystems.swervedrive.swerve.SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>
  - - frc.robot.subsystems.swervedrive.swerve.encoders.CTRECANCoder

-     public class CTRECANCoder
      extends SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>

- - ### Field Summary

    - ### Fields inherited from class frc.robot.subsystems.swervedrive.swerve.SwerveEncoder

      `m_encoder`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CTRECANCoder​(com.ctre.phoenix.sensors.CANCoder encoder)` | Create SwerveEncoder based off CANCoder.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `configure()` | Configure the absolute encoder if possible.
    `void` | `factoryDefault()` | Reset encoder to factory default settings, if possible.
    `double` | `getAbsolutePosition()` | Get the absolute position in degrees.
    `com.ctre.phoenix.sensors.MagnetFieldStrength` | `getMagnetFieldStrength()` | Get the magnetic field strength, if available.
    `double` | `getVelocity()` | Get the velocity of the absolute encoder in degrees per second.
    `boolean` | `reachable()` | Is the encoder reachable?
    `void` | `setInverted​(boolean isInverted)` | Configure the sensor direction
    `void` | `setOffset​(double offset)` | Configure the magnetic offset for the AbsoluteEncoder.

    - ### Methods inherited from class frc.robot.subsystems.swervedrive.swerve.SwerveEncoder

      `fromEncoder`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CTRECANCoder

          public CTRECANCoder​(com.ctre.phoenix.sensors.CANCoder encoder)

      Create SwerveEncoder based off CANCoder.
      Parameters:
        `encoder` - CANCoder to use.

  - ### Method Detail

    - #### configure

          public void configure()

      Configure the absolute encoder if possible.
      Specified by:
        `configure` in class `SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>`

    - #### getMagnetFieldStrength

          public com.ctre.phoenix.sensors.MagnetFieldStrength getMagnetFieldStrength()

      Get the magnetic field strength, if available.
      Specified by:
        `getMagnetFieldStrength` in class `SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>`
      Returns:
        CTRE MagneticFieldStrength Enum.

    - #### getAbsolutePosition

          public double getAbsolutePosition()

      Get the absolute position in degrees.
      Specified by:
        `getAbsolutePosition` in class `SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>`
      Returns:
        Absolute position (0, 360]

    - #### getVelocity

          public double getVelocity()

      Get the velocity of the absolute encoder in degrees per second.
      Specified by:
        `getVelocity` in class `SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>`
      Returns:
        Velocity in degrees per second.

    - #### setOffset

          public void setOffset​(double offset)

      Configure the magnetic offset for the AbsoluteEncoder.
      Specified by:
        `setOffset` in class `SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>`
      Parameters:
        `offset` - Offset in degrees.

    - #### reachable

          public boolean reachable()

      Is the encoder reachable?
      Specified by:
        `reachable` in class `SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>`
      Returns:
        True if reachable, false otherwise.

    - #### setInverted

          public void setInverted​(boolean isInverted)

      Configure the sensor direction
      Specified by:
        `setInverted` in class `SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>`
      Parameters:
        `isInverted` - Inverted or not.

    - #### factoryDefault

          public void factoryDefault()

      Reset encoder to factory default settings, if possible.
      Specified by:
        `factoryDefault` in class `SwerveEncoder<com.ctre.phoenix.sensors.CANCoder>`