X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2FOI.java;h=0acc3c8067067d572ee34a525ce9fad7f4115fdc;hb=ba29a57aaf0f4175ef20d4ee64ac7ad8c799327d;hp=1c891af08f5e26dcf2b9e9bb7a3baae61b3ec938;hpb=6bb7f8ac8eca89a8e0b308720f7e15178eef43ea;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 1c891af0..0acc3c80 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -1,7 +1,12 @@ package org.usfirst.frc.team3501.robot; -import org.usfirst.frc.team3501.robot.commands.shooter.ChangeShooterSpeed; -import org.usfirst.frc.team3501.robot.commands.shooter.SetShooterSpeed; +import org.usfirst.frc.team3501.robot.commands.driving.SetHighGear; +import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear; +import org.usfirst.frc.team3501.robot.commands.driving.ToggleFront; +import org.usfirst.frc.team3501.robot.commands.intakearm.MoveIntakeArm; +import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntake; +import org.usfirst.frc.team3501.robot.commands.shooter.FireCatapult; +import org.usfirst.frc.team3501.robot.commands.shooter.ResetCatapult; import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.buttons.Button; @@ -10,29 +15,79 @@ import edu.wpi.first.wpilibj.buttons.JoystickButton; public class OI { public static Joystick leftJoystick; public static Joystick rightJoystick; - public static Button decrementShooterSpeed; - public static Button incrementShooterSpeed; - public static Button outputCurrentShooterSpeed; - public static Button trigger; + + // left joystick buttons + public static Button gearShift; + public static Button extendIntake1; + public static Button extendIntake2; + public static Button retractIntake1; + public static Button retractIntake2; + public static Button toggleFront; + + // right joystick buttons + public static Button intake; + public static Button outtake1; + public static Button outtake2; + public static Button shooterUp; + public static Button shooterDown1; + public static Button shooterDown2; public OI() { leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); - decrementShooterSpeed = new JoystickButton(rightJoystick, - Constants.OI.DECREMENT_SHOOTER_SPEED_PORT); - decrementShooterSpeed.whenPressed(new ChangeShooterSpeed(-0.1)); + // Left joystick + gearShift = new JoystickButton(leftJoystick, + Constants.OI.LEFT_JOYSTICK_GEAR_SHIFT_PORT); + gearShift.whenPressed(new SetLowGear()); + gearShift.whenReleased(new SetHighGear()); + + extendIntake1 = new JoystickButton(leftJoystick, + Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_1_PORT); + extendIntake1.whenPressed(new MoveIntakeArm(Constants.IntakeArm.EXTEND)); + + extendIntake2 = new JoystickButton(leftJoystick, + Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_2_PORT); + extendIntake2.whenPressed(new MoveIntakeArm(Constants.IntakeArm.EXTEND)); + + retractIntake1 = new JoystickButton(leftJoystick, + Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_1_PORT); + retractIntake1.whenPressed(new MoveIntakeArm(Constants.IntakeArm.RETRACT)); + + retractIntake2 = new JoystickButton(leftJoystick, + Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_2_PORT); + retractIntake2.whenPressed(new MoveIntakeArm(Constants.IntakeArm.RETRACT)); + + toggleFront = new JoystickButton(leftJoystick, + Constants.OI.LEFT_JOYSTICK_TOGGLE_FRONT_PORT); + toggleFront.whenPressed(new ToggleFront()); + + // Right joystick + intake = new JoystickButton(rightJoystick, + Constants.OI.RIGHT_JOYSTICK_INTAKE_PORT); + intake.whenPressed(new RunIntake(Constants.IntakeArm.IN)); + intake.whenReleased(new RunIntake(Constants.IntakeArm.STOP)); + + outtake1 = new JoystickButton(rightJoystick, + Constants.OI.RIGHT_JOYSTICK_OUTTAKE_1_PORT); + outtake1.whenPressed(new RunIntake(Constants.IntakeArm.OUT)); + outtake1.whenReleased(new RunIntake(Constants.IntakeArm.STOP)); - incrementShooterSpeed = new JoystickButton(rightJoystick, - Constants.OI.INCREMENT_SHOOTER_SPEED_PORT); - incrementShooterSpeed.whenPressed(new ChangeShooterSpeed(0.1)); + outtake2 = new JoystickButton(rightJoystick, + Constants.OI.RIGHT_JOYSTICK_OUTTAKE_2_PORT); + outtake2.whenPressed(new RunIntake(Constants.IntakeArm.OUT)); + outtake2.whenReleased(new RunIntake(Constants.IntakeArm.STOP)); - outputCurrentShooterSpeed = new JoystickButton(rightJoystick, - Constants.OI.SHOOT_PORT); + shooterUp = new JoystickButton(rightJoystick, + Constants.OI.RIGHT_JOYSTICK_SHOOTER_UP_PORT); + shooterUp.whenPressed(new FireCatapult()); - trigger = new JoystickButton(rightJoystick, Constants.OI.TRIGGER_PORT); - trigger.whenPressed(new SetShooterSpeed(0.5)); - trigger.whenReleased(new SetShooterSpeed(0.0)); + shooterDown1 = new JoystickButton(rightJoystick, + Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_1_PORT); + shooterDown1.whenPressed(new ResetCatapult()); + shooterDown2 = new JoystickButton(rightJoystick, + Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_2_PORT); + shooterDown2.whenPressed(new ResetCatapult()); } }