moving the speed encoder
This commit is contained in:
parent
ab69844906
commit
903c997ca6
1 changed files with 1 additions and 1 deletions
|
@ -31,12 +31,12 @@ SwerveModule::SwerveModule(int driveMotorId, int steerMotorId, int encoderId,
|
||||||
this->driveMotor.SetSmartCurrentLimit(SwerveConstants::currentLimit);
|
this->driveMotor.SetSmartCurrentLimit(SwerveConstants::currentLimit);
|
||||||
this->steerMotor.SetSmartCurrentLimit(SwerveConstants::currentLimit);
|
this->steerMotor.SetSmartCurrentLimit(SwerveConstants::currentLimit);
|
||||||
|
|
||||||
auto speedEncoder = this->driveMotor.GetEncoder();
|
|
||||||
double driveReduction = 1.0 / 6.75;
|
double driveReduction = 1.0 / 6.75;
|
||||||
double wheelDiameter = 0.1016;
|
double wheelDiameter = 0.1016;
|
||||||
double rotationsToDistance =
|
double rotationsToDistance =
|
||||||
driveReduction * wheelDiameter * units::constants::detail::PI_VAL;
|
driveReduction * wheelDiameter * units::constants::detail::PI_VAL;
|
||||||
|
|
||||||
|
auto speedEncoder = this->driveMotor.GetEncoder();
|
||||||
speedEncoder.SetPositionConversionFactor(rotationsToDistance);
|
speedEncoder.SetPositionConversionFactor(rotationsToDistance);
|
||||||
speedEncoder.SetVelocityConversionFactor(rotationsToDistance / 60);
|
speedEncoder.SetVelocityConversionFactor(rotationsToDistance / 60);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue