Resurrect dead commits deletd by merge conflict with hersh
authorKevin Zhang <icestormf1@gmail.com>
Mon, 15 Feb 2016 20:08:01 +0000 (12:08 -0800)
committerKevin Zhang <icestormf1@gmail.com>
Mon, 15 Feb 2016 20:08:01 +0000 (12:08 -0800)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java
src/org/usfirst/frc/team3501/robot/commands/shooter/runShooter.java
src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java

index 9c666016ae1b768cafebd34e3512bb890830bb6b..8176e5df0cc3d123717a021a70a22a0dfbaff04b 100644 (file)
@@ -93,8 +93,8 @@ public class Constants {
 
   public static class Shooter {
     public static final int PORT = 0;
-    public static final int PUNCH_FORWARD_PORT = 0;
-    public static final int PUNCH_REVERSE_PORT = 1;
+    public static final int PUNCH_FORWARD = 0;
+    public static final int PUNCH_REVERSE = 1;
     public static final int ANGLE_ADJUSTER_PORT = 0;
 
     public static final DoubleSolenoid.Value punch = DoubleSolenoid.Value.kForward;
@@ -103,6 +103,11 @@ public class Constants {
     // Encoder port
     public static final int ENCODER_PORT_A = 0;
     public static final int ENCODER_PORT_B = 0;
+    public static final int HOOD_FORWARD = 2;
+    public static final int HOOD_REVERSE = 3;
+
+    public static final Value open = Value.kForward;
+    public static final Value closed = Value.kReverse;
 
     public static enum State {
       RUNNING, STOPPED;
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java
new file mode 100644 (file)
index 0000000..deb2c04
--- /dev/null
@@ -0,0 +1,34 @@
+package org.usfirst.frc.team3501.robot.commands.shooter;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class Punch extends Command {
+
+  @Override
+  protected void initialize() {
+    Robot.shooter.punch();
+  }
+
+  @Override
+  protected void execute() {
+
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+    Robot.shooter.retractPunch();
+  }
+
+  @Override
+  protected void interrupted() {
+
+  }
+
+}
index ec5a11d59e9feacbb9ad8930699ad50cd3aefef9..e136c739ae78e74b1da7503258ffa29828fae850 100755 (executable)
@@ -1,30 +1,17 @@
 package org.usfirst.frc.team3501.robot.commands.shooter;
 
-import edu.wpi.first.wpilibj.command.Command;
+import org.usfirst.frc.team3501.robot.commands.auton.AimAndAlign;
 
-public class Shoot extends Command {
+import edu.wpi.first.wpilibj.command.CommandGroup;
+import edu.wpi.first.wpilibj.command.WaitCommand;
 
-       public Shoot() {
-       }
+public class Shoot extends CommandGroup {
 
-       @Override
-       protected void initialize() {
-       }
-
-       @Override
-       protected void execute() {
-       }
-
-       @Override
-       protected boolean isFinished() {
-               return false;
-       }
-
-       @Override
-       protected void end() {
-       }
-
-       @Override
-       protected void interrupted() {
-       }
+  public Shoot() {
+    addSequential(new AimAndAlign());
+    addSequential(new WaitCommand(3.0));
+    addSequential(new runShooter());
+    addSequential(new WaitCommand(3.0));
+    addSequential(new Punch());
+  }
 }
index b69ae16742a4b47668f9fc9e254831b060e48096..4315ae1932da88e38dbf6cab3fdf09705e9da09c 100644 (file)
@@ -29,6 +29,7 @@ public class runShooter extends Command {
 
   @Override
   protected void end() {
+    Robot.shooter.stop();
   }
 
   @Override
index ee2742d2b0209e88c0cd18cd0b54fbebcd9c070b..40581afee5a3a7e523b82d1beb2d6aa010971020 100755 (executable)
@@ -22,15 +22,15 @@ import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class Shooter extends Subsystem {
   private CANTalon shooter;
-  private CANTalon angleAdjuster;
-  private DoubleSolenoid punch;
+  private DoubleSolenoid hood, punch;
   private Encoder encoder;
 
   public Shooter() {
     shooter = new CANTalon(Constants.Shooter.PORT);
-    angleAdjuster = new CANTalon(Constants.Shooter.ANGLE_ADJUSTER_PORT);
-    punch = new DoubleSolenoid(Constants.Shooter.PUNCH_FORWARD_PORT,
-        Constants.Shooter.PUNCH_REVERSE_PORT);
+    hood = new DoubleSolenoid(Constants.Shooter.HOOD_FORWARD,
+        Constants.Shooter.HOOD_REVERSE);
+    punch = new DoubleSolenoid(Constants.Shooter.PUNCH_FORWARD,
+        Constants.Shooter.PUNCH_REVERSE);
 
     encoder = new Encoder(Constants.Shooter.ENCODER_PORT_A,
         Constants.Shooter.ENCODER_PORT_B, false, EncodingType.k4X);
@@ -77,6 +77,18 @@ public class Shooter extends Subsystem {
     punch.set(Constants.Shooter.retract);
   }
 
+  public boolean isHoodOpen() {
+    return hood.get() == Constants.Shooter.open;
+  }
+
+  public void openHood() {
+    hood.set(Constants.Shooter.open);
+  }
+
+  public void closeHood() {
+    hood.set(Constants.Shooter.closed);
+  }
+
   @Override
   protected void initDefaultCommand() {
   }