Skip to content

Commit fcf3fcc

Browse files
committed
del: remove runSlowExtension commands in elevator subsystem
Signed-off-by: Dasun Abeykoon <[email protected]>
1 parent 57b8013 commit fcf3fcc

File tree

1 file changed

+17
-69
lines changed
  • src/main/java/org/frc6423/robot/subsystems/superstructure/elevator

1 file changed

+17
-69
lines changed

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

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import edu.wpi.first.wpilibj.util.Color;
3030
import edu.wpi.first.wpilibj.util.Color8Bit;
3131
import edu.wpi.first.wpilibj2.command.Command;
32-
import edu.wpi.first.wpilibj2.command.Commands;
3332
import edu.wpi.first.wpilibj2.command.SubsystemBase;
3433
import java.util.function.DoubleSupplier;
3534

@@ -48,8 +47,7 @@ public class Elevator extends SubsystemBase {
4847
public static final Distance TOLERANCE = Inches.of(1.5);
4948

5049
public static final LinearVelocity MAX_VELOCITY = MetersPerSecond.of(4.5);
51-
public static final LinearAcceleration FAST_ACCELERATION = MetersPerSecondPerSecond.of(10.0);
52-
public static final LinearAcceleration SLOW_ACCELERATION = MetersPerSecondPerSecond.of(5.0);
50+
public static final LinearAcceleration MAX_ACCELERATION = MetersPerSecondPerSecond.of(10.0);
5351

5452
@Logged(name = "Elevator Hardware Loggables")
5553
private final ElevatorIO hardware;
@@ -162,92 +160,42 @@ public Command runCurrentHoming() {
162160
}
163161

164162
/**
165-
* Run elevator to specified extension
163+
* Run elevator to specified extension height
166164
*
167-
* @param extension {@link ElevatorExtension} representing desired extension
165+
* @param extension {@link ElevatorExtension} representing desired extension height
168166
* @return {@link Command}
169167
*/
170168
public Command runExtension(ElevatorExtension extension) {
171-
return this.run(
172-
() ->
173-
hardware.setPose(
174-
extension.height.in(Meters), FAST_ACCELERATION.in(MetersPerSecondPerSecond)));
169+
return runExtension(extension.height);
175170
}
176171

177172
/**
178-
* Run elevator to specified extension
173+
* Run elevator to specified extension height
179174
*
180-
* @param height desired extension in meters
181-
* @return {@link Command}
175+
* @param extension {@link Distance} representing desired extension height
176+
* @return
182177
*/
183-
public Command runExtension(DoubleSupplier extensionMeters) {
184-
return this.run(
185-
() ->
186-
hardware.setPose(
187-
extensionMeters.getAsDouble(), FAST_ACCELERATION.in(MetersPerSecondPerSecond)));
178+
public Command runExtension(Distance extension) {
179+
return this.run(() -> hardware.setPose(extension.in(Meters)));
188180
}
189181

190182
/**
191-
* Run elevator to specified extension
183+
* Run elevator to specified extension height
192184
*
193-
* @param height desired extension in meters
185+
* @param height desired extension height in meters
194186
* @return {@link Command}
195187
*/
196-
public Command runExtension(double extensionMeters) {
197-
return runExtension(() -> extensionMeters);
198-
}
199-
200-
/**
201-
* Run elevator to specified extension
202-
*
203-
* @param extension {@link ElevatorExtension} representing desired extension
204-
* @return {@link Command}
205-
*/
206-
public Command runSlowExtension(ElevatorExtension extension) {
207-
return this.run(
208-
() ->
209-
hardware.setPose(
210-
extension.height.in(Meters), SLOW_ACCELERATION.in(MetersPerSecondPerSecond)));
211-
}
212-
213-
/**
214-
* Run elevator to specified extension
215-
*
216-
* @param extension desired extension in meters
217-
* @return {@link Command}
218-
*/
219-
public Command runSlowExtension(DoubleSupplier extension) {
220-
return this.run(
221-
() ->
222-
hardware.setPose(
223-
extension.getAsDouble(), SLOW_ACCELERATION.in(MetersPerSecondPerSecond)));
224-
}
225-
226-
/**
227-
* Run elevator to specified extension
228-
*
229-
* @param extension desired extension in meters
230-
* @return {@link Command}
231-
*/
232-
public Command runSlowExtension(double extension) {
233-
return runSlowExtension(() -> extension);
188+
public Command runExtension(DoubleSupplier extensionMeters) {
189+
return this.run(() -> hardware.setPose(extensionMeters.getAsDouble()));
234190
}
235191

236192
/**
237-
* Hold elevator at current extension
193+
* Run elevator to specified extension height
238194
*
195+
* @param height desired extension height in meters
239196
* @return {@link Command}
240197
*/
241-
@Deprecated
242-
public Command holdExtension() {
243-
return Commands.sequence(
244-
this.run(
245-
() -> {
246-
var currentPose = hardware.getParentPoseMeters();
247-
248-
hardware.setPose(currentPose, 0.0);
249-
})
250-
.until(() -> true),
251-
this.run(() -> {}));
198+
public Command runExtension(double extensionMeters) {
199+
return runExtension(() -> extensionMeters);
252200
}
253201
}

0 commit comments

Comments
 (0)