Skip to content

Commit

Permalink
Set flipped to boolean and simplified optionals.
Browse files Browse the repository at this point in the history
  • Loading branch information
Murat65536 committed Feb 21, 2025
1 parent 97b1816 commit 3a1d77b
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 156 deletions.
102 changes: 0 additions & 102 deletions src/main/deploy/pathplanner/paths/Example Path.path

This file was deleted.

54 changes: 54 additions & 0 deletions src/main/deploy/pathplanner/paths/New Path.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"version": "2025.0",
"waypoints": [
{
"anchor": {
"x": 5.484375,
"y": 5.550107020547944
},
"prevControl": null,
"nextControl": {
"x": 6.484375000000002,
"y": 5.550107020547944
},
"isLocked": false,
"linkedName": null
},
{
"anchor": {
"x": 4.0,
"y": 6.0
},
"prevControl": {
"x": 3.0,
"y": 6.0
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [],
"constraintZones": [],
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
"unlimited": false
},
"goalEndState": {
"velocity": 0,
"rotation": 0.0
},
"reversed": false,
"folder": null,
"idealStartingState": {
"velocity": 0,
"rotation": 0.0
},
"useDefaultConstraints": true
}
7 changes: 3 additions & 4 deletions src/main/java/frc/robot/OperatorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.OperatorState.ScoringSide;
import frc.robot.commands.AcquireAlgaeCommand;
import frc.robot.commands.AcquireCoralCommand;
import frc.robot.commands.DisposeAlgaeCommand;
Expand Down Expand Up @@ -47,7 +46,7 @@ private OperatorPanel() {
super(IOConstants.kOperatorPanelPort);
this.operatorState = OperatorState.getInstance();
operatorState.setLastInput(AcquisitionPositionSetpoint.Storage);
operatorState.setScoringSide(coralPosScoringSwitch.getAsBoolean() ? ScoringSide.LEFT : ScoringSide.RIGHT);
operatorState.setScoringFlipped(coralPosScoringSwitch.getAsBoolean());

this.acquireButton.and(operatorState::isCoral).whileTrue(new AcquireCoralCommand());
this.acquireButton.and(operatorState::isAlgae).whileTrue(new AcquireAlgaeCommand());
Expand All @@ -72,8 +71,8 @@ private OperatorPanel() {
this.feederButton.onTrue(
new InstantCommand(() -> operatorState.setLastInput(AcquisitionPositionSetpoint.FeederStation)));
this.coralPosScoringSwitch
.onTrue(new InstantCommand(() -> operatorState.setScoringSide(ScoringSide.LEFT)))
.onFalse(new InstantCommand(() -> operatorState.setScoringSide(ScoringSide.RIGHT)));
.onTrue(new InstantCommand(() -> operatorState.setScoringFlipped(false)))
.onFalse(new InstantCommand(() -> operatorState.setScoringFlipped(true)));
}

// Singleton Setup
Expand Down
16 changes: 6 additions & 10 deletions src/main/java/frc/robot/OperatorState.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

public class OperatorState {
private static AcquisitionPositionSetpoint lastInput;
private static ScoringSide scoringSide;

public enum ScoringSide {
LEFT, RIGHT;
}
private static boolean scoringFlipped;

private OperatorState() {
lastInput = AcquisitionPositionSetpoint.Storage;
Expand Down Expand Up @@ -54,14 +50,14 @@ public boolean isAlgae() {
}

public void setLastInput(AcquisitionPositionSetpoint lastInput) {
this.lastInput = lastInput;
OperatorState.lastInput = lastInput;
}

public void setScoringSide(ScoringSide scoringSide) {
OperatorState.scoringSide = scoringSide;
public void setScoringFlipped(boolean scoringFlipped) {
OperatorState.scoringFlipped = scoringFlipped;
}

public static ScoringSide getScoringSide() {
return scoringSide;
public static boolean isScoringFlipped() {
return scoringFlipped;
}
}
Loading

0 comments on commit 3a1d77b

Please sign in to comment.