55import edu .wpi .first .wpilibj .LEDPattern ;
66import edu .wpi .first .wpilibj .util .Color ;
77import frc .robot .constants .LEDConstants ;
8+ import frc .robot .subsystems .robotState .RobotStateSubsystem .AlgaeHeight ;
89import frc .robot .subsystems .robotState .RobotStateSubsystem .CoralLoc ;
910import frc .robot .subsystems .robotState .RobotStateSubsystem .ScoringLevel ;
1011import java .util .Map ;
@@ -37,6 +38,11 @@ public class LEDSubsystem extends MeasurableSubsystem {
3738 Map .of (
3839 LEDConstants .kGetAlgeaStart / (double ) LEDConstants .kTotalStripLength ,
3940 LEDConstants .kNotGetAlgea ));
41+ private LEDPattern algeaHeight =
42+ LEDPattern .steps (
43+ Map .of (
44+ LEDConstants .kAlgeaHeightStart / (double ) LEDConstants .kTotalStripLength ,
45+ LEDConstants .kAlgeaLow ));
4046 private LEDPattern autoplace =
4147 LEDPattern .steps (
4248 Map .of (
@@ -57,6 +63,7 @@ public class LEDSubsystem extends MeasurableSubsystem {
5763 private ScoringLevel levelState = ScoringLevel .L4 ;
5864 private PlaceStates placeState = PlaceStates .MANUAL ;
5965 private boolean shouldGetAlgae = false ;
66+ private AlgaeHeight algaeHeight = AlgaeHeight .LOW ;
6067 private boolean shouldLoadCoral = false ;
6168 private boolean autoPlacing = false ;
6269 private boolean isLimiting = false ;
@@ -111,6 +118,11 @@ public void setGetAlgeaLights(boolean on) {
111118 buildBase ();
112119 }
113120
121+ public void setAlgeaHeight (AlgaeHeight algaeHeight ) {
122+ this .algaeHeight = algaeHeight ;
123+ buildBase ();
124+ }
125+
114126 public void setAutoPlacing (boolean isAutoPlacing ) {
115127 autoPlacing = isAutoPlacing ;
116128 buildBase ();
@@ -147,6 +159,10 @@ public boolean getGetAlgeaLights() {
147159 return shouldGetAlgae ;
148160 }
149161
162+ public AlgaeHeight getIsAlgeaHigh () {
163+ return algaeHeight ;
164+ }
165+
150166 public boolean getAutoPlacing () {
151167 return autoPlacing ;
152168 }
@@ -214,6 +230,19 @@ private void buildBase() {
214230 Map .of (
215231 LEDConstants .kGetAlgeaStart / (double ) LEDConstants .kTotalStripLength ,
216232 shouldGetAlgae ? LEDConstants .kGetAlgea : LEDConstants .kNotGetAlgea ));
233+ switch (algaeHeight ) {
234+ case HIGH -> algeaHeight =
235+ LEDPattern .steps (
236+ Map .of (
237+ LEDConstants .kAlgeaHeightStart / (double ) LEDConstants .kTotalStripLength ,
238+ LEDConstants .kAlgeaHigh ));
239+
240+ case LOW -> algeaHeight =
241+ LEDPattern .steps (
242+ Map .of (
243+ LEDConstants .kAlgeaHeightStart / (double ) LEDConstants .kTotalStripLength ,
244+ LEDConstants .kAlgeaLow ));
245+ }
217246 base = algae .overlayOn (coral );
218247 }
219248
@@ -227,7 +256,7 @@ private void buildBase() {
227256 if (shouldLoadCoral ) {
228257 base = loadCoral .overlayOn (base );
229258 } else {
230- base = getAlgea .overlayOn (place .overlayOn (level .overlayOn (base )));
259+ base = algeaHeight . overlayOn ( getAlgea .overlayOn (place .overlayOn (level .overlayOn (base ) )));
231260 }
232261 }
233262
@@ -332,14 +361,22 @@ public Set<Measure> getMeasures() {
332361 "GetAlgea" ,
333362 "the current get algea state of the LEDSubsystem" ,
334363 () -> shouldGetAlgae ? 0 : 1 ),
364+ new Measure (
365+ "isAlgeaHigh" ,
366+ "The assumed Algea Height of the LEDSubsystem" ,
367+ () -> algaeHeight .ordinal ()),
335368 new Measure (
336369 "autoPlacing" ,
337370 "the current autoPlacing state of the LEDSubsystem" ,
338371 () -> autoPlacing ? 0 : 1 ),
339372 new Measure (
340373 "currentLimiting" ,
341374 "the current currentLimiting state of the LEDSubsystem" ,
342- () -> isLimiting ? 0 : 1 ));
375+ () -> isLimiting ? 0 : 1 ),
376+ new Measure (
377+ "isHPLoading" ,
378+ "the current HP Loading state of the LEDSubsystem" ,
379+ () -> shouldLoadCoral ? 0 : 1 ));
343380 }
344381
345382 public enum LEDStates {
0 commit comments