66
77package org .frc6423 .robot .subsystems .superstructure .elevator ;
88
9- import static edu .wpi .first .units .Units .Centimeters ;
109import static edu .wpi .first .units .Units .Inches ;
1110import static edu .wpi .first .units .Units .Meters ;
1211import static edu .wpi .first .units .Units .MetersPerSecond ;
3029
3130/** Elevator Subsystem */
3231public class Elevator extends SubsystemBase implements AutoCloseable {
33- // * CONSTANTS
32+ /** Name of the CAN bus hardware is on */
3433 public static final String CANBUS = "CANCHAN" ;
34+
35+ /** Parent motor CAN ID */
3536 public static final int PARENT_MOTOR_ID = 14 ;
37+
38+ /** Child motor CAN ID */
3639 public static final int CHILD_MOTOR_ID = 15 ;
3740
3841 /** Gear ratio of the elevator gearbox */
@@ -59,6 +62,21 @@ public class Elevator extends SubsystemBase implements AutoCloseable {
5962 /** The acceleration of the elevator's trapezoid profile */
6063 public static final LinearAcceleration MAX_ACCELERATION = MetersPerSecondPerSecond .of (10.0 );
6164
65+ /** Represents a height the elevator can extend to */
66+ public static enum ElevatorExtension {
67+ STOWED (Meters .of (0.0 )),
68+ INTAKING (Meters .of (0.0 )),
69+ L2 (Meters .of (4.549 )),
70+ L3 (Meters .of (12.41 )),
71+ L4 (Meters .of (24.0 ));
72+
73+ Distance height ;
74+
75+ ElevatorExtension (Distance height ) {
76+ this .height = height ;
77+ }
78+ }
79+
6280 @ Logged (name = "Elevator Hardware Loggables" )
6381 private final ElevatorIO hardware ;
6482
@@ -104,10 +122,6 @@ public void periodic() {
104122 hardware .periodic ();
105123
106124 filteredCurrent = currentFilter .calculate (hardware .getParentStatorCurrentAmps ());
107-
108- /** Set visualizer poses */
109- visualizer .setCarriageHeight (getCarriageHeight ().in (Centimeters ));
110- visualizer .setStageHeight (getStageHeight ().in (Centimeters ));
111125 }
112126
113127 /**
@@ -177,21 +191,21 @@ public Command runCurrentHoming() {
177191 /**
178192 * Run elevator to specified extension height
179193 *
180- * @param extension {@link ElevatorState } representing desired extension height
194+ * @param extension {@link Distance } representing desired extension height
181195 * @return {@link Command}
182196 */
183- public Command runExtension (ElevatorState extension ) {
184- return this .runExtension ( extension .height );
197+ public Command runExtension (Distance extension ) {
198+ return this .run (() -> hardware . setPose ( extension .in ( Meters )) );
185199 }
186200
187201 /**
188202 * Run elevator to specified extension height
189203 *
190- * @param extension {@link Distance } representing desired extension height
204+ * @param extension {@link ElevatorExtension } representing desired extension height
191205 * @return {@link Command}
192206 */
193- public Command runExtension (Distance extension ) {
194- return this . run (() -> hardware . setPose ( extension .in ( Meters )) );
207+ public Command runExtension (ElevatorExtension extension ) {
208+ return runExtension ( extension .height );
195209 }
196210
197211 /**
0 commit comments