# SwerveAbsoluteEncoder
declaration: package: swervelib.encoders, class: SwerveAbsoluteEncoder

Package swervelib.encoders

# Class SwerveAbsoluteEncoder

java.lang.Object
swervelib.encoders.SwerveAbsoluteEncoder

Direct Known Subclasses:
  `AnalogAbsoluteEncoderSwerve`, `CanAndCoderSwerve`, `CANCoderSwerve`, `PWMDutyCycleEncoderSwerve`, `SparkMaxAnalogEncoderSwerve`, `SparkMaxEncoderSwerve`

public abstract class SwerveAbsoluteEncoder extends Object
Swerve abstraction class to define a standard interface with absolute encoders for swerve modules..

## Field Summary

Fields
Modifier and Type
Field
Description
`final int`
`maximumRetries`
The maximum amount of times the swerve encoder will attempt to configure itself if failures occur.
`boolean`
`readingError`
Last angle reading was faulty.

## Constructor Summary

Constructors
Constructor
Description
`SwerveAbsoluteEncoder()`

## Method Summary

Modifier and Type
Method
Description
`abstract void`
`clearStickyFaults()`
Clear sticky faults on the encoder.
`abstract void`
`configure(boolean inverted)`
Configure the absolute encoder to read from [0, 360) per second.
`abstract void`
`factoryDefault()`
Reset the encoder to factory defaults.
`abstract Object`
`getAbsoluteEncoder()`
Get the instantiated absolute encoder Object.
`abstract double`
`getAbsolutePosition()`
Get the absolute position of the encoder.
`abstract double`
`getVelocity()`
Get the velocity in degrees/sec.
`abstract boolean`
`setAbsoluteEncoderOffset(double offset)`
Sets the Absolute Encoder offset at the Encoder Level.

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

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

## Field Details

### maximumRetries

public final int maximumRetries
The maximum amount of times the swerve encoder will attempt to configure itself if failures occur.

See Also:
  - Constant Field Values

### readingError

public boolean readingError
Last angle reading was faulty.

## Constructor Details

### SwerveAbsoluteEncoder

public SwerveAbsoluteEncoder()

## Method Details

### factoryDefault

public abstract void factoryDefault()
Reset the encoder to factory defaults.

### clearStickyFaults

public abstract void clearStickyFaults()
Clear sticky faults on the encoder.

### configure

public abstract void configure(boolean inverted)
Configure the absolute encoder to read from [0, 360) per second.

Parameters:
  `inverted` - Whether the encoder is inverted.

### getAbsolutePosition

public abstract double getAbsolutePosition()
Get the absolute position of the encoder.

Returns:
  Absolute position in degrees from [0, 360).

### getAbsoluteEncoder

public abstract Object getAbsoluteEncoder()
Get the instantiated absolute encoder Object.

Returns:
  Absolute encoder object.

### setAbsoluteEncoderOffset

public abstract boolean setAbsoluteEncoderOffset(double offset)
Sets the Absolute Encoder offset at the Encoder Level.

Parameters:
  `offset` - the offset the Absolute Encoder uses as the zero point.
Returns:
  if setting Absolute Encoder Offset was successful or not.

### getVelocity

public abstract double getVelocity()
Get the velocity in degrees/sec.

Returns:
  velocity in degrees/sec.