add buttons and commands for testing
authorCindy Zhang <cindyzyx9@gmail.com>
Wed, 17 Feb 2016 20:17:17 +0000 (12:17 -0800)
committerCindy Zhang <cindyzyx9@gmail.com>
Tue, 23 Feb 2016 00:22:21 +0000 (16:22 -0800)
src/org/usfirst/frc/team3501/robot/OI.java
src/org/usfirst/frc/team3501/robot/Robot.java
src/org/usfirst/frc/team3501/robot/commands/shooter/Test1.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/shooter/Test2.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/shooter/Test3.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/shooter/Test4.java [new file with mode: 0644]

index aa58ffccde0c62a84520a6426eeaf1a3154be266..fa7c3ec56ae5a6cb5fd334e3687d9b629e08fced 100644 (file)
@@ -1,23 +1,10 @@
 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.intakearm.MoveIntakeArmToAngle;
-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 org.usfirst.frc.team3501.robot.subsystems.IntakeArm;
+import org.usfirst.frc.team3501.robot.commands.shooter.Test1;
+import org.usfirst.frc.team3501.robot.commands.shooter.Test2;
+import org.usfirst.frc.team3501.robot.commands.shooter.Test3;
+import org.usfirst.frc.team3501.robot.commands.shooter.Test4;
 
-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;
@@ -25,118 +12,138 @@ import edu.wpi.first.wpilibj.buttons.JoystickButton;
 public class OI {
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
-
-  // first column of arcade buttons - getting past defenses
-  public static DigitalButton passPortcullis;
-  public static DigitalButton passChevalDeFrise;
-  public static DigitalButton passDrawbridge;
-  public static DigitalButton passSallyPort;
-
-  // second column of arcade buttons - different angles for intake arm
-  // TO DO: change position numbers to angle values (?)
-  public static DigitalButton lowerChevalDeFrise;
-  public static DigitalButton moveToIntakeBoulder;
-  public static DigitalButton poiseAboveChevalDeFrise;
-  public static DigitalButton moveIntakeArmInsideRobot;
-
-  // left joystick buttons
-  public static Button toggleShooter;
-  public static Button SpinRobot180_1; // both do the same thing, just two
-  public static Button SpinRobot180_2; // different buttons
-  public static Button compactRobot_1;
-  public static Button compactRobot_2;
-
-  // right joystick buttons
-  public static Button intakeBoulder;
-  public static Button shootBoulder;
-
-  // button to change robot to the scaling mode
-  public static DigitalButton toggleScaling;
+  public static Button test1;
+  public static Button test2;
+  public static Button test3;
+  public static Button test4;
+
+  // // first column of arcade buttons - getting past defenses
+  // public static DigitalButton passPortcullis;
+  // public static DigitalButton passChevalDeFrise;
+  // public static DigitalButton passDrawbridge;
+  // public static DigitalButton passSallyPort;
+  //
+  // // second column of arcade buttons - different angles for intake arm
+  // // TO DO: change position numbers to angle values (?)
+  // public static DigitalButton lowerChevalDeFrise;
+  // public static DigitalButton moveToIntakeBoulder;
+  // public static DigitalButton poiseAboveChevalDeFrise;
+  // public static DigitalButton moveIntakeArmInsideRobot;
+  //
+  // // left joystick buttons
+  // public static Button toggleShooter;
+  // public static Button SpinRobot180_1; // both do the same thing, just two
+  // public static Button SpinRobot180_2; // different buttons
+  // public static Button compactRobot_1;
+  // public static Button compactRobot_2;
+  //
+  // // right joystick buttons
+  // public static Button intakeBoulder;
+  // public static Button shootBoulder;
+  //
+  // // button to change robot to the scaling mode
+  // public static DigitalButton toggleScaling;
 
   public OI() {
     leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
     rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
 
-    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_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));
-    lowerChevalDeFrise.whenPressed(new MoveIntakeArmToAngle(
-        IntakeArm.potAngles[0], IntakeArm.moveIntakeArmSpeed));
-
-    moveToIntakeBoulder = new DigitalButton(
-        new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_TWO_PORT));
-    moveToIntakeBoulder.whenPressed(new MoveIntakeArmToAngle(
-        IntakeArm.potAngles[1], IntakeArm.moveIntakeArmSpeed));
-
-    poiseAboveChevalDeFrise = new DigitalButton(
-        new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_THREE_PORT));
-    poiseAboveChevalDeFrise.whenPressed(new MoveIntakeArmToAngle(
-        IntakeArm.potAngles[2], IntakeArm.moveIntakeArmSpeed));
-
-    moveIntakeArmInsideRobot = new DigitalButton(
-        new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_FOUR_PORT));
-    moveIntakeArmInsideRobot.whenPressed(new MoveIntakeArmToAngle(
-        IntakeArm.potAngles[3], IntakeArm.moveIntakeArmSpeed));
-
-    toggleShooter = new JoystickButton(leftJoystick,
-        Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT);
-    SpinRobot180_1 = new JoystickButton(leftJoystick,
+    test1 = 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());
+    test1.whenPressed(new Test1());
 
-    compactRobot_1 = new JoystickButton(leftJoystick,
+    test2 = new JoystickButton(leftJoystick,
         Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT);
-    compactRobot_2 = new JoystickButton(leftJoystick,
-        Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT);
-
-    intakeBoulder = new JoystickButton(rightJoystick,
-        Constants.OI.RIGHT_JOYSTICK_TRIGGER_PORT);
-    shootBoulder = new JoystickButton(rightJoystick,
-        Constants.OI.RIGHT_JOYSTICK_THUMB_PORT);
+    test2.whenPressed(new Test2());
 
-    toggleScaling = new DigitalButton(
-        new DigitalInput(Constants.OI.TOGGLE_SCALING_PORT));
-    toggleScaling.whenPressed(new ToggleScaling());
-
-    if (!Constants.Scaler.SCALING) {
-      toggleShooter.toggleWhenPressed(new runShooter());
-      compactRobot_1.whenPressed(new CompactRobot());
-      compactRobot_2.whenPressed(new CompactRobot());
-
-      intakeBoulder.whenPressed(new IntakeBall());
-      shootBoulder.whenPressed(new Shoot());
-
-    } 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());
+    test3 = new JoystickButton(leftJoystick,
+        Constants.OI.SPIN2_PORT);
+    test3.whenPressed(new Test3());
 
-      intakeBoulder.whenReleased(new StopWinch());
-      shootBoulder.whenPressed(new ExtendLift());
-    }
+    test4 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT);
+    test4.whenPressed(new Test4());
+
+    // 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_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));
+    // lowerChevalDeFrise.whenPressed(new MoveIntakeArmToAngle(
+    // IntakeArm.potAngles[0], IntakeArm.moveIntakeArmSpeed));
+    //
+    // moveToIntakeBoulder = new DigitalButton(
+    // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_TWO_PORT));
+    // moveToIntakeBoulder.whenPressed(new MoveIntakeArmToAngle(
+    // IntakeArm.potAngles[1], IntakeArm.moveIntakeArmSpeed));
+    //
+    // poiseAboveChevalDeFrise = new DigitalButton(
+    // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_THREE_PORT));
+    // poiseAboveChevalDeFrise.whenPressed(new MoveIntakeArmToAngle(
+    // IntakeArm.potAngles[2], IntakeArm.moveIntakeArmSpeed));
+    //
+    // moveIntakeArmInsideRobot = new DigitalButton(
+    // new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_FOUR_PORT));
+    // moveIntakeArmInsideRobot.whenPressed(new MoveIntakeArmToAngle(
+    // IntakeArm.potAngles[3], IntakeArm.moveIntakeArmSpeed));
+    //
+    // toggleShooter = new JoystickButton(leftJoystick,
+    // Constants.OI.LEFT_JOYSTICK_TRIGGER_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,
+    // Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT);
+    //
+    // intakeBoulder = new JoystickButton(rightJoystick,
+    // Constants.OI.RIGHT_JOYSTICK_TRIGGER_PORT);
+    // shootBoulder = new JoystickButton(rightJoystick,
+    // Constants.OI.RIGHT_JOYSTICK_THUMB_PORT);
+    //
+    // toggleScaling = new DigitalButton(
+    // new DigitalInput(Constants.OI.TOGGLE_SCALING_PORT));
+    // toggleScaling.whenPressed(new ToggleScaling());
+    //
+    // if (!Constants.Scaler.SCALING) {
+    // toggleShooter.toggleWhenPressed(new runShooter());
+    // compactRobot_1.whenPressed(new CompactRobot());
+    // compactRobot_2.whenPressed(new CompactRobot());
+    //
+    // intakeBoulder.whenPressed(new IntakeBall());
+    // shootBoulder.whenPressed(new Shoot());
+    //
+    // } 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.whenReleased(new StopWinch());
+    // shootBoulder.whenPressed(new ExtendLift());
+    // }
   }
 }
index 80d786762994a72067d56a36d2d4c8ce7d1cb29e..8634d530232cc90dee38e471c5194b623e4f583b 100644 (file)
@@ -29,17 +29,17 @@ public class Robot extends IterativeRobot {
 
   @Override
   public void robotInit() {
-    driveTrain = new DriveTrain();
+    // driveTrain = new DriveTrain();
     oi = new OI();
 
-    shooter = new Shooter();
-    scaler = new Scaler();
-    intakeArm = new IntakeArm();
-
-    initializeSendableChoosers();
-    addPositionChooserOptions();
-    addDefensesToAllDefenseSendableChoosers();
-    sendSendableChoosersToSmartDashboard();
+    // shooter = new Shooter();
+    // scaler = new Scaler();
+    // intakeArm = new IntakeArm();
+    //
+    // initializeSendableChoosers();
+    // addPositionChooserOptions();
+    // addDefensesToAllDefenseSendableChoosers();
+    // sendSendableChoosersToSmartDashboard();
 
   }
 
@@ -103,23 +103,23 @@ public class Robot extends IterativeRobot {
   public void autonomousInit() {
     Scheduler.getInstance().run();
 
-    // get options chosen from drop down menu
-    Integer chosenPosition = (Integer) positionChooser.getSelected();
-    Integer chosenDefense = 0;
-
-    if (chosenPosition == 1)
-      chosenDefense = (Integer) positionOneDefense.getSelected();
-    else if (chosenPosition == 2)
-      chosenDefense = (Integer) positionTwoDefense.getSelected();
-    else if (chosenPosition == 3)
-      chosenDefense = (Integer) positionThreeDefense.getSelected();
-    else if (chosenPosition == 4)
-      chosenDefense = (Integer) positionFourDefense.getSelected();
-    else if (chosenPosition == 5)
-      chosenDefense = (Integer) positionFiveDefense.getSelected();
-
-    System.out.println("Chosen Position: " + chosenPosition);
-    System.out.println("Chosen Defense: " + chosenDefense);
+    // // get options chosen from drop down menu
+    // Integer chosenPosition = (Integer) positionChooser.getSelected();
+    // Integer chosenDefense = 0;
+    //
+    // if (chosenPosition == 1)
+    // chosenDefense = (Integer) positionOneDefense.getSelected();
+    // else if (chosenPosition == 2)
+    // chosenDefense = (Integer) positionTwoDefense.getSelected();
+    // else if (chosenPosition == 3)
+    // chosenDefense = (Integer) positionThreeDefense.getSelected();
+    // else if (chosenPosition == 4)
+    // chosenDefense = (Integer) positionFourDefense.getSelected();
+    // else if (chosenPosition == 5)
+    // chosenDefense = (Integer) positionFiveDefense.getSelected();
+    //
+    // System.out.println("Chosen Position: " + chosenPosition);
+    // System.out.println("Chosen Defense: " + chosenDefense);
   }
 
   @Override
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Test1.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Test1.java
new file mode 100644 (file)
index 0000000..f598dec
--- /dev/null
@@ -0,0 +1,36 @@
+package org.usfirst.frc.team3501.robot.commands.shooter;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/**
+ *
+ */
+public class Test1 extends Command {
+
+    public Test1() {
+        // Use requires() here to declare subsystem dependencies
+        // eg. requires(chassis);
+    }
+
+    // Called just before this Command runs the first time
+    protected void initialize() {
+    }
+
+    // Called repeatedly when this Command is scheduled to run
+    protected void execute() {
+    }
+
+    // Make this return true when this Command no longer needs to run execute()
+    protected boolean isFinished() {
+        return false;
+    }
+
+    // Called once after isFinished returns true
+    protected void end() {
+    }
+
+    // Called when another command which requires one or more of the same
+    // subsystems is scheduled to run
+    protected void interrupted() {
+    }
+}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Test2.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Test2.java
new file mode 100644 (file)
index 0000000..51ca6a9
--- /dev/null
@@ -0,0 +1,36 @@
+package org.usfirst.frc.team3501.robot.commands.shooter;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/**
+ *
+ */
+public class Test2 extends Command {
+
+    public Test2() {
+        // Use requires() here to declare subsystem dependencies
+        // eg. requires(chassis);
+    }
+
+    // Called just before this Command runs the first time
+    protected void initialize() {
+    }
+
+    // Called repeatedly when this Command is scheduled to run
+    protected void execute() {
+    }
+
+    // Make this return true when this Command no longer needs to run execute()
+    protected boolean isFinished() {
+        return false;
+    }
+
+    // Called once after isFinished returns true
+    protected void end() {
+    }
+
+    // Called when another command which requires one or more of the same
+    // subsystems is scheduled to run
+    protected void interrupted() {
+    }
+}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Test3.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Test3.java
new file mode 100644 (file)
index 0000000..28afa21
--- /dev/null
@@ -0,0 +1,36 @@
+package org.usfirst.frc.team3501.robot.commands.shooter;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/**
+ *
+ */
+public class Test3 extends Command {
+
+    public Test3() {
+        // Use requires() here to declare subsystem dependencies
+        // eg. requires(chassis);
+    }
+
+    // Called just before this Command runs the first time
+    protected void initialize() {
+    }
+
+    // Called repeatedly when this Command is scheduled to run
+    protected void execute() {
+    }
+
+    // Make this return true when this Command no longer needs to run execute()
+    protected boolean isFinished() {
+        return false;
+    }
+
+    // Called once after isFinished returns true
+    protected void end() {
+    }
+
+    // Called when another command which requires one or more of the same
+    // subsystems is scheduled to run
+    protected void interrupted() {
+    }
+}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Test4.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Test4.java
new file mode 100644 (file)
index 0000000..bc2e5cd
--- /dev/null
@@ -0,0 +1,36 @@
+package org.usfirst.frc.team3501.robot.commands.shooter;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/**
+ *
+ */
+public class Test4 extends Command {
+
+    public Test4() {
+        // Use requires() here to declare subsystem dependencies
+        // eg. requires(chassis);
+    }
+
+    // Called just before this Command runs the first time
+    protected void initialize() {
+    }
+
+    // Called repeatedly when this Command is scheduled to run
+    protected void execute() {
+    }
+
+    // Make this return true when this Command no longer needs to run execute()
+    protected boolean isFinished() {
+        return false;
+    }
+
+    // Called once after isFinished returns true
+    protected void end() {
+    }
+
+    // Called when another command which requires one or more of the same
+    // subsystems is scheduled to run
+    protected void interrupted() {
+    }
+}