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
Modifier and TypeFieldDescriptioncom.reduxrobotics.sensors.canandcoder.Canandcoder
TheCanandcoder
representing the CANandCoder on the CAN bus.Fields inherited from class swervelib.encoders.SwerveAbsoluteEncoder
maximumRetries, readingError
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear sticky faults on the encoder.void
configure
(boolean inverted) Configure the Canandcoder to read from [0, 360) per second.void
Reset the encoder to factory defaults.Get the instantiated absolute encoder Object.double
Get the absolute position of the encoder.double
Get the velocity in degrees/sec.boolean
setAbsoluteEncoderOffset
(double offset) Cannot set the offset of the Canandcoder.
-
Field Details
-
encoder
public com.reduxrobotics.sensors.canandcoder.Canandcoder encoderTheCanandcoder
representing the CANandCoder on the CAN bus.
-
-
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.This will not clear the stored zero offset.
- Specified by:
factoryDefault
in classSwerveAbsoluteEncoder
-
clearStickyFaults
public void clearStickyFaults()Clear sticky faults on the encoder.- Specified by:
clearStickyFaults
in classSwerveAbsoluteEncoder
-
configure
public void configure(boolean inverted) Configure the Canandcoder to read from [0, 360) per second.- 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) Cannot set the offset of the Canandcoder.- Specified by:
setAbsoluteEncoderOffset
in classSwerveAbsoluteEncoder
- Parameters:
offset
- the offset the Absolute Encoder uses as the zero point.- Returns:
- true if setting the zero point succeeded, false otherwise
-
getVelocity
public double getVelocity()Get the velocity in degrees/sec.- Specified by:
getVelocity
in classSwerveAbsoluteEncoder
- Returns:
- velocity in degrees/sec.
-