X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fintake%2FReverseIntakeContinuous.java;h=699559d224c4d99313a8512d564d65ddbcd0f3b4;hp=f44631661476e7d309e58abdf663b0d5b75c1fdd;hb=f74d236db406193b851bff99e4daec7b7abf35e7;hpb=8275a069e1891bd27156dcd947a897519c42a3a3 diff --git a/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java index f446316..699559d 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java @@ -1,6 +1,7 @@ package org.usfirst.frc.team3501.robot.commands.intake; import org.usfirst.frc.team3501.robot.Robot; +import org.usfirst.frc.team3501.robot.subsystems.Intake; import edu.wpi.first.wpilibj.command.Command; @@ -11,9 +12,13 @@ import edu.wpi.first.wpilibj.command.Command; * button.whileHeld(...). */ public class ReverseIntakeContinuous extends Command { + private Intake intake = Robot.getIntake(); + + private double previousMotorValue = 0; + private double targetMotorValue = intake.REVERSE_SPEED; public ReverseIntakeContinuous() { - requires(Robot.getIntake()); + requires(intake); } // Called just before this Command runs the first time @@ -24,7 +29,9 @@ public class ReverseIntakeContinuous extends Command { // Called repeatedly when this Command is scheduled to run @Override protected void execute() { - Robot.getIntake().runReverseIntake(); + double motorValue = (6 * previousMotorValue + targetMotorValue) / 7; + previousMotorValue = motorValue; + intake.setSpeed(motorValue); } // Make this return true when this Command no longer needs to run execute() @@ -36,7 +43,7 @@ public class ReverseIntakeContinuous extends Command { // Called once after isFinished returns true @Override protected void end() { - Robot.getIntake().stopIntake(); + intake.stopIntake(); } // Called when another command which requires one or more of the same