Skip to content

Commit

Permalink
Adds Mk4i configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachOrr committed Feb 1, 2022
1 parent 24d9d53 commit 848836e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,10 @@ public enum GearRatio {
L1(SdsModuleConfigurations.MK4_L1),
L2(SdsModuleConfigurations.MK4_L2),
L3(SdsModuleConfigurations.MK4_L3),
L4(SdsModuleConfigurations.MK4_L4);
L4(SdsModuleConfigurations.MK4_L4),
L1I(SdsModuleConfigurations.MK4I_L1),
L2I(SdsModuleConfigurations.MK4I_L2),
L3I(SdsModuleConfigurations.MK4I_L3);

private final ModuleConfiguration configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ public final class SdsModuleConfigurations {
true
);

public static final ModuleConfiguration MK4I_L1 = new ModuleConfiguration(
0.10033,
(14.0 / 50.0) * (25.0 / 19.0) * (15.0 / 45.0),
true,
(14.0 / 50.0) * (10.0 / 60.0),
false
);
public static final ModuleConfiguration MK4I_L2 = new ModuleConfiguration(
0.10033,
(14.0 / 50.0) * (27.0 / 17.0) * (15.0 / 45.0),
true,
(14.0 / 50.0) * (10.0 / 60.0),
false
);
public static final ModuleConfiguration MK4I_L3 = new ModuleConfiguration(
0.10033,
(14.0 / 50.0) * (28.0 / 16.0) * (15.0 / 45.0),
true,
(14.0 / 50.0) * (10.0 / 60.0),
false
);

private SdsModuleConfigurations() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public ControllerImplementation create(Falcon500SteerConfiguration<T> steerConfi
motor.enableVoltageCompensation(true);
}
checkCtreError(motor.configSelectedFeedbackSensor(TalonFXFeedbackDevice.IntegratedSensor, 0, CAN_TIMEOUT_MS), "Failed to set Falcon 500 feedback sensor");
motor.setSensorPhase(moduleConfiguration.isSteerInverted());
motor.setInverted(TalonFXInvertType.CounterClockwise);
motor.setSensorPhase(true);
motor.setInverted(moduleConfiguration.isSteerInverted() ? TalonFXInvertType.CounterClockwise : TalonFXInvertType.Clockwise);
motor.setNeutralMode(NeutralMode.Brake);

checkCtreError(motor.setSelectedSensorPosition(absoluteEncoder.getAbsoluteAngle() / sensorPositionCoefficient, 0, CAN_TIMEOUT_MS), "Failed to set Falcon 500 encoder position");
Expand Down

0 comments on commit 848836e

Please sign in to comment.