mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
Updated Javadocs, added ability to push offset to absolute encoders.
This commit is contained in:
@@ -106,6 +106,28 @@ public class SparkMaxEncoderSwerve extends SwerveAbsoluteEncoder
|
||||
return encoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Absolute Encoder Offset inside of the SparkMax's Memory.
|
||||
*
|
||||
* @param offset the offset the Absolute Encoder uses as the zero point.
|
||||
* @return if setting Absolute Encoder Offset was successful or not.
|
||||
*/
|
||||
@Override
|
||||
public boolean setAbsoluteEncoderOffset(double offset)
|
||||
{
|
||||
REVLibError error = null;
|
||||
for (int i = 0; i < maximumRetries; i++)
|
||||
{
|
||||
error = encoder.setZeroOffset(offset);
|
||||
if (error == REVLibError.kOk)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
DriverStation.reportWarning("Failure to set Absolute Encoder Offset Error: " + error, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the velocity in degrees/sec.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user