Skip to content

Commit bfcfb36

Browse files
Fixed some of the logic of the subsystem class
1 parent 5bd6a7d commit bfcfb36

2 files changed

Lines changed: 20 additions & 16 deletions

File tree

.vscode/launch.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"type": "java",
6+
"name": "Main",
7+
"request": "launch",
8+
"mainClass": "frc.robot.Main",
9+
"projectName": "StudentReefscape2025"
10+
},
411
{
512
"type": "wpilib",
613
"name": "WPILib Desktop Debug",

src/main/java/frc/robot/subsystems/grabber/GrabberSubsystem.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public enum GrabberStates{
2424
Collecting,
2525
Stationary,
2626
Ejecting,
27-
Grabbing
27+
Grabbing,
28+
Aligning
2829
}
2930
private final GrabberIO io_;
3031
//Figure out grabber target rotation
@@ -37,9 +38,8 @@ public enum GrabberStates{
3738
//Constructor
3839
public GrabberSubsystem(GrabberIO io){
3940
io_=io;
40-
ejectswitch=0;
4141
inputs_= new GrabberIOInputs();
42-
target_grabber= Rotations.of(1);
42+
target_grabber= Rotations.of(-0.4);
4343
states= GrabberStates.Stationary;
4444
}
4545

@@ -50,25 +50,23 @@ public void periodic(){
5050
io_.updateInputs(inputs_);
5151
Logger.processInputs("Grabber", inputs_);
5252
Logger.recordOutput("Grabber/angle/target", target_grabber);
53-
if(states== GrabberStates.Stationary){
53+
if(states== GrabberStates.Collecting){
5454
if(hasCoralBool()==false){
5555
collectCoral();
56-
states=GrabberStates.Collecting;
56+
states=GrabberStates.Stationary;
5757
}
58-
} else if(states==GrabberStates.Collecting){
58+
states= GrabberStates.Aligning;
59+
} else if(states==GrabberStates.Aligning) {
5960
AlignCoral();
60-
states=GrabberStates.Ejecting;
61+
states=GrabberStates.Stationary;
6162
} else if(states== GrabberStates.Ejecting){
6263
ejectCoral();
63-
if(ejectswitch==1){
64-
ejectAlgae();
65-
states=GrabberStates.Stationary;
66-
}
67-
states= GrabberStates.Grabbing;
64+
states= GrabberStates.Stationary;
6865
} else if(states== GrabberStates.Grabbing){
6966
grabAlgae();
70-
ejectswitch=1;
71-
states= GrabberStates.Ejecting;
67+
states= GrabberStates.Stationary;
68+
} else if(states== GrabberStates.Stationary){
69+
break;
7270
}
7371
}
7472

@@ -82,8 +80,7 @@ public boolean hasAlgaeBool(){
8280
}
8381
return false;
8482
}
85-
//ask "not"
86-
//Ask grabber angle
83+
8784
public boolean hasCoralBool(){
8885
if(inputs_.coralSensor){
8986
inputs_.hasCoral= true;

0 commit comments

Comments
 (0)