moving the speed encoder

This commit is contained in:
Zynh Ludwig 2024-03-28 02:51:52 -07:00
parent ab69844906
commit 903c997ca6

View file

@ -31,12 +31,12 @@ SwerveModule::SwerveModule(int driveMotorId, int steerMotorId, int encoderId,
this->driveMotor.SetSmartCurrentLimit(SwerveConstants::currentLimit);
this->steerMotor.SetSmartCurrentLimit(SwerveConstants::currentLimit);
auto speedEncoder = this->driveMotor.GetEncoder();
double driveReduction = 1.0 / 6.75;
double wheelDiameter = 0.1016;
double rotationsToDistance =
driveReduction * wheelDiameter * units::constants::detail::PI_VAL;
auto speedEncoder = this->driveMotor.GetEncoder();
speedEncoder.SetPositionConversionFactor(rotationsToDistance);
speedEncoder.SetVelocityConversionFactor(rotationsToDistance / 60);
}