Translation2d.kZero,
FieldConstants.getHubTranslation().minus(new Translation3d(drivepose.getTranslation())),
8.0); // Random initial goalState to prevent it being null
-
+ // Jerry Debug
+ System.out.println("The current goal state (including the exit vel):" + goalState);
+
addRequirements(turret);
}
import frc.robot.constants.Constants;
import frc.robot.constants.IdConstants;
-public class Hood extends SubsystemBase implements HoodIO{
+public class Hood extends SubsystemBase implements HoodIO {
private TalonFX motor = new TalonFX(IdConstants.HOOD_ID, Constants.CANIVORE_SUB);
private final LinearFilter setpointFilter = LinearFilter.singlePoleIIR(0.02, 0.02);
public static final double MAX_ACCELERATION = 160; // rad/s^2
public static final double MAX_ANGLE = 82; // degrees
- public static final double MIN_ANGLE = 58.5; // degrees
+ public static final double MIN_ANGLE = 58.5; // degrees
public static final double FEEDFORWARD_KV = 0.12;
public static final double NORMAL_CURRENT_LIMIT = 40.0; // A
- public static final double CALIBRATING_CURRENT_LIMIT = 10.0; //A
+ public static final double CALIBRATING_CURRENT_LIMIT = 10.0; // A
public static final double CALIBRATION_CURRENT_THRESHOLD = 9.0; // A
}
updateInputs();
Logger.processInputs("Spindexer", inputs);
+ // reverse on jam
+ checkJam();
if (state == SpindexerState.MAX) {
motor.set(SpindexerConstants.spindexerMaxPower);
} else if (state == SpindexerState.REVERSE) {
} else {
motor.set(power);
}
-
+
// scale threshold based on power
double velocityThreshold = SpindexerConstants.spindexerVelocityWithBall * power;
SmartDashboard.putNumber("Spindexer Ball Count", ballCount);
wasSpindexerSlow = isSpindexerSlow;
}
+ public void checkJam() {
+ // if a current spike then reverse
+ if (inputs.spindexerCurrent >= SpindexerConstants.JAM_CURRENT_THRESHOLD) {
+ state = SpindexerState.REVERSE;
+ System.out.println("Jammed: Reversing");
+ }
+ }
+
public void maxSpindexer() {
state = SpindexerState.MAX;
}
public class SpindexerConstants {
public static final double spindexerVelocityWithBall = 6.0; // rps (for counting balls)
- public static final double currentLimit = 40; //A
+ public static final double currentLimit = 40; // A
public static final double spindexerMaxPower = 0.75;
public static final double spindexerReversePower = -0.2;
public static final double CURRENT_SPIKE_LIMIT = 80;
public static final double CURRENT_TIME_LIMIT = 1.0; //s
-
+ public static final double JAM_CURRENT_THRESHOLD = 9.0; // A
}