Skip to content

Commit 20e48ae

Browse files
Merge branch 'bangbot' of https://github.com/deepbluerobotics/RobotCode2024 into bangbot
2 parents 06fe4a6 + b652084 commit 20e48ae

File tree

2 files changed

+49
-37
lines changed

2 files changed

+49
-37
lines changed

simgui.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"/Shuffleboard/arm SysID/quasistatic backward": "Command",
6161
"/Shuffleboard/arm SysID/quasistatic forward": "Command",
6262
"/SmartDashboard/Arm": "Subsystem",
63-
"/SmartDashboard/SendableChooser[0]": "String Chooser"
63+
"/SmartDashboard/SendableChooser[0]": "String Chooser",
64+
"/SmartDashboard/moveClimber": "Command"
6465
}
6566
},
6667
"NetworkTables": {
@@ -86,7 +87,7 @@
8687
0.0,
8788
0.8500000238418579
8889
],
89-
"height": 177
90+
"height": 338
9091
}
9192
]
9293
}

src/main/java/org/carlmontrobotics/subsystems/AuxSystems.java

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import edu.wpi.first.wpilibj.util.Color8Bit;
1111

1212
import static org.carlmontrobotics.Constants.Effectorc.*;
13-
13+
import static org.carlmontrobotics.Constants.Led.ledLength;
1414
import static org.carlmontrobotics.Constants.Led.startingColor;
1515

1616
import org.carlmontrobotics.Constants;
@@ -33,14 +33,30 @@ public class AuxSystems extends SubsystemBase {
3333
private final IntakeShooter effector;
3434
//for led color ramping
3535
private Color8Bit currentColor = new Color8Bit(0,0,0);
36-
37-
36+
37+
3838
private LedPoint currentPoint = new LedPoint();
39-
public boolean matchMode = false;
39+
public boolean matchMode = true;
4040
//^ whether we use normal color checking or flowing color mode
41-
41+
4242
private double rumble;
4343
//stuf
44+
private Color8Bit[] colorCycle = {
45+
new Color8Bit(255,0,0),//0 red
46+
new Color8Bit(255,127,0),//1 orange
47+
new Color8Bit(255,255,0),//2 yellow
48+
new Color8Bit(127,255,0),
49+
new Color8Bit(0,255,0),//4 blue
50+
new Color8Bit(0,255,127),
51+
new Color8Bit(0,255,255),
52+
new Color8Bit(0,127,255),
53+
new Color8Bit(0,127,255),
54+
new Color8Bit(0,0,255),//9 green
55+
new Color8Bit(127,0,255),
56+
new Color8Bit(255,0,255),//11 purple
57+
new Color8Bit(255,0,127),
58+
new Color8Bit(0,0,0)//13 black
59+
};
4460

4561
public AuxSystems(Arm a, IntakeShooter is){
4662
this.arm = a;
@@ -49,7 +65,7 @@ public AuxSystems(Arm a, IntakeShooter is){
4965
led.setLength(ledBuffer.getLength());
5066
setLedColor(startingColor, 0 , ledBuffer.getLength());
5167
led.start();
52-
68+
5369

5470
SmartDashboard.putBoolean("LED Match Mode:", matchMode);
5571

@@ -61,39 +77,23 @@ public AuxSystems(Arm a, IntakeShooter is){
6177
// for (int blue = 0; blue < 255/15; blue ++){
6278
// for (int green = 0; green < 255/15; green ++){
6379
// g +=15;
64-
80+
6581
// currentPoint = currentPoint.addnext(0.1,new Color8Bit(r,g,b));
66-
82+
6783
// }
6884
// g = 0;
6985
// b +=15;
70-
71-
86+
87+
7288
// }
7389
// b = 0;
7490
// r +=15;
7591

76-
92+
7793
//}
78-
Color8Bit[] colorCycle = {
79-
new Color8Bit(255,0,0),
80-
new Color8Bit(255,127,0),
81-
new Color8Bit(255,255,0),
82-
new Color8Bit(127,255,0),
83-
new Color8Bit(0,255,0),
84-
new Color8Bit(0,255,127),
85-
new Color8Bit(0,255,255),
86-
new Color8Bit(0,127,255),
87-
new Color8Bit(0,127,255),
88-
new Color8Bit(0,0,255),
89-
new Color8Bit(127,0,255),
90-
new Color8Bit(255,0,255),
91-
new Color8Bit(255,0,127),
92-
93-
};
9494
for (Color8Bit color : colorCycle){
9595
currentPoint = currentPoint.addnext(2,color);
96-
96+
9797
}
9898

9999

@@ -122,16 +122,27 @@ public void periodic(){
122122
* else: no rumble
123123
* none: all red
124124
*/
125-
126-
125+
if (effector.intakeDetectsNote() && effector.outakeDetectsNote()){
126+
setLedColor(colorCycle[0], 0, ledLength);
127+
}else if (effector.intakeDetectsNote()){
128+
setLedColor(colorCycle[13], 0, ledLength);//all black
129+
setLedColor(colorCycle[2], 0, midpoint);
130+
} else if (effector.outakeDetectsNote()) {
131+
setLedColor(colorCycle[13], 0, ledLength);//all black
132+
setLedColor(colorCycle[11], midpoint, ledLength);
133+
} else {
134+
setLedColor(colorCycle[0], 0, ledLength);
135+
}
136+
137+
127138
}else {
128139
currentColor = currentPoint.currentDesiredColor();
129140
setLedColor(currentColor,0,Constants.Led.ledLength);
130-
131-
141+
142+
132143
}
133-
134-
144+
145+
135146

136147
}
137148

@@ -198,7 +209,7 @@ public Color8Bit currentDesiredColor(){//return the color it should be now
198209
}
199210
}
200211
double endTime = this.startTime+this.duration;
201-
212+
202213
double dfrac = (endTime-currTime)/(endTime-startTime);
203214
//^ fraction of completion
204215
return new Color8Bit(

0 commit comments

Comments
 (0)