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 booleanInversion state of the attached encoder.protected ThriftyNovaSwerveThe absolute encoder is directly interfaced through the Thrifty Nova motor.protected doubleOffset of the absolute encoder.Fields inherited from class swervelib.encoders.SwerveAbsoluteEncoder
maximumRetries, readingError -
Constructor Summary
ConstructorsConstructorDescriptionCreate theThriftyNovaEncoderSwerveobject as an absolute encoder from theThriftyNovaSwervemotor. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear sticky faults.voidclose()voidconfigure(boolean inverted) Configure the absolute encoder.voidSet factory default.Get the instantiated absolute encoder Object.doubleGet the absolute position of the encoder.doubleGet the absolute encoder velocity.booleansetAbsoluteEncoderOffset(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 theThriftyNovaEncoderSwerveobject as an absolute encoder from theThriftyNovaSwervemotor.- Parameters:
motor-SwerveMotorthrough which to interface with the attached encoder .
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classSwerveAbsoluteEncoder
-
factoryDefault
public void factoryDefault()Set factory default.- Specified by:
factoryDefaultin classSwerveAbsoluteEncoder
-
clearStickyFaults
public void clearStickyFaults()Clear sticky faults.- Specified by:
clearStickyFaultsin classSwerveAbsoluteEncoder
-
configure
public void configure(boolean inverted) Configure the absolute encoder.- Specified by:
configurein classSwerveAbsoluteEncoder- Parameters:
inverted- Whether the encoder is inverted.
-
getAbsolutePosition
public double getAbsolutePosition()Get the absolute position of the encoder.- Specified by:
getAbsolutePositionin classSwerveAbsoluteEncoder- Returns:
- Absolute position in degrees from [0, 360).
-
getAbsoluteEncoder
Get the instantiated absolute encoder Object.- Specified by:
getAbsoluteEncoderin classSwerveAbsoluteEncoder- Returns:
- Absolute encoder object.
-
setAbsoluteEncoderOffset
public boolean setAbsoluteEncoderOffset(double offset) Set the absolute encoder offset.- Specified by:
setAbsoluteEncoderOffsetin 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:
getVelocityin classSwerveAbsoluteEncoder- Returns:
- Velocity in degrees per second.
-