1 package org
.usfirst
.frc
.team3501
.robot
.commands
.intake
;
3 import org
.usfirst
.frc
.team3501
.robot
.Robot
;
4 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Intake
;
6 import edu
.wpi
.first
.wpilibj
.command
.Command
;
9 * Reverses the intake until the button triggering this command is released
11 * pre-condition: This command must be run by a button in OI with
12 * button.whileHeld(...).
14 public class ReverseIntakeContinuous
extends Command
{
15 private Intake intake
= Robot
.getIntake();
17 private double previousMotorValue
= 0;
18 private double targetMotorValue
= intake
.REVERSE_SPEED
;
20 public ReverseIntakeContinuous() {
24 // Called just before this Command runs the first time
26 protected void initialize() {
29 // Called repeatedly when this Command is scheduled to run
31 protected void execute() {
32 double motorValue
= (6 * previousMotorValue
+ targetMotorValue
) / 7;
33 previousMotorValue
= motorValue
;
34 intake
.setSpeed(motorValue
);
37 // Make this return true when this Command no longer needs to run execute()
39 protected boolean isFinished() {
43 // Called once after isFinished returns true
45 protected void end() {
49 // Called when another command which requires one or more of the same
50 // subsystems is scheduled to run
52 protected void interrupted() {