-
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.
wrote the inake subsystem
- Loading branch information
Showing
3 changed files
with
198 additions
and
50 deletions.
There are no files selected for viewing
Empty file.
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,98 @@ | ||
package frc.robot.subsystems; | ||
|
||
import edu.wpi.first.wpilibj2.command.*; | ||
import lib.RepeatingCommand; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import java.util.concurrent.atomic.AtomicReference; | ||
import java.util.function.BooleanSupplier; | ||
|
||
public class Superstructure { | ||
private final Intake intake = new Intake(); | ||
|
||
// option a - David Arownowitz | ||
// public Command intakeBallsCommand() { | ||
// return new InstantCommand( | ||
// () -> intake.openClosePiston(true)) | ||
// .andThen( | ||
// new RepeatingCommand( | ||
// new ConditionalCommand( | ||
// // deciding by whether the ball is our color | ||
// new ConditionalCommand( | ||
// // whether the ultrasonic detects a ball | ||
// intake.closeIntake() | ||
// .andThen(new RunCommand(()-> {})), | ||
// intake.pullToUltrasonic(), | ||
// intake::isUltraDist), | ||
// new ConditionalCommand( | ||
// // whether we want to eject from intake or from shooter | ||
// intake.ejectFromColorCommand(), | ||
// new RunCommand(() -> { | ||
// intake.setFrontMotorSpeed(0.3); | ||
// // TODO call the low shooter eject command | ||
// }) | ||
// .until(() -> intake.isUltraDist()) | ||
// .andThen(() -> intake.stopBackMotor()) | ||
// /*TODO .andThen(stopShootMotorCommand*/, | ||
// intake::isUltraDist), | ||
// intake::isOurColor))); | ||
// } | ||
|
||
// option b - Yoav Cohen | ||
// public Command intakeBallsCommand() { | ||
// AtomicBoolean intakeFull = new AtomicBoolean(false); | ||
// return new InstantCommand( | ||
// () -> intake.openClosePiston(true)) | ||
// .andThen( | ||
// new RepeatingCommand( | ||
// new ConditionalCommand( | ||
// // deciding by whether the ball is our color | ||
// new ConditionalCommand( | ||
// // whether the ultrasonic detects a ball | ||
// intake.closeIntake() | ||
// .andThen(new InstantCommand(()-> intakeFull.set(true))), | ||
// intake.pullToUltrasonic(), | ||
// intake::isUltraDist), | ||
// new ConditionalCommand( | ||
// // whether we want to eject from intake or from shooter | ||
// intake.ejectFromColorCommand(), | ||
// new RunCommand(() -> { | ||
// intake.setFrontMotorSpeed(0.3); | ||
// // TODO call the low shooter eject command | ||
// }) | ||
// .until(() -> intake.isUltraDist()) | ||
// .andThen(() -> intake.stopBackMotor()) | ||
// /*TODO .andThen(stopShootMotorCommand*/, | ||
// intake::isUltraDist), | ||
// intake::isOurColor)).until(intakeFull::get)); | ||
// } | ||
|
||
// option c | ||
// public Command intakeBallsCommand() { | ||
// return new InstantCommand( | ||
// () -> intake.openClosePiston(true)) | ||
// .andThen( | ||
// new RepeatingCommand( | ||
// new ConditionalCommand( | ||
// // deciding by whether the ball is our color | ||
// new ConditionalCommand( | ||
// // whether the ultrasonic detects a ball | ||
// intake.closeIntake() | ||
// .andThen(new RunCommand(()-> {})), | ||
// intake.pullToUltrasonic(), | ||
// intake::isUltraDist), | ||
// new ConditionalCommand( | ||
// // whether we want to eject from intake or from shooter | ||
// intake.ejectFromColorCommand(), | ||
// new RunCommand(() -> { | ||
// intake.setFrontMotorSpeed(0.3); | ||
// // TODO call the low shooter eject command | ||
// }) | ||
// .until(() -> intake.isUltraDist()) | ||
// .andThen(() -> intake.stopBackMotor()) | ||
// /* TODO .andThen(stopShootMotorCommand*/, | ||
// intake::isUltraDist), | ||
// intake::isOurColor)) | ||
// .until(intake::intakeFull)); | ||
// } | ||
} |