Skip to content

Commit c47a209

Browse files
committed
fix: simplify superstructure hold commands
Signed-off-by: Dasun Abeykoon <[email protected]>
1 parent f32462e commit c47a209

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

src/main/java/org/frc6423/lib/subsystems/Roller.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import edu.wpi.first.epilogue.Logged;
1010
import edu.wpi.first.math.filter.LinearFilter;
1111
import edu.wpi.first.wpilibj2.command.Command;
12-
import edu.wpi.first.wpilibj2.command.Commands;
1312
import edu.wpi.first.wpilibj2.command.SubsystemBase;
1413
import java.util.function.DoubleSupplier;
1514

@@ -94,14 +93,7 @@ protected Command runSpeed(double speedRpm) {
9493
* @return {@link Command}
9594
*/
9695
protected Command holdSpeed() {
97-
return Commands.sequence(
98-
this.run(
99-
() -> {
100-
var currentSpeed = hardware.getSpeedRpm();
101-
hardware.setSpeed(currentSpeed);
102-
})
103-
.until(() -> true),
104-
this.run(() -> {}));
96+
return runSpeed(() -> hardware.getSpeedRpm());
10597
}
10698

10799
@Override

src/main/java/org/frc6423/robot/subsystems/superstructure/arm/Arm.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import edu.wpi.first.units.measure.Distance;
2424
import edu.wpi.first.units.measure.MomentOfInertia;
2525
import edu.wpi.first.wpilibj2.command.Command;
26-
import edu.wpi.first.wpilibj2.command.Commands;
2726
import edu.wpi.first.wpilibj2.command.SubsystemBase;
2827
import java.util.function.DoubleSupplier;
2928
import org.frc6423.robot.Robot;
@@ -212,7 +211,7 @@ public Command runAngle(double angleRads) {
212211
* @return {@link Command}
213212
*/
214213
public Command holdAngle() {
215-
return Commands.sequence(this.runAngle(hardware.getAngleRads()), this.run(() -> {}));
214+
return runAngle(() -> hardware.getAngleRads());
216215
}
217216

218217
@Override

src/main/java/org/frc6423/robot/subsystems/superstructure/elevator/Elevator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import edu.wpi.first.units.measure.LinearVelocity;
2323
import edu.wpi.first.units.measure.Mass;
2424
import edu.wpi.first.wpilibj2.command.Command;
25-
import edu.wpi.first.wpilibj2.command.Commands;
2625
import edu.wpi.first.wpilibj2.command.SubsystemBase;
2726
import java.util.function.DoubleSupplier;
2827
import org.frc6423.robot.Robot;
@@ -233,8 +232,7 @@ public Command runExtension(double extensionMeters) {
233232
* @return {@link Command}
234233
*/
235234
public Command holdExtension() {
236-
return Commands.sequence(
237-
this.runExtension(hardware.getParentPoseMeters()).until(() -> true), this.run(() -> {}));
235+
return runExtension(() -> hardware.getParentPoseMeters());
238236
}
239237

240238
@Override

0 commit comments

Comments
 (0)