This commit is contained in:
ryan123rudder
2020-02-26 17:31:57 -07:00
parent 011146b9ec
commit 1cc3aef303
11 changed files with 24 additions and 102 deletions
@@ -15,6 +15,7 @@ import frc4388.robot.subsystems.Storage;
public class StoragePrepIntake extends CommandBase {
public Intake m_intake;
public Storage m_storage;
public double startTime;
/**
* Creates a new StoragePrepIntake.
@@ -29,12 +30,13 @@ public class StoragePrepIntake extends CommandBase {
// Called when the command is initially scheduled.
@Override
public void initialize() {
startTime = System.currentTimeMillis();
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
if (m_storage.getBeam(1) == false){
if (!m_storage.getBeam(0) && System.currentTimeMillis() < startTime + 3000){ //If the bottom beam is broken, or 3 seconds have passed
m_storage.runStorage(-StorageConstants.STORAGE_SPEED);
}
else{
@@ -50,7 +52,7 @@ public class StoragePrepIntake extends CommandBase {
// Returns true when the command should end.
@Override
public boolean isFinished() {
if (m_storage.getBeam(1)){
if (m_storage.getBeam(0)){
return true;
}
return false;