Skip to content

Commit 1390924

Browse files
committed
add stator current limit, update batt mon
1 parent 6a0e268 commit 1390924

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

src/main/java/frc/robot/constants/BattMonConstants.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ public class BattMonConstants {
1111
public static final double kBattVolt1DC = 0.9;
1212
public static final double kBattVolt2 = 2;
1313
public static final double kBattVolt2DC = 0.1;
14-
public static final double kBattVoltSlope = 1;
14+
public static final double kBattVoltSlope = 10.01;
1515
// (kBattVolt1 - kBattVolt2) / (kBattVolt1DC - kBattVolt2DC);
16-
public static final double kBattVoltOffset = 0; // kBattVolt1 - kBattVoltSlope * kBattVolt1DC;
16+
public static final double kBattVoltOffset = 4.035; // kBattVolt1 - kBattVoltSlope * kBattVolt1DC;
1717

1818
// Battery Current Conversion
1919
public static final double kBattCurrent1 = 50;
2020
public static final double kBattCurrent1DC = 0.9;
2121
public static final double kBattCurrent2 = 1;
2222
public static final double kBattCurrent2DC = 0.1;
23-
public static final double kBattCurrentSlope = 1;
23+
public static final double kBattCurrentSlope = 1088.3;
2424
// (kBattCurrent1 - kBattCurrent2) / (kBattCurrent1DC - kBattCurrent2DC);
25-
public static final double kBattCurrentOffset = 0;
25+
public static final double kBattCurrentOffset = -543.7;
2626
// kBattCurrent1 - kBattCurrentSlope * kBattCurrent1DC;
2727

2828
// PDP Voltage Conversion

src/main/java/frc/robot/constants/RobotConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ public static TalonFXSConfiguration getFXSConfig() {
437437

438438
CurrentLimitsConfigs current =
439439
new CurrentLimitsConfigs()
440-
.withStatorCurrentLimit(0)
441-
.withStatorCurrentLimitEnable(false)
440+
.withStatorCurrentLimit(100)
441+
.withStatorCurrentLimitEnable(true)
442442
.withSupplyCurrentLimit(20)
443443
.withSupplyCurrentLowerLimit(5)
444444
.withSupplyCurrentLowerTime(2)

src/main/java/frc/robot/subsystems/battMon/BattMonHardware.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ public void updateInputs(BattMonIOInputs inputs) {
3333
// inputs.pdpVoltage =
3434
// pdpCycle.getOutput() * BattMonConstants.kPdpVoltSlope + BattMonConstants.kPdpVoltOffset;
3535
inputs.breakerTemp =
36-
((tempCycle.getHighTimeNanoseconds() / (tempCounter.getPeriod() / 1000000000))
36+
((tempCycle.getHighTimeNanoseconds() / (tempCounter.getPeriod() * 1_000_000_000))
3737
- BattMonConstants.kBreakerTemp1)
3838
/ BattMonConstants.kBreakerTemp2;
39+
// (((tempCycle.getHighTimeNanoseconds() / 1_000_000_000) / tempCounter.getPeriod())
40+
// - BattMonConstants.kBreakerTemp1)
41+
// / BattMonConstants.kBreakerTemp2;
3942
}
4043
}

src/main/java/frc/robot/subsystems/biscuit/BiscuitIOFXS.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class BiscuitIOFXS implements BiscuitIO, Checkable {
5656
public BiscuitIOFXS() {
5757
// Logger initialization with class name
5858
logger = LoggerFactory.getLogger(this.getClass());
59-
// Moter initialization with ID from constants
59+
// Motor initialization with ID from constants
6060
talon = new TalonFXS(BiscuitConstants.talonID);
6161
// Set the starting encoder position
6262
sensorInitial = talon.getPosition().getValue();
@@ -85,7 +85,6 @@ public void setIsRemovingAlgae(boolean isRemoving) {
8585
public void setPosition(Angle position, boolean hasAlgae) {
8686
if (hasAlgae != lastHadAlgae) {
8787
if (hasAlgae) {
88-
// why is this if statement here???
8988
if (isRemovingAlgae) {
9089
configurator.apply(RobotConstants.algaeRemovalMotionConfig);
9190
} else {

0 commit comments

Comments
 (0)