-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved scoring states for intake to separate classes
- Loading branch information
IanTapply22
committed
Dec 19, 2023
1 parent
d44bb89
commit f05e5fc
Showing
12 changed files
with
181 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/frc/robot/subsystems/intake/states/ScoringState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package frc.robot.subsystems.intake.states; | ||
|
||
import frc.robot.subsystems.intake.enums.IntakeGamepieces; | ||
|
||
public abstract class ScoringState { | ||
double outtakeSpeed; | ||
double cubeOuttakeSpeed; | ||
double coneOuttakeSpeed; | ||
|
||
String stateName; | ||
|
||
/** | ||
* Creates a scoring state with the same outtake speed for cubes and cones | ||
* @param outtakeSpeed The speed that should be used to outtake the gamepiece | ||
* @param stateName The name of the scoring state that should be used for logging | ||
*/ | ||
protected ScoringState(double outtakeSpeed, String stateName) { | ||
this.outtakeSpeed = outtakeSpeed; | ||
this.stateName = stateName; | ||
} | ||
|
||
/** | ||
* Creates a scoring state with different outtake speeds for cubes and cones | ||
* @param cubeOuttakeSpeed The speed that should be used to outtake the cube gamepiece | ||
* @param coneOuttakeSpeed The speed that should be used to outtake the cone gamepiece | ||
* @param stateName The name of the scoring state that should be used for logging | ||
*/ | ||
protected ScoringState(double cubeOuttakeSpeed, double coneOuttakeSpeed, String stateName) { | ||
this.cubeOuttakeSpeed = cubeOuttakeSpeed; | ||
this.coneOuttakeSpeed = coneOuttakeSpeed; | ||
this.stateName = stateName; | ||
} | ||
|
||
/** | ||
* Gets the name of the scoring state | ||
* @return The name of the scoring state | ||
*/ | ||
public String getStateName() { | ||
return this.stateName; | ||
} | ||
|
||
/** | ||
* Gets the outtake speed for the scoring state depending on the gamepiece that is expected to be scored | ||
* @return The outtake speed for the scoring state | ||
*/ | ||
public double getOuttakeSpeed(IntakeGamepieces expectedGamepiece) { | ||
if (expectedGamepiece == null) { | ||
return this.outtakeSpeed; | ||
} | ||
|
||
// Based on the gamepiece that is expected to be scored, return the appropriate outtake speed | ||
switch(expectedGamepiece) { | ||
case CUBE: | ||
return this.cubeOuttakeSpeed; | ||
case CONE: | ||
return this.coneOuttakeSpeed; | ||
default: | ||
return 0.0; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/cone/HighCone.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.cone; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class HighCone extends ScoringState { | ||
|
||
HighCone() { | ||
super(IntakeConstants.OuttakeSpeeds.HIGH_CONE, "High Cone"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/cone/HighConeAuto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.cone; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class HighConeAuto extends ScoringState { | ||
|
||
HighConeAuto() { | ||
super(IntakeConstants.OuttakeSpeeds.HIGH_CONE_AUTO, "High Cone Auto"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/cone/MidCone.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.cone; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class MidCone extends ScoringState { | ||
|
||
MidCone() { | ||
super(IntakeConstants.OuttakeSpeeds.MID_CONE, "Mid Cone"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/cone/MidConeTipped.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.cone; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class MidConeTipped extends ScoringState { | ||
|
||
MidConeTipped() { | ||
super(IntakeConstants.OuttakeSpeeds.MID_CONE_TIPPED, "Mid Cone Tipped"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/cube/HighCube.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.cube; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class HighCube extends ScoringState { | ||
|
||
HighCube() { | ||
super(IntakeConstants.OuttakeSpeeds.HIGH_CUBE, "High Cube"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/cube/HighCubeAuto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.cube; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class HighCubeAuto extends ScoringState { | ||
|
||
HighCubeAuto() { | ||
super(IntakeConstants.OuttakeSpeeds.HIGH_CUBE, "High Cube Auto"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/cube/MidCube.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.cube; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class MidCube extends ScoringState { | ||
|
||
MidCube() { | ||
super(IntakeConstants.OuttakeSpeeds.MID_CUBE, "Mid Cube"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/cube/MidCubeAuto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.cube; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class MidCubeAuto extends ScoringState { | ||
|
||
MidCubeAuto() { | ||
super(IntakeConstants.OuttakeSpeeds.MID_CUBE, "Mid Cube Auto"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/level/Low.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.level; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class Low extends ScoringState { | ||
|
||
Low() { | ||
super(IntakeConstants.OuttakeSpeeds.LOW_CUBE, IntakeConstants.OuttakeSpeeds.LOW_CONE, "Low"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/frc/robot/subsystems/intake/states/scoring/level/LowAuto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package frc.robot.subsystems.intake.states.scoring.level; | ||
|
||
import frc.robot.subsystems.intake.IntakeConstants; | ||
import frc.robot.subsystems.intake.states.ScoringState; | ||
|
||
public class LowAuto extends ScoringState { | ||
|
||
LowAuto() { | ||
super(IntakeConstants.OuttakeSpeeds.LOW_CUBE_AUTO, IntakeConstants.OuttakeSpeeds.LOW_CONE_AUTO, "Low Auto"); | ||
} | ||
} |