|
1 | 1 | package frc.robot.subsystems.arm; |
2 | 2 |
|
| 3 | +import static frc.robot.subsystems.arm.ArmConstants.MAX_POSITION; |
| 4 | +import static frc.robot.subsystems.arm.ArmConstants.MIN_POSITION; |
| 5 | + |
3 | 6 | import edu.wpi.first.math.MathUtil; |
4 | 7 | import edu.wpi.first.wpilibj2.command.Command; |
5 | 8 | import edu.wpi.first.wpilibj2.command.SubsystemBase; |
6 | | -import org.littletonrobotics.junction.Logger; |
7 | | - |
8 | 9 | import java.util.function.DoubleSupplier; |
9 | | - |
10 | | -import static frc.robot.subsystems.arm.ArmConstants.MAX_POSITION; |
11 | | -import static frc.robot.subsystems.arm.ArmConstants.MIN_POSITION; |
| 10 | +import org.littletonrobotics.junction.Logger; |
12 | 11 |
|
13 | 12 | public class Arm extends SubsystemBase { |
14 | | - private final ArmIO io; |
15 | | - private final ArmIOInputsAutoLogged inputs=new ArmIOInputsAutoLogged(); |
16 | | - |
17 | | - public Arm(ArmIO io) { |
18 | | - this.io = io; |
19 | | - } |
20 | | - |
21 | | - //bro why is default indentation for this 2 spaces |
22 | | - |
23 | | - @Override |
24 | | - public void periodic() { |
25 | | - io.updateInputs(inputs); |
26 | | - Logger.processInputs("Arm",inputs); |
27 | | - } |
28 | | - |
29 | | - public Command runPosition(DoubleSupplier angle) { |
30 | | - return runEnd( |
31 | | - ()->io.setPosition(MathUtil.clamp(angle.getAsDouble(),MIN_POSITION,MAX_POSITION)), |
32 | | - ()->io.setPosition(0) |
33 | | - ).withName("Moving my arm"); |
34 | | - } |
35 | | - |
36 | | - public Command stop() { |
37 | | - return runOnce(()->io.setPosition(0)) |
38 | | - .withName("OH NO I STOPPED MOVING MY ARM"); |
39 | | - } |
| 13 | + private final ArmIO io; |
| 14 | + private final ArmIOInputsAutoLogged inputs = new ArmIOInputsAutoLogged(); |
| 15 | + |
| 16 | + public Arm(ArmIO io) { |
| 17 | + this.io = io; |
| 18 | + } |
| 19 | + |
| 20 | + // bro why is default indentation for this 2 spaces |
| 21 | + |
| 22 | + @Override |
| 23 | + public void periodic() { |
| 24 | + io.updateInputs(inputs); |
| 25 | + Logger.processInputs("Arm", inputs); |
| 26 | + } |
| 27 | + |
| 28 | + public Command runPosition(DoubleSupplier angle) { |
| 29 | + return runEnd( |
| 30 | + () -> io.setPosition(MathUtil.clamp(angle.getAsDouble(), MIN_POSITION, MAX_POSITION)), |
| 31 | + () -> io.setPosition(0)) |
| 32 | + .withName("Moving my arm"); |
| 33 | + } |
| 34 | + |
| 35 | + public Command stop() { |
| 36 | + return runOnce(() -> io.setPosition(0)).withName("OH NO I STOPPED MOVING MY ARM"); |
| 37 | + } |
40 | 38 | } |
0 commit comments