X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fintake%2FReverseIntake.java;h=5334e7f5ffc77bc3d67f4302c8082ac4913d602f;hp=6b7caff5658dca64b68708e9a35f137ff3337cbd;hb=9db1440b52497b7c1683ede379da726c1f79c47e;hpb=6486f4058c2c8fad53e3a6305b18d91d76fa0e1a diff --git a/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntake.java b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntake.java index 6b7caff..5334e7f 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntake.java +++ b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntake.java @@ -2,6 +2,7 @@ package org.usfirst.frc.team3501.robot.commands.intake; import org.usfirst.frc.team3501.robot.Robot; +import edu.wpi.first.wpilibj.Timer; import edu.wpi.first.wpilibj.command.Command; /** @@ -10,35 +11,43 @@ import edu.wpi.first.wpilibj.command.Command; * parameters: time to run intake */ public class ReverseIntake extends Command { + private double timeToMove; + public Timer timer; public ReverseIntake(double timeToMove) { requires(Robot.getIntake()); + timer = new Timer(); + this.timeToMove = timeToMove; } // Called just before this Command runs the first time @Override protected void initialize() { + timer.start(); } // Called repeatedly when this Command is scheduled to run @Override protected void execute() { + Robot.getIntake().runReverseIntake(); } // Make this return true when this Command no longer needs to run execute() @Override protected boolean isFinished() { - return false; + return timer.get() >= timeToMove; } // Called once after isFinished returns true @Override protected void end() { + Robot.getIntake().stopIntake(); } // Called when another command which requires one or more of the same // subsystems is scheduled to run @Override protected void interrupted() { + end(); } }