mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
Added overrides for canandcoder, falcon/talonfx for encoder pulse per rotation configuration option.
This commit is contained in:
@@ -68,6 +68,14 @@ public class ModuleJson
|
||||
SwerveMotor angleMotor = angle.createMotor(false);
|
||||
SwerveAbsoluteEncoder absEncoder = encoder.createEncoder(angleMotor);
|
||||
|
||||
// Override angle encoder pulse per rotation based on the encoder and motor type.
|
||||
int encoderPulseOverride = encoder.getPulsePerRotation(physicalCharacteristics.angleEncoderPulsePerRotation);
|
||||
int motorPulseOverride = angle.getPulsePerRotation(physicalCharacteristics.angleEncoderPulsePerRotation);
|
||||
|
||||
int angleEncoderPulsePerRotation =
|
||||
motorPulseOverride != physicalCharacteristics.angleEncoderPulsePerRotation ? motorPulseOverride
|
||||
: encoderPulseOverride;
|
||||
|
||||
// If the absolute encoder is attached.
|
||||
if (absEncoder == null)
|
||||
{
|
||||
@@ -89,7 +97,7 @@ public class ModuleJson
|
||||
absoluteEncoderInverted,
|
||||
inverted.drive,
|
||||
inverted.angle,
|
||||
angleEncoderPulsePerRevolution == 0 ? physicalCharacteristics.angleEncoderPulsePerRotation
|
||||
angleEncoderPulsePerRevolution == 0 ? angleEncoderPulsePerRotation
|
||||
: angleEncoderPulsePerRevolution,
|
||||
name.replaceAll("\\.json", ""));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user