Package swervelib.encoders
Class ThriftyNovaEncoderSwerve
java.lang.Object
swervelib.encoders.SwerveAbsoluteEncoder
swervelib.encoders.ThriftyNovaEncoderSwerve
- All Implemented Interfaces:
AutoCloseable
Thrifty Nova absolute encoder, attached through the data port.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Inversion state of the attached encoder.protected ThriftyNovaSwerve
The absolute encoder is directly interfaced through the Thrifty Nova motor.protected double
Offset of the absolute encoder.Fields inherited from class swervelib.encoders.SwerveAbsoluteEncoder
maximumRetries, readingError
-
Constructor Summary
ConstructorsConstructorDescriptionCreate theThriftyNovaEncoderSwerve
object as an absolute encoder from theThriftyNovaSwerve
motor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear sticky faults.void
close()
void
configure
(boolean inverted) Configure the absolute encoder.void
Set factory default.Get the instantiated absolute encoder Object.double
Get the absolute position of the encoder.double
Get the absolute encoder velocity.boolean
setAbsoluteEncoderOffset
(double offset) Set the absolute encoder offset.
-
Field Details
-
motor
The absolute encoder is directly interfaced through the Thrifty Nova motor. -
inverted
protected boolean invertedInversion state of the attached encoder. -
offset
protected double offsetOffset of the absolute encoder.
-
-
Constructor Details
-
ThriftyNovaEncoderSwerve
Create theThriftyNovaEncoderSwerve
object as an absolute encoder from theThriftyNovaSwerve
motor.- Parameters:
motor
-SwerveMotor
through which to interface with the attached encoder .
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classSwerveAbsoluteEncoder
-
factoryDefault
public void factoryDefault()Set factory default.- Specified by:
factoryDefault
in classSwerveAbsoluteEncoder
-
clearStickyFaults
public void clearStickyFaults()Clear sticky faults.- Specified by:
clearStickyFaults
in classSwerveAbsoluteEncoder
-
configure
public void configure(boolean inverted) Configure the absolute encoder.- Specified by:
configure
in classSwerveAbsoluteEncoder
- Parameters:
inverted
- Whether the encoder is inverted.
-
getAbsolutePosition
public double getAbsolutePosition()Get the absolute position of the encoder.- Specified by:
getAbsolutePosition
in classSwerveAbsoluteEncoder
- Returns:
- Absolute position in degrees from [0, 360).
-
getAbsoluteEncoder
Get the instantiated absolute encoder Object.- Specified by:
getAbsoluteEncoder
in classSwerveAbsoluteEncoder
- Returns:
- Absolute encoder object.
-
setAbsoluteEncoderOffset
public boolean setAbsoluteEncoderOffset(double offset) Set the absolute encoder offset.- Specified by:
setAbsoluteEncoderOffset
in classSwerveAbsoluteEncoder
- Parameters:
offset
- offset in degrees from [0, 360).- Returns:
- true if successful.
-
getVelocity
public double getVelocity()Get the absolute encoder velocity. WARNING: Angular velocity is generally not measurable at high speeds.- Specified by:
getVelocity
in classSwerveAbsoluteEncoder
- Returns:
- Velocity in degrees per second.
-