|
1 | 1 | package frc.robot.subsystems.dropper; |
2 | 2 |
|
3 | | -import org.littletonrobotics.junction.Logger; |
4 | | - |
| 3 | +import edu.wpi.first.wpilibj2.command.Command; |
| 4 | +import edu.wpi.first.wpilibj2.command.RunCommand; |
5 | 5 | import edu.wpi.first.wpilibj2.command.SubsystemBase; |
6 | 6 |
|
| 7 | +import java.util.function.DoubleSupplier; |
| 8 | + |
| 9 | +import org.littletonrobotics.junction.Logger; |
| 10 | + |
7 | 11 | public class Dropper extends SubsystemBase { |
8 | | - private final DropperIO io; |
9 | | - private final DropperIOInputsAutoLogged inputs = new DropperIOInputsAutoLogged(); |
10 | | - |
11 | | - public Dropper(DropperIO io) { |
12 | | - this.io = io; |
13 | | - } |
| 12 | + private final DropperIO io; |
| 13 | + private final DropperIOInputsAutoLogged inputs = new DropperIOInputsAutoLogged(); |
| 14 | + |
| 15 | + public Dropper(DropperIO io) { |
| 16 | + this.io = io; |
| 17 | + } |
14 | 18 |
|
15 | | - @Override |
16 | | - public void periodic() { |
17 | | - io.updateInputs(inputs); |
18 | | - Logger.processInputs("Dropper", inputs); |
19 | | - } |
| 19 | + @Override |
| 20 | + public void periodic() { |
| 21 | + io.updateInputs(inputs); |
| 22 | + Logger.processInputs("Dropper", inputs); |
| 23 | + } |
20 | 24 |
|
21 | | - public command stop(){ |
22 | | - return runOnce(() -> io.stop().withName("Dropper Stop")); |
23 | | - } |
24 | | - |
| 25 | + public Command runVoltage(DoubleSupplier voltage) { |
| 26 | + return new RunCommand (() -> io.setVoltage(voltage), this).withName("Dropper Voltage"); |
| 27 | + } |
25 | 28 |
|
26 | 29 |
|
| 30 | + public Command stop() { |
| 31 | + return runOnce(() -> io.stop().withName("Dropper Stop")); |
| 32 | + } |
27 | 33 |
|
| 34 | + public void setPIDGains(double kP, double kI, double kD) { |
| 35 | + io.setPIDGains(kP, kI, kD); |
| 36 | + } |
28 | 37 | } |
0 commit comments