X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2FOI.java;h=491b71c61946103034c9841697e420dca814a5e8;hb=2781cca0354e26f8c5a6150d6b5179d300d479e1;hp=cc217235133db605ac73549cf3aa8755cf1785e7;hpb=8a3090b5e1120376a232b98a36d5f3de929d6697;p=3501%2Fstronghold-2016 diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index cc217235..491b71c6 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -1,25 +1,25 @@ package org.usfirst.frc.team3501.robot; +import org.usfirst.frc.team3501.robot.commands.auton.CompactRobot; import org.usfirst.frc.team3501.robot.commands.auton.PassChevalDeFrise; import org.usfirst.frc.team3501.robot.commands.auton.PassDrawBridge; import org.usfirst.frc.team3501.robot.commands.auton.PassPortcullis; import org.usfirst.frc.team3501.robot.commands.auton.PassSallyPort; +import org.usfirst.frc.team3501.robot.commands.driving.Turn180; import org.usfirst.frc.team3501.robot.commands.intakearm.IntakeBall; import org.usfirst.frc.team3501.robot.commands.scaler.ExtendLift; import org.usfirst.frc.team3501.robot.commands.scaler.RetractLift; +import org.usfirst.frc.team3501.robot.commands.scaler.RunWinchContinuous; +import org.usfirst.frc.team3501.robot.commands.scaler.StopWinch; +import org.usfirst.frc.team3501.robot.commands.scaler.ToggleScaling; import org.usfirst.frc.team3501.robot.commands.shooter.Shoot; -import org.usfirst.frc.team3501.robot.commands.shooter.runShooter; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.buttons.Button; import edu.wpi.first.wpilibj.buttons.JoystickButton; -import edu.wpi.first.wpilibj.command.Scheduler; public class OI { - public static boolean isScalingMode = false; - public static boolean isCompactRobot = false; - public static Joystick leftJoystick; public static Joystick rightJoystick; @@ -48,7 +48,7 @@ public class OI { public static Button shootBoulder; // button to change robot to the scaling mode - public static DigitalButton toggleScalingMode; + public static DigitalButton toggleScaling; public OI() { leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); @@ -56,28 +56,31 @@ public class OI { passPortcullis = new DigitalButton( new DigitalInput(Constants.OI.PASS_PORTCULLIS_PORT)); + passPortcullis.whenPressed(new PassPortcullis()); + passChevalDeFrise = new DigitalButton( new DigitalInput(Constants.OI.PASS_CHEVAL_DE_FRISE_PORT)); + passChevalDeFrise.whenPressed(new PassChevalDeFrise()); + passDrawbridge = new DigitalButton( - new DigitalInput(Constants.OI.PASS_DRAWBRIDGE)); + new DigitalInput(Constants.OI.PASS_DRAWBRIDGE_PORT)); + passDrawbridge.whenPressed(new PassDrawBridge()); + passSallyPort = new DigitalButton( new DigitalInput(Constants.OI.PASS_SALLYPORT_PORT)); + passSallyPort.whenPressed(new PassSallyPort()); - lowerChevalDeFrise = new DigitalButton( - new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_ONE_PORT)); moveToIntakeBoulder = new DigitalButton( new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_TWO_PORT)); - poiseAboveChevalDeFrise = new DigitalButton( - new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_THREE_PORT)); - moveIntakeArmInsideRobot = new DigitalButton( - new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_FOUR_PORT)); toggleShooter = new JoystickButton(leftJoystick, Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT); - SpinRobot180_1 = new JoystickButton(leftJoystick, - Constants.OI.LEFT_JOYSTICK_TOP_LEFT_PORT); - SpinRobot180_2 = new JoystickButton(leftJoystick, - Constants.OI.LEFT_JOYSTICK_TOP_RIGHT_PORT); + SpinRobot180_1 = new JoystickButton(leftJoystick, Constants.OI.SPIN1_PORT); + SpinRobot180_1.whenPressed(new Turn180()); + + SpinRobot180_2 = new JoystickButton(leftJoystick, Constants.OI.SPIN2_PORT); + SpinRobot180_2.whenPressed(new Turn180()); + compactRobot_1 = new JoystickButton(leftJoystick, Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT); compactRobot_2 = new JoystickButton(leftJoystick, @@ -88,47 +91,29 @@ public class OI { shootBoulder = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_THUMB_PORT); - toggleScalingMode = new DigitalButton( - new DigitalInput(Constants.OI.SCALING_BUTTON_PORT)); + toggleScaling = new DigitalButton( + new DigitalInput(Constants.OI.TOGGLE_SCALING_PORT)); + toggleScaling.whenPressed(new ToggleScaling()); - passPortcullis.whenPressed(new PassPortcullis()); - passChevalDeFrise.whenPressed(new PassChevalDeFrise()); - passDrawbridge.whenPressed(new PassDrawBridge()); - passSallyPort.whenPressed(new PassSallyPort()); - - lowerChevalDeFrise - .whenPressed(/* TO DO: define this, and fill in commands */); - - if (toggleScalingMode.get()) { - if (!isScalingMode) { - isScalingMode = true; - if (!isCompactRobot) { - Scheduler.getInstance().add(new CompactRobot()); - isCompactRobot = true; - } - } else if (isScalingMode) { - isScalingMode = false; - Scheduler.getInstance().add(new CompactRobot()); - } - } - - if (!isScalingMode) { - toggleShooter.toggleWhenPressed(new runShooter()); + if (!Constants.Scaler.SCALING) { compactRobot_1.whenPressed(new CompactRobot()); + compactRobot_2.whenPressed(new CompactRobot()); intakeBoulder.whenPressed(new IntakeBall()); shootBoulder.whenPressed(new Shoot()); - } else if (isScalingMode) { - toggleShooter.toggleWhenPressed(new WinchIn()); + } else { + // toggleShooter becomes winch + // compact robot button 1 and 2 retracts the lift + // intake button stops the winch + // shoot button extends the lift + toggleShooter.whenPressed(new RunWinchContinuous( + Constants.Scaler.SCALE_SPEED, Constants.Scaler.SECONDS_TO_SCALE)); compactRobot_1.whenPressed(new RetractLift()); + compactRobot_2.whenPressed(new RetractLift()); - intakeBoulder.toggleWhenPressed(new WinchOut()); + intakeBoulder.whenReleased(new StopWinch()); shootBoulder.whenPressed(new ExtendLift()); } - - SpinRobot180_1 - .whenPressed(/* rotate robot 180, reorient joystick controls */); - } }