Skip to content

Commit 05d42bd

Browse files
committed
currentAmps safelimit & fixing spelling
1 parent 6ebb805 commit 05d42bd

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

src/main/java/frc/robot/subsystems/claw/claw.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ public void periodic() {
1616
io.updateInputs(inputs);
1717
//logs the information to AdvantageKit
1818
Logger.processInputs(“Claw”, inputs);
19+
//stops claw if current amps is too high to ensure the claw doesn't open too much
20+
if (inputs.currentAmps > ClawConstants.MAX_SAFE_CURRENT_AMPS) {
21+
io.stop();
22+
}
1923
}
2024
//command to open the claw, runs with opening voltage until interrupted
2125
public Command openClaw() {

src/main/java/frc/robot/subsystems/claw/clawConstants.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ public class ClawConstants{
77
public static final int Claw_Motor_ID = 1;
88

99
//arbitrary number
10-
public static final double ClawGearing = 4;
10+
public static final double ClawGearing = 4.0;
1111

1212
//arbitrary number
13-
public static final double MomentofInertia = 6;
13+
public static final double MomentofInertia = 6.0;
1414

1515
//voltage to open the claw, negative to run the motor in reverse
16-
public static final double Claw_Open_Voltage = -6;
16+
public static final double Claw_Open_Voltage = -6.0;
1717

1818
//voltage to close claw
19-
public static final double Claw_Close_Voltage = 6;
19+
public static final double Claw_Close_Voltage = 6.0;
20+
21+
//max safe amps to stop opening voltage
22+
public static final double Max_Safe_Amps = 50.0;
2023
}

src/main/java/frc/robot/subsystems/claw/clawIO.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ public interface ClawIO {
77
@AutoLog
88
public class ClawIOInputs {
99
//voltage being applied to the motor, set to zero as a starting value
10-
public double appliedVoltage = 0.0
10+
public double appliedVoltage = 0.0;
1111
//monitors draw of the motor for stalling, set to zero as a starting value
12-
public double currentAmps = 0.0
12+
public double currentAmps = 0.0;
1313
//monitors temp of motor for overheating, set to zero as a starting value
14-
public double tempCelsius = 0.0
14+
public double tempCelsius = 0.0;
1515
}
1616
//empty methods that will be overriden in the other IO files
1717
public default void updateInputs(ClawIOInputs inputs) {}

0 commit comments

Comments
 (0)