Added most of the button commands and fixed Timer init in climber
authorTrevor <tr89on@gmail.com>
Sat, 28 Jan 2017 04:04:59 +0000 (20:04 -0800)
committerTrevor <tr89on@gmail.com>
Tue, 31 Jan 2017 03:13:50 +0000 (19:13 -0800)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/OI.java
src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java

index 0c3fb74cc339ae3c44dc77c0fca61aad77e2770f..41480162702a76a35b59c0ce2f37f317fe910431 100644 (file)
@@ -10,9 +10,17 @@ public class Constants {
   public static class OI {
     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 final static int RIGHT_BUTTON_2 = 0;
+    public final static int RIGHT_BUTTON_3 = 0;
+    public final static int RIGHT_BUTTON_4 = 0;
+    public final static int RIGHT_BUTTON_5 = 0;
+    public final static int LEFT_BUTTON_2 = 2;
+    public final static int LEFT_BUTTON_3 = 0;
+    public final static int LEFT_BUTTON_4 = 0;
+    public final static int LEFT_BUTTON_5 = 0;
+    public final static int LEFT_BUTTON_6 = 0;
+    public final static int LEFT_TRIGGER_BUTTON = 0;
+    public final static int RIGHT_TRIGGER_BUTTON = 0;
   }
 
   public static class Shooter {
index 9c1731db37ee72b5fec61424a8ad73f9f9a6dd8d..28df5994eff988bfa74d53f54526a4b798ac1571 100644 (file)
@@ -1,9 +1,14 @@
 package org.usfirst.frc.team3501.robot;
 
 import org.usfirst.frc.team3501.robot.commandgroups.PrepareToShoot;
+import org.usfirst.frc.team3501.robot.commandgroups.Shoot;
+import org.usfirst.frc.team3501.robot.commands.climber.RunWinchContinuous;
 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
 import org.usfirst.frc.team3501.robot.commands.driving.Turn90Left;
 import org.usfirst.frc.team3501.robot.commands.driving.Turn90Right;
+import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
+import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
+import org.usfirst.frc.team3501.robot.commands.intake.StopIntake;
 import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed;
 import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
 import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
@@ -16,17 +21,23 @@ public class OI {
   private static OI oi;
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
+
   public static Button toggleWinch;
+
   public static Button toggleIndexWheel;
   public static Button toggleFlyWheel;
+
   public static Button toggleIntake;
   public static Button toggleReverseIntake;
-  public static Button toggleHighGear;
-  public static Button toggleNormalGear;
+
+  public static Button toggleGearSpeed;
+
   public static Button increaseShootSpeed;
   public static Button decreaseShootSpeed;
+
   public static Button turn90Right;
   public static Button turn90Left;
+
   public static Button readyShooter;
   public static Button shootButton;
 
@@ -34,41 +45,45 @@ public class OI {
     System.out.println("OI is open");
     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);
+    toggleWinch = new JoystickButton(leftJoystick, Constants.OI.LEFT_BUTTON_2);
     toggleIndexWheel = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_INDEXWHEEL_PORT);
+        Constants.OI.LEFT_BUTTON_2);
     toggleFlyWheel = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
-    toggleIntake = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
+        Constants.OI.LEFT_BUTTON_2);
+    toggleIntake = new JoystickButton(leftJoystick, Constants.OI.LEFT_BUTTON_2);
     toggleReverseIntake = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
-    toggleHighGear = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
-    toggleNormalGear = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
+        Constants.OI.LEFT_BUTTON_2);
+    toggleGearSpeed = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_BUTTON_2);
     increaseShootSpeed = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
+        Constants.OI.LEFT_BUTTON_2);
     decreaseShootSpeed = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
-    turn90Right = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
-    turn90Left = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
-    readyShooter = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
-    shootButton = new JoystickButton(leftJoystick,
-        Constants.OI.TOGGLE_FLYWHEEL_PORT);
+        Constants.OI.LEFT_BUTTON_2);
+    turn90Right = new JoystickButton(leftJoystick, Constants.OI.LEFT_BUTTON_2);
+    turn90Left = new JoystickButton(leftJoystick, Constants.OI.LEFT_BUTTON_2);
+    readyShooter = new JoystickButton(leftJoystick, Constants.OI.LEFT_BUTTON_2);
+    shootButton = new JoystickButton(leftJoystick, Constants.OI.LEFT_BUTTON_2);
+
+    toggleWinch.whenActive(new RunWinchContinuous(1));
+    // toggleWinch.whenReleased(new KeepWinchInPlace());
 
     toggleIndexWheel.whenPressed(new RunIndexWheelContinuous(1));
-    toggleHighGear.whenPressed(new ToggleGear());
-    toggleNormalGear.whenPressed(new ToggleGear());
+
+    toggleIntake.whenActive(new RunIntakeContinuous());
+    toggleReverseIntake.whenActive(new ReverseIntakeContinuous());
+    toggleIntake.whenReleased(new StopIntake());
+    toggleReverseIntake.whenReleased(new StopIntake());
+
+    toggleGearSpeed.whenPressed(new ToggleGear());
+
     increaseShootSpeed.whenPressed(new IncreaseShootingSpeed());
     decreaseShootSpeed.whenPressed(new DecreaseShootingSpeed());
+
     turn90Right.whenPressed(new Turn90Right());
     turn90Left.whenPressed(new Turn90Left());
+
     readyShooter.whenPressed(new PrepareToShoot());
+    shootButton.whenPressed(new Shoot());
   }
 
   public static OI getOI() {
index 88195a4b2d89227fffaa90ea3bf2ede0cbda4572..2428aff2345244364035e842c40042626d27c74d 100644 (file)
@@ -38,6 +38,7 @@ public class RunWinch extends Command {
    */
   public RunWinch(double time, double motorVal) {
     requires(Robot.getDriveTrain());
+    timer = new Timer();
     this.time = time;
     this.motorVal = motorVal;
   }