generated from Frc5572/Java-Template
-
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.
- Loading branch information
1 parent
029736b
commit 953cddf
Showing
6 changed files
with
72 additions
and
23 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package frc.robot.commands; | ||
|
||
import java.util.function.BooleanSupplier; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.Constants; | ||
import frc.robot.subsystems.elevator_wrist.ElevatorWrist; | ||
import frc.robot.subsystems.intake.Intake; | ||
|
||
/** | ||
* File to create commands using factories | ||
*/ | ||
public class CommandFactory { | ||
|
||
/** | ||
* Checks to make sure all preconditions are met before running the intake | ||
* | ||
* @param intake Intake subsystem | ||
* @param elevatorWrist Elevator and Wrist subsystem | ||
* @return Returns a command | ||
*/ | ||
public static Command runIntake(Intake intake, ElevatorWrist elevatorWrist) { | ||
BooleanSupplier sensor = () -> intake.getSensorStatus(); | ||
Command moveElevatorWrist = | ||
elevatorWrist.goToPosition(Constants.ElevatorWristConstants.SetPoints.HOME_HEIGHT, | ||
Constants.ElevatorWristConstants.SetPoints.HOME_ANGLE); | ||
Command runIntakeIndexer = | ||
intake.runIntakeMotor(Constants.IntakeConstants.INDEX_MOTOR_FORWARD); | ||
return moveElevatorWrist.andThen(runIntakeIndexer).unless(sensor); | ||
} | ||
} |
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
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