Skip to content

Commit 6f947c8

Browse files
committed
Measurement Changes & Spotless Apply
1 parent 757e315 commit 6f947c8

File tree

9 files changed

+187
-149
lines changed

9 files changed

+187
-149
lines changed

.github/prompts/code-review-prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public abstract class ServoMotorSubsystem<IO extends MotorIO> extends SubsystemB
222222
}
223223
```
224224

225-
12. Safety & Error Handling
225+
## Safety & Error Handling
226226

227227
### Mechanism Limits
228228

src/main/java/frc/robot/preferences/BooleanPreference.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
import edu.wpi.first.wpilibj.Preferences;
44

55
public class BooleanPreference extends RobotPreference<Boolean> {
6-
private boolean defaultValue;
6+
private boolean defaultValue;
77

8-
public BooleanPreference(String key) {
9-
this(key, false);
10-
}
8+
public BooleanPreference(String key) {
9+
this(key, false);
10+
}
1111

12-
public BooleanPreference(String key, boolean defaultValue) {
13-
super(key);
14-
this.defaultValue = defaultValue;
12+
public BooleanPreference(String key, boolean defaultValue) {
13+
super(key);
14+
this.defaultValue = defaultValue;
1515

16-
Preferences.initBoolean(key, defaultValue);
17-
}
16+
Preferences.initBoolean(key, defaultValue);
17+
}
1818

19-
public boolean getValue() {
20-
return Preferences.getBoolean(super.key, defaultValue);
21-
}
19+
public boolean getValue() {
20+
return Preferences.getBoolean(super.key, defaultValue);
21+
}
2222

23-
@Override
24-
public Boolean get() {
25-
return getValue();
26-
}
23+
@Override
24+
public Boolean get() {
25+
return getValue();
26+
}
2727
}

src/main/java/frc/robot/preferences/DoublePreference.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
import edu.wpi.first.wpilibj.Preferences;
44

55
public class DoublePreference extends RobotPreference<Double> {
6-
private double defaultValue;
6+
private double defaultValue;
77

8-
public DoublePreference(String key) {
9-
this(key, 0.0);
10-
}
8+
public DoublePreference(String key) {
9+
this(key, 0.0);
10+
}
1111

12-
public DoublePreference(String key, double defaultValue) {
13-
super(key);
14-
this.defaultValue = defaultValue;
12+
public DoublePreference(String key, double defaultValue) {
13+
super(key);
14+
this.defaultValue = defaultValue;
1515

16-
Preferences.initDouble(key, defaultValue);
17-
}
16+
Preferences.initDouble(key, defaultValue);
17+
}
1818

19-
public double getValue() {
20-
return Preferences.getDouble(super.key, defaultValue);
21-
}
19+
public double getValue() {
20+
return Preferences.getDouble(super.key, defaultValue);
21+
}
2222

23-
@Override
24-
public Double get() {
25-
return getValue();
26-
}
23+
@Override
24+
public Double get() {
25+
return getValue();
26+
}
2727
}

src/main/java/frc/robot/preferences/IntegerPreference.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
import edu.wpi.first.wpilibj.Preferences;
44

55
public class IntegerPreference extends RobotPreference<Integer> {
6-
private int defaultValue;
6+
private int defaultValue;
77

8-
public IntegerPreference(String key) {
9-
this(key, 0);
10-
}
8+
public IntegerPreference(String key) {
9+
this(key, 0);
10+
}
1111

12-
public IntegerPreference(String key, int defaultValue) {
13-
super(key);
14-
this.defaultValue = defaultValue;
12+
public IntegerPreference(String key, int defaultValue) {
13+
super(key);
14+
this.defaultValue = defaultValue;
1515

16-
Preferences.initInt(key,defaultValue);
17-
}
16+
Preferences.initInt(key, defaultValue);
17+
}
1818

19-
public int getValue() {
20-
return Preferences.getInt(super.key, defaultValue);
21-
}
19+
public int getValue() {
20+
return Preferences.getInt(super.key, defaultValue);
21+
}
2222

23-
@Override
24-
public Integer get() {
25-
return getValue();
26-
}
23+
@Override
24+
public Integer get() {
25+
return getValue();
26+
}
2727
}
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
package frc.robot.preferences;
22

3+
import edu.wpi.first.wpilibj.Preferences;
34
import java.util.Collection;
45
import java.util.function.Supplier;
56

6-
import edu.wpi.first.wpilibj.Preferences;
7-
87
public abstract class RobotPreference<T> implements Supplier<T> {
9-
protected String key;
8+
protected String key;
109

11-
public RobotPreference(String key) {
12-
this.key = key;
13-
}
10+
public RobotPreference(String key) {
11+
this.key = key;
12+
}
1413

15-
public void remove() {
16-
Preferences.remove(key);
17-
}
14+
public void remove() {
15+
Preferences.remove(key);
16+
}
1817

19-
public static void removeAll() {
20-
Preferences.removeAll();
21-
}
18+
public static void removeAll() {
19+
Preferences.removeAll();
20+
}
2221

23-
public static Collection<String> getKeys() {
24-
return Preferences.getKeys();
25-
}
22+
public static Collection<String> getKeys() {
23+
return Preferences.getKeys();
24+
}
2625
}
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
package frc.robot.preferences;
22

3-
43
import edu.wpi.first.wpilibj.Preferences;
54

65
public class StringPreference extends RobotPreference<String> {
7-
private String defaultValue;
6+
private String defaultValue;
87

9-
public StringPreference(String key) {
10-
this(key, "");
11-
}
8+
public StringPreference(String key) {
9+
this(key, "");
10+
}
1211

13-
public StringPreference(String key, String defaultValue) {
14-
super(key);
15-
this.defaultValue = defaultValue;
12+
public StringPreference(String key, String defaultValue) {
13+
super(key);
14+
this.defaultValue = defaultValue;
1615

17-
Preferences.initString(key, defaultValue);
18-
}
16+
Preferences.initString(key, defaultValue);
17+
}
1918

20-
public String getValue() {
21-
return Preferences.getString(super.key, defaultValue);
22-
}
19+
public String getValue() {
20+
return Preferences.getString(super.key, defaultValue);
21+
}
2322

24-
@Override
25-
public String get() {
26-
return getValue();
27-
}
23+
@Override
24+
public String get() {
25+
return getValue();
26+
}
2827
}

src/main/java/frc/robot/subsystems/intake/IntakeConstants.java

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,41 @@
33
import com.ctre.phoenix6.configs.Slot0Configs;
44

55
public class IntakeConstants {
6-
7-
private IntakeConstants(){}
86

9-
//TODO: Change to actual ports
10-
public static final int ROLLER_MOTOR_ID = 2;
11-
public static final int EXTENSION_MOTOR_ID = 3;
7+
private IntakeConstants() {}
128

13-
//TODO: Tune
14-
public static final double ALLOWABLE_EXTENSION_ERROR = 0.1;
15-
public static final double EXTENSION_kP = 0;
16-
public static final double EXTENSION_kD = 0;
17-
public static Slot0Configs createExtensionMotorSlot0Configs(){
18-
Slot0Configs slot = new Slot0Configs();
19-
slot.kP = EXTENSION_kP;
20-
slot.kD = EXTENSION_kD;
21-
return slot;
22-
}
9+
// TODO: Change to actual ports
10+
public static final int ROLLER_MOTOR_ID = 2;
11+
public static final int EXTENSION_MOTOR_ID = 3;
2312

13+
// TODO: Tune Roller and Extension Motors
2414

15+
// Roller Motor
16+
public static final double ROLLER_KS = 0;
17+
public static final double ROLLER_KV = 0;
18+
public static final double ROLLER_KP = 0;
19+
public static final double ROLLER_KD = 0;
20+
21+
public static Slot0Configs createRollerMotorSlot0Configs() {
22+
Slot0Configs slot = new Slot0Configs();
23+
slot.kS = ROLLER_KS;
24+
slot.kV = ROLLER_KV;
25+
slot.kP = ROLLER_KP;
26+
slot.kD = ROLLER_KD;
27+
return slot;
28+
}
29+
30+
// Extension Motor
31+
public static final double ALLOWABLE_EXTENSION_ERROR = 0.1;
32+
public static final double EXTENSION_KS = 0;
33+
public static final double EXTENSION_KP = 0;
34+
public static final double EXTENSION_KD = 0;
35+
36+
public static Slot0Configs createExtensionMotorSlot0Configs() {
37+
Slot0Configs slot = new Slot0Configs();
38+
slot.kS = EXTENSION_KS;
39+
slot.kP = EXTENSION_KP;
40+
slot.kD = EXTENSION_KD;
41+
return slot;
42+
}
2543
}

src/main/java/frc/robot/subsystems/intake/IntakePreferences.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44

55
public class IntakePreferences {
66

7-
private IntakePreferences(){};
7+
private IntakePreferences() {}
8+
;
89

9-
public static DoublePreference rollerIntakeSpeed = new DoublePreference("Intake/Roller Intake Speed", 0.1);
10-
public static DoublePreference intakeCollectPosition = new DoublePreference("Intake/Stowed Intake Position", 3); //in rotations
10+
public static DoublePreference rollerIntakeSpeed =
11+
new DoublePreference("Intake/Roller Intake Speed", 0.1); // in rotations per second
12+
public static DoublePreference intakeCollectPosition =
13+
new DoublePreference("Intake/Stowed Intake Position", 3); // in rotations
1114
}

0 commit comments

Comments
 (0)