From: Arunima DIvya Date: Thu, 26 Jan 2017 04:02:59 +0000 (-0800) Subject: fill in code X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=commitdiff_plain;h=9db1440b52497b7c1683ede379da726c1f79c47e fill in code --- 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(); } }