Update reliability

This commit is contained in:
thenetworkgrinch
2024-08-24 17:40:19 -05:00
parent 1b464310d3
commit 73b253bce8
123 changed files with 149 additions and 129 deletions

View File

@@ -32,13 +32,15 @@ public class SparkMaxAnalogEncoderSwerve extends SwerveAbsoluteEncoder
* Create the {@link SparkMaxAnalogEncoderSwerve} object as a analog sensor from the {@link CANSparkMax} motor data
* port analog pin.
*
* @param motor Motor to create the encoder from.
* @param motor Motor to create the encoder from.
* @param maxVoltage Maximum voltage for analog input reading.
*/
public SparkMaxAnalogEncoderSwerve(SwerveMotor motor)
public SparkMaxAnalogEncoderSwerve(SwerveMotor motor, double maxVoltage)
{
if (motor.getMotor() instanceof CANSparkMax)
{
encoder = ((CANSparkMax) motor.getMotor()).getAnalog(Mode.kAbsolute);
encoder.setPositionConversionFactor(360 / maxVoltage);
} else
{
throw new RuntimeException("Motor given to instantiate SparkMaxEncoder is not a CANSparkMax");
@@ -108,7 +110,7 @@ public class SparkMaxAnalogEncoderSwerve extends SwerveAbsoluteEncoder
@Override
public double getAbsolutePosition()
{
return encoder.getPosition() * (360 / 3.3);
return encoder.getPosition();
}
/**