torque retract upper and lower curent lim thresh

This commit is contained in:
Shikhar
2026-03-31 20:51:47 -06:00
parent 2407a900c9
commit 958bdc46fd
5 changed files with 23 additions and 13 deletions
@@ -40,6 +40,7 @@ public class Intake extends SubsystemBase {
RectractTorque,
Bouncing
}
private boolean overCompressed = false;
private IntakeMode mode = IntakeMode.Idle;
@@ -87,7 +88,6 @@ public class Intake extends SubsystemBase {
// }
@Override
public void periodic() {
// FaultReporter.register(this); // TODO Implement fault reporter
@@ -100,6 +100,14 @@ public class Intake extends SubsystemBase {
io.updateInputs(state);
if (state.armMotorCurrent.in(Amps) < IntakeConstants.INTAKE_SQUEEZE_CURRENT_LOWER_THRESHOLD.get()){
overCompressed = false;
} else if (state.armMotorCurrent.in(Amps) > IntakeConstants.INTAKE_SQUEEZE_CURRENT_UPPER_THRESHOLD.get()) {
overCompressed = true;
}
Logger.recordOutput("overCompressed", overCompressed);
// getCurrentTime
switch (mode) {
@@ -160,9 +168,9 @@ public class Intake extends SubsystemBase {
break;
case RectractTorque:
io.setRollerOutput(state, IntakeConstants.ROLLER_RETRACT_PERCENT_OUTPUT.get());
if (state.armMotorCurrent.in(Amps) < IntakeConstants.INTAKE_SQUEEZE_CURRENT_LIMIT.get()){
if (!overCompressed){
io.armOutput(IntakeConstants.ARM_SQUEEZE_PERCENT_OUTPUT.get());
} else {
} else if (overCompressed) {
io.armOutput(IntakeConstants.ARM_REDUCED_SQUEEZE_PERCENT_OUTPUT.get());
}
if(state.intakeEncoder.in(Rotations) > IntakeConstants.ARM_REVERSE_ROLLER_RANGE.get()) {
@@ -26,9 +26,10 @@ public class IntakeConstants {
//squeeze constants
public static final ConfigurableDouble INTAKE_SQUEEZE_CURRENT_LIMIT = new ConfigurableDouble("Intake Squeeze Current Limit", 20);
public static final ConfigurableDouble INTAKE_SQUEEZE_CURRENT_LOWER_THRESHOLD = new ConfigurableDouble("Intake Squeeze Current LOWER THRESHOLD", 20);
public static final ConfigurableDouble INTAKE_SQUEEZE_CURRENT_UPPER_THRESHOLD = new ConfigurableDouble("Intake Squeeze Current UPPER THRESHOLD", 25);
public static final ConfigurableDouble ARM_SQUEEZE_PERCENT_OUTPUT = new ConfigurableDouble("Arm squeeze % output", -0.1);
public static final ConfigurableDouble ARM_REDUCED_SQUEEZE_PERCENT_OUTPUT = new ConfigurableDouble("Arm squeeze % output", -0.02);
public static final ConfigurableDouble ARM_REDUCED_SQUEEZE_PERCENT_OUTPUT = new ConfigurableDouble("Arm reduce squeeze % output", -0.02);
//IDs