Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Mk4i configurations #9

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Comment on lines +125 to +126
Copy link
Contributor Author

@ZachOrr ZachOrr Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit should be confirmed as correct. The motors need to be flipped for the Mk4i modules - but it makes sense to me that you'd invert the motor as opposed to inverting the sensor phase. Is there a reason to invert the sensor phase instead of the motor direction?

motor.setNeutralMode(NeutralMode.Brake);

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