generated from Patribots4738/Swerve-Command-Based
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
complete refactoring of handoff to be up to date with branches
The branches are as follows: Shooting Calc Comand #33 Shooter Subystem #31 Trigger Subsystem #30 Claw Subsystem #29 Elevator Command #28 Elevator Subsystem #26 Pivot Subsystem #25
- Loading branch information
1 parent
5fb4f3f
commit 542fa93
Showing
2 changed files
with
33 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,72 @@ | ||
package frc.robot.commands.handoff; | ||
|
||
import java.util.function.BooleanSupplier; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.button.Trigger; | ||
import frc.robot.subsystems.Elevator; | ||
import frc.robot.subsystems.Intake; | ||
import frc.robot.subsystems.TriggerWheel; | ||
import frc.robot.subsystems.ElevatorSubs.Claw; | ||
import frc.robot.subsystems.ElevatorSubs.Elevator; | ||
import frc.robot.subsystems.shooter.Pivot; | ||
import frc.robot.subsystems.shooter.Shooter; | ||
|
||
public class Handoff { | ||
private final Command emptyCommand = Commands.runOnce(() -> System.out.println("")); | ||
private NotePosition notePosition; | ||
private NotePosition currentNotePos; | ||
|
||
private Intake intake; | ||
private TriggerWheel trigger; | ||
|
||
private Elevator elevator; | ||
private Intake intake; | ||
private Claw claw; | ||
|
||
private Pivot pivot; | ||
private Shooter shooter; | ||
|
||
|
||
public Handoff() { | ||
intake = new Intake(); | ||
trigger = new TriggerWheel(); | ||
|
||
elevator = new Elevator(); | ||
claw = new Claw(); | ||
|
||
pivot = new Pivot(); | ||
shooter = new Shooter(); | ||
|
||
this.notePosition = trigger.getHasPiece().getAsBoolean() | ||
this.currentNotePos = trigger.hasPiece().getAsBoolean() | ||
? NotePosition.TRIGGER | ||
: NotePosition.NONE; | ||
} | ||
|
||
/** | ||
* @return | ||
*/ | ||
public NotePosition getNotePosition(){ | ||
return this.notePosition; | ||
public NotePosition getCurrentNotePos(){ | ||
return this.currentNotePos; | ||
} | ||
|
||
/** | ||
* @param notePosition | ||
*/ | ||
public void setNotePosition(NotePosition notePosition) { | ||
this.notePosition = notePosition; | ||
public void setCurrentNotePos(NotePosition notePosition) { | ||
this.currentNotePos = notePosition; | ||
} | ||
|
||
public void triggerReady() { | ||
trigger.setIsReady(intake.hasGamePieceTrigger()); | ||
} | ||
|
||
public Trigger readyToShoot() { | ||
return new Trigger(trigger.getHasPiece()); | ||
return new Trigger(trigger.hasPiece()); | ||
} | ||
|
||
public Command triggerToShooter() { | ||
return Commands.either(trigger.shootToPivot(), emptyCommand, this.readyToShoot()); | ||
return Commands.either(trigger.toShooter(), emptyCommand, this.readyToShoot()); | ||
} | ||
|
||
public Command triggerToElevator() { | ||
return Commands.either(trigger.shootToElevator(), emptyCommand, this.readyToShoot()); | ||
return Commands.either(trigger.toTrap(), emptyCommand, this.readyToShoot()); | ||
} | ||
|
||
} |
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