-
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.
Code refactored and finished needs review
- Loading branch information
Myles A. Knowlin
committed
Jan 15, 2024
1 parent
0516577
commit 85bc75d
Showing
3 changed files
with
22 additions
and
14 deletions.
There are no files selected for viewing
32 changes: 20 additions & 12 deletions
32
src/main/java/frc/robot/commands/ScoringPositionCommand.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 |
---|---|---|
@@ -1,50 +1,58 @@ | ||
package frc.robot.commands; | ||
|
||
import java.util.Timer; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.Scoring; | ||
import frc.robot.subsystems.Scoring.ElevatorSetpoints; | ||
import frc.robot.constants.ScoringConstants; | ||
import frc.robot.constants.ScoringConstants.ScoringStatesConstants; | ||
|
||
public class ScoringPositionCommand extends Command { | ||
|
||
private Scoring scoring = Scoring.getInstance(); | ||
private ScoringStatesConstants scoringState; | ||
private ElevatorSetpoints scoringState; | ||
|
||
public ScoringPositionCommand(ScoringStatesConstants scoringState) { | ||
public ScoringPositionCommand(ElevatorSetpoints scoringState) { | ||
addRequirements(scoring); | ||
this.scoringState = scoringState; | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
switch (scoringState) { | ||
case Amp: | ||
scoring.setSetpoint(ElevatorSetpoints.amp); | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
// TODO Auto-generated method stub | ||
|
||
super.initialize(); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
// TODO Auto-generated method stub | ||
switch (scoringState) { | ||
case amp: | ||
scoring.setSetpoint(ElevatorSetpoints.amp.value); | ||
break; | ||
|
||
case ground: | ||
scoring.setSetpoint(ElevatorSetpoints.ground.value); | ||
break; | ||
|
||
default: | ||
scoring.setSetpoint(ElevatorSetpoints.trap.value); | ||
break; | ||
} | ||
super.execute(); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
// TODO Auto-generated method stub | ||
return super.isFinished(); | ||
return scoring.getController().atSetpoint(); | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
// TODO Auto-generated method stub | ||
scoring.stopRoller(); | ||
super.end(interrupted); | ||
} | ||
} |
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
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