File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
src/main/java/org/frc6423 Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 99import edu .wpi .first .epilogue .Logged ;
1010import edu .wpi .first .math .filter .LinearFilter ;
1111import edu .wpi .first .wpilibj2 .command .Command ;
12+ import edu .wpi .first .wpilibj2 .command .Commands ;
1213import edu .wpi .first .wpilibj2 .command .SubsystemBase ;
1314import java .util .function .DoubleSupplier ;
1415
@@ -87,6 +88,22 @@ protected Command runSpeed(double speedRpm) {
8788 return runSpeed (() -> speedRpm );
8889 }
8990
91+ /**
92+ * Hold rollers at current speed
93+ *
94+ * @return {@link Command}
95+ */
96+ 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 (() -> {}));
105+ }
106+
90107 @ Override
91108 public void close () throws Exception {
92109 hardware .close ();
Original file line number Diff line number Diff line change @@ -66,4 +66,13 @@ public Command runSpeed(DoubleSupplier speedRpm) {
6666 public Command runSpeed (double speedRpm ) {
6767 return super .runSpeed (speedRpm );
6868 }
69+
70+ /**
71+ * Hold roller at specified speed
72+ *
73+ * @return {@link Command}
74+ */
75+ public Command holdSpeed () {
76+ return super .holdSpeed ();
77+ }
6978}
You can’t perform that action at this time.
0 commit comments