Updated Javadocs, added ability to push offset to absolute encoders.

This commit is contained in:
thenetworkgrinch
2023-12-12 10:48:54 -06:00
parent aef91407ea
commit f03926627d
123 changed files with 685 additions and 283 deletions

View File

@@ -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.
*