From 2b65c91de918e14536c6e2032387938ff4d9ebf3 Mon Sep 17 00:00:00 2001 From: Lauren Meier Date: Tue, 9 Feb 2016 19:03:38 -0800 Subject: [PATCH] add methods and constants to stop/start rollers --- src/org/usfirst/frc/team3501/robot/Constants.java | 1 + .../frc/team3501/robot/commands/ToggleBallRollerExpel.java | 6 ++++-- .../usfirst/frc/team3501/robot/subsystems/IntakeArm.java | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index d4ae7b2e..c366b53c 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -77,6 +77,7 @@ public class Constants { public static final int POT_CHANNEL = 0; public static final double INTAKE_SPEED = 0.5; public static final double OUTPUT_SPEED = -0.5; + public static final double STOP_SPEED = 0.0; public final static double FULL_RANGE = 270.0; // in degrees public final static double OFFSET = -135.0; // in degrees public static final double ZERO_ANGLE = 0; diff --git a/src/org/usfirst/frc/team3501/robot/commands/ToggleBallRollerExpel.java b/src/org/usfirst/frc/team3501/robot/commands/ToggleBallRollerExpel.java index 271c79ec..66ee1d6d 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/ToggleBallRollerExpel.java +++ b/src/org/usfirst/frc/team3501/robot/commands/ToggleBallRollerExpel.java @@ -5,14 +5,16 @@ import org.usfirst.frc.team3501.robot.Robot; import edu.wpi.first.wpilibj.command.Command; public class ToggleBallRollerExpel extends Command { - final double BALL_INTAKE_SPEED = 0.3; public ToggleBallRollerExpel() { } @Override protected void initialize() { - Robot.shooter.setSpeed(BALL_INTAKE_SPEED); + if (Robot.intakeArm.areRollersRolling()) + Robot.intakeArm.stopRollers(); + else + Robot.intakeArm.intakeBall(); } @Override diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/IntakeArm.java b/src/org/usfirst/frc/team3501/robot/subsystems/IntakeArm.java index afcc16f6..a707777e 100755 --- a/src/org/usfirst/frc/team3501/robot/subsystems/IntakeArm.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/IntakeArm.java @@ -48,6 +48,10 @@ public class IntakeArm extends Subsystem { intakeRoller.set(Constants.IntakeArm.OUTPUT_SPEED); } + public void stopRollers() { + intakeRoller.set(Constants.IntakeArm.STOP_SPEED); + } + /*** * This method gets you the current voltage of the motor that controls the * intake arm roller. The range of voltage is from [-1,1]. A negative voltage -- 2.30.2