Skip to content

Commit b586905

Browse files
committed
used run method instead of new RunCommand,
and also added .withName() decorator and clamped voltage to -12 and 12
1 parent 90edfea commit b586905

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/frc/robot/subsystems/shooter/Shooter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package frc.robot.subsystems.shooter;
22

3+
import edu.wpi.first.math.MathUtil;
34
import edu.wpi.first.wpilibj2.command.Command;
4-
import edu.wpi.first.wpilibj2.command.RunCommand;
55
import edu.wpi.first.wpilibj2.command.SubsystemBase;
66
import java.util.function.DoubleSupplier;
77
import org.littletonrobotics.junction.Logger;
@@ -25,11 +25,12 @@ public double getVoltage() {
2525
}
2626

2727
public Command runVoltage(DoubleSupplier voltage) {
28-
return new RunCommand(() -> io.setVoltage(voltage.getAsDouble()), this);
28+
return run(() -> io.setVoltage(MathUtil.clamp(voltage.getAsDouble(), -12, 12)))
29+
.withName("Cool Voltage Command");
2930
}
3031

3132
public Command runRPM(DoubleSupplier rpm) {
32-
return new RunCommand(() -> io.setRPM(rpm.getAsDouble()), this);
33+
return run(() -> io.setRPM(rpm.getAsDouble())).withName("Cool RPM Command");
3334
}
3435

3536
public void setPIDGains(double Kp, double Ki, double Kd) {

0 commit comments

Comments
 (0)