Skip to content

Commit 641d411

Browse files
fixed some duplicates in IO
1 parent 8ac0772 commit 641d411

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

src/main/java/frc/robot/subsystems/elevator/Elevator.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,29 @@
1010

1111

1212
public class Elevator extends SubsystemBase{
13-
private final ElevatorIOInputsAutoLogged inputs = new ElevatorIOInputsAutoLogged();
13+
14+
15+
private final ElevatorIO io;
16+
private final ElevatorIOInputsAutoLogged inputs = new ElevatorIOInputsAutoLogged();
1417

1518

1619

17-
private final ElevatorIO io;
20+
public Elevator(ElevatorIO io) {
21+
this.io = io;
22+
}
23+
1824

1925
@Override
2026
public void periodic() {
21-
ElevatorIO.updateInputs(ElevatorInputs);
27+
io.updateInputs(ElevatorInputs);
2228
}
2329

2430
public Command runVoltageCommand(Supplier<Voltage> voltage) {
25-
return run(() -> ElevatorIO.setVoltage(voltage.get())).withName("Voltage");
31+
return run(() -> io.setVoltage(voltage.get())).withName("Voltage");
2632
}
2733

2834
public Command runRPMCommand(Supplier<AngularVelocity> rpm) {
29-
return run(() -> ElevatorIO.setRPM(rpm.get())).withName("RPM");
35+
return run(() -> io.setRPM(rpm.get())).withName("RPM");
3036
}
3137

3238

src/main/java/frc/robot/subsystems/elevator/ElevatorIO.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,29 @@ public static class ElevatorIOInputs {
2626

2727
default void updateInputs(ElevatorIOInputs inputs) {}
2828

29-
default void setVoltage(double voltage) {}
3029
// Getter method for target height
31-
default void getSetpoint() {
30+
default double getSetpoint() {
3231
return 0.0;
3332
}
3433

3534
// Getter method for current position
36-
default void getPosition() {
35+
default double getPosition() {
3736
return 0.0;
3837
}
3938

40-
default void updateInputs(ElevatorIOInputs inputs) {}
4139
// Getter method for velocity
42-
default void getVelocity(){
40+
default double getVelocity(){
4341
return 0.0;
4442
}
4543

4644
default void setRPM(double rpm){}
45+
4746
// Checking if elevator goes above limit height
4847
default boolean isLimitSwitchPressed() {
4948
return false;
5049
}
5150

52-
default void setFeedForwardGains(double kS, double kV, double kA) {}
51+
5352

5453
// Subsystem API (Used by commands)
5554

0 commit comments

Comments
 (0)