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
;
10 * Runs the intake continuously when button is pressed, and when button is not
11 * pressed does not run.
13 * Intended to be run inside a .whileHeld() call on a button in OI
18 public class RunIntakeContinuous
extends Command
{
19 private Intake intake
= Robot
.getIntake();
21 private double previousMotorValue
= 0;
22 private double targetMotorValue
= intake
.INTAKE_SPEED
;
24 public RunIntakeContinuous() {
29 protected boolean isFinished() {
33 // Called just before this Command runs the first time
35 protected void initialize() {
38 // Called repeatedly when this Command is scheduled to run
40 protected void execute() {
41 double motorValue
= (6 * previousMotorValue
+ targetMotorValue
) / 7;
42 previousMotorValue
= motorValue
;
43 intake
.setSpeed(motorValue
);
46 // Called once after isFinished returns true
48 protected void end() {
49 Robot
.getIntake().stopIntake();
52 // Called when another command which requires one or more of the same
53 // subsystems is scheduled to run
55 protected void interrupted() {