Package swervelib.encoders
Class CanAndCoderSwerve
java.lang.Object
swervelib.encoders.SwerveAbsoluteEncoder
swervelib.encoders.CanAndCoderSwerve
HELIUM
CANandcoder from ReduxRobotics absolute encoder, attached through the CAN bus.-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.reduxrobotics.sensors.canandcoder.CANandcoderTheCANandcoderrepresenting the CANandCoder on the CAN bus.private booleanInversion state of the encoder.Fields inherited from class swervelib.encoders.SwerveAbsoluteEncoder
maximumRetries, readingError -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear sticky faults on the encoder.voidconfigure(boolean inverted) Configure the CANandCoder to read from [0, 360) per second.voidReset the encoder to factory defaults.Get the instantiated absolute encoder Object.doubleGet the absolute position of the encoder.doubleGet the velocity in degrees/sec.
-
Field Details
-
encoder
public com.reduxrobotics.sensors.canandcoder.CANandcoder encoderTheCANandcoderrepresenting the CANandCoder on the CAN bus. -
inverted
private boolean invertedInversion state of the encoder.
-
-
Constructor Details
-
CanAndCoderSwerve
public CanAndCoderSwerve(int canid) Create theCANandcoder- Parameters:
canid- The CAN ID whenever the CANandCoder is operating on the CANBus.
-
-
Method Details
-
factoryDefault
public void factoryDefault()Reset the encoder to factory defaults.- Specified by:
factoryDefaultin classSwerveAbsoluteEncoder
-
clearStickyFaults
public void clearStickyFaults()Clear sticky faults on the encoder.- Specified by:
clearStickyFaultsin classSwerveAbsoluteEncoder
-
configure
public void configure(boolean inverted) Configure the CANandCoder to read from [0, 360) per second.- 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.
-
getVelocity
public double getVelocity()Get the velocity in degrees/sec.- Specified by:
getVelocityin classSwerveAbsoluteEncoder- Returns:
- velocity in degrees/sec.
-