From 2291f7b34887ea3a0b77979421381165d06313db Mon Sep 17 00:00:00 2001 From: shainachen Date: Sat, 14 Jan 2017 16:30:13 -0800 Subject: [PATCH] Add buttons to OI class --- src/org/usfirst/frc/team3501/robot/Constants.java | 3 +++ src/org/usfirst/frc/team3501/robot/OI.java | 8 ++++++++ src/org/usfirst/frc/team3501/robot/Robot.java | 1 - .../robot/commands/shooter/RunFlyWheelContinuous.java | 3 +-- .../robot/commands/shooter/RunIndexWheelContinuous.java | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index c93d643..e0d7f64 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -11,6 +11,9 @@ public class Constants { public final static int LEFT_STICK_PORT = 0; public final static int RIGHT_STICK_PORT = 1; public final static int TOGGLE_WINCH_PORT = 0; + + public final static int TOGGLE_FLYWHEEL_PORT = 0; + public final static int TOGGLE_INDEXWHEEL_PORT = 0; } public static class DriveTrain { diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index e72c028..d21fe84 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -10,12 +10,20 @@ public class OI { public static Joystick rightJoystick; public static Button toggleWinch; + public static Button toggleIndexWheel; + public static Button toggleFlyWheel; + public OI() { leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); toggleWinch = new JoystickButton(leftJoystick, Constants.OI.TOGGLE_WINCH_PORT); + toggleIndexWheel = new JoystickButton(leftJoystick, + Constants.OI.TOGGLE_INDEXWHEEL_PORT); + toggleFlyWheel = new JoystickButton(leftJoystick, + Constants.OI.TOGGLE_FLYWHEEL_PORT); + } public static OI getOI() { diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 00ad1cb..451d339 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -11,7 +11,6 @@ public class Robot extends IterativeRobot { private static DriveTrain driveTrain; private static Shooter shooter; private static OI oi; - private static Shooter shooter; @Override public void robotInit() { diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java index 8a6e5be..806611d 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunFlyWheelContinuous.java @@ -53,8 +53,7 @@ public class RunFlyWheelContinuous extends Command { @Override protected boolean isFinished() { // TODO - return false; - + return !Robot.getOI().toggleFlyWheel.get(); } } diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java index 2c24338..d3d49b8 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/RunIndexWheelContinuous.java @@ -53,7 +53,7 @@ public class RunIndexWheelContinuous extends Command { @Override protected boolean isFinished() { // TODO - return false; + return Robot.getOI().toggleIndexWheel.get(); } } -- 2.30.2