Fix merge conflicts
authorniyatisriram <niyatisriram@gmail.com>
Wed, 17 Feb 2016 21:01:46 +0000 (13:01 -0800)
committerniyatisriram <niyatisriram@gmail.com>
Wed, 17 Feb 2016 21:01:46 +0000 (13:01 -0800)
notes/niyati.org [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/auton/CompactRobot.java
src/org/usfirst/frc/team3501/robot/commands/intakearm/ExpelBall.java
src/org/usfirst/frc/team3501/robot/commands/intakearm/IntakeBall.java
src/org/usfirst/frc/team3501/robot/commands/scaler/ToggleScaling.java
src/org/usfirst/frc/team3501/robot/commands/shooter/ExtendPunch.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java [deleted file]
src/org/usfirst/frc/team3501/robot/commands/shooter/RetractPunch.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java
src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java

diff --git a/notes/niyati.org b/notes/niyati.org
new file mode 100644 (file)
index 0000000..679a02b
--- /dev/null
@@ -0,0 +1,6 @@
+TODO:
+Put a boolean constant in Constants like usePhotogate and a method in shooter that changes / toggles the constant(constant=!constant)
+
+-shooter should have two versions one uses photogate and one does not 
+    - one that does use photogate tests for ballInside and then shoots
+- one that doesn't does not use this test.
index bde8aba299ef18f44feb06183157991eaab1b7d1..1dac8a77d9b81c560d1107d70862f94732e0029e 100644 (file)
@@ -1,44 +1,19 @@
 package org.usfirst.frc.team3501.robot.commands.auton;
 
-import edu.wpi.first.wpilibj.command.Command;
+import org.usfirst.frc.team3501.robot.Robot;
+import org.usfirst.frc.team3501.robot.commands.intakearm.MoveIntakeArmToAngle;
+import org.usfirst.frc.team3501.robot.subsystems.IntakeArm;
+
+import edu.wpi.first.wpilibj.command.CommandGroup;
 
 /**
  *
  */
-public class CompactRobot extends Command {
+public class CompactRobot extends CommandGroup {
 
   public CompactRobot() {
-    // Use requires() here to declare subsystem dependencies
-    // eg. requires(chassis);
-  }
-
-  // Called just before this Command runs the first time
-  @Override
-  protected void initialize() {
-    // move hood down
-    // move intakeArm out
-    // move defenseArm down
-  }
-
-  // Called repeatedly when this Command is scheduled to run
-  @Override
-  protected void execute() {
-  }
-
-  // Make this return true when this Command no longer needs to run execute()
-  @Override
-  protected boolean isFinished() {
-    return false;
-  }
-
-  // Called once after isFinished returns true
-  @Override
-  protected void end() {
-  }
-
-  // Called when another command which requires one or more of the same
-  // subsystems is scheduled to run
-  @Override
-  protected void interrupted() {
+    addSequential(new MoveIntakeArmToAngle(IntakeArm.potAngles[3],
+        IntakeArm.moveIntakeArmSpeed));
+    Robot.shooter.lowerHood();
   }
 }
index 83ee34e60fa285c05e2c046ce4ba1805b98f1842..04fa12687d012421bcc9ab2996e01665bc2208e4 100644 (file)
@@ -28,7 +28,7 @@ public class ExpelBall extends Command {
   @Override
   protected void initialize() {
     this.setTimeout(TIMEOUT_AMOUNT);
-    if (Robot.photogate.isBallPresent())
+    if (Robot.shooter.isBallInside())
       Robot.intakeArm.outputBall();
   }
 
@@ -38,7 +38,7 @@ public class ExpelBall extends Command {
 
   @Override
   protected boolean isFinished() {
-    return (this.isTimedOut() || !Robot.photogate.isBallPresent());
+    return (this.isTimedOut() || !Robot.shooter.isBallInside());
   }
 
   @Override
index 8eda8dba52c2aaa1ea16920d9f54d665cc314803..7966c6144b730ecefc61dc9e87f0a076c84dd8f5 100644 (file)
@@ -28,7 +28,7 @@ public class IntakeBall extends Command {
   @Override
   protected void initialize() {
     this.setTimeout(TIMEOUT_AMOUNT);
-    if (!Robot.photogate.isBallPresent())
+    if (!Robot.shooter.isBallInside())
       Robot.intakeArm.intakeBall();
 
   }
@@ -40,7 +40,7 @@ public class IntakeBall extends Command {
 
   @Override
   protected boolean isFinished() {
-    return (this.isTimedOut() || Robot.photogate.isBallPresent());
+    return (this.isTimedOut() || Robot.shooter.isBallInside());
   }
 
   @Override
index a3ee9d4f02bb9c4b59485815ba1c5f2367672234..5f5a64ccb2e8e1d5016c48d8fc03ce52ac37538f 100644 (file)
@@ -1,35 +1,14 @@
 package org.usfirst.frc.team3501.robot.commands.scaler;
 
 import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.commands.auton.CompactRobot;
 
-import edu.wpi.first.wpilibj.command.Command;
+import edu.wpi.first.wpilibj.command.CommandGroup;
 
-public class ToggleScaling extends Command {
+public class ToggleScaling extends CommandGroup {
   public ToggleScaling() {
-
-  }
-
-  @Override
-  protected void initialize() {
     Constants.Scaler.SCALING = !Constants.Scaler.SCALING;
-  }
-
-  @Override
-  protected void execute() {
-
-  }
-
-  @Override
-  protected boolean isFinished() {
-    return true;
-  }
-
-  @Override
-  protected void end() {
-  }
-
-  @Override
-  protected void interrupted() {
-    end();
+    if (Constants.Scaler.SCALING)
+      addSequential(new CompactRobot());
   }
 }
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/ExtendPunch.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/ExtendPunch.java
new file mode 100644 (file)
index 0000000..a3cb813
--- /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 ExtendPunch extends Command {
+
+  @Override
+  protected void initialize() {
+    Robot.shooter.extendPunch();
+  }
+
+  @Override
+  protected void execute() {
+
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+
+  }
+
+  @Override
+  protected void interrupted() {
+
+  }
+
+}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Punch.java
deleted file mode 100644 (file)
index 36ef785..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-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.extendPunch();
-  }
-
-  @Override
-  protected void execute() {
-
-  }
-
-  @Override
-  protected boolean isFinished() {
-    return true;
-  }
-
-  @Override
-  protected void end() {
-    Robot.shooter.retractPunch();
-  }
-
-  @Override
-  protected void interrupted() {
-
-  }
-
-}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/RetractPunch.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/RetractPunch.java
new file mode 100644 (file)
index 0000000..c977a2e
--- /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 RetractPunch extends Command {
+
+  @Override
+  protected void initialize() {
+    Robot.shooter.retractPunch();
+  }
+
+  @Override
+  protected void execute() {
+
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+
+  }
+
+  @Override
+  protected void interrupted() {
+
+  }
+
+}
index e136c739ae78e74b1da7503258ffa29828fae850..90105e0c9368663df2ba0a69d131e5c36481cc03 100755 (executable)
@@ -1,5 +1,5 @@
 package org.usfirst.frc.team3501.robot.commands.shooter;
-
+import org.usfirst.frc.team3501.robot.Robot;
 import org.usfirst.frc.team3501.robot.commands.auton.AimAndAlign;
 
 import edu.wpi.first.wpilibj.command.CommandGroup;
@@ -7,11 +7,24 @@ import edu.wpi.first.wpilibj.command.WaitCommand;
 
 public class Shoot extends CommandGroup {
 
+  public boolean usePhotogate;
+
   public Shoot() {
     addSequential(new AimAndAlign());
     addSequential(new WaitCommand(3.0));
     addSequential(new runShooter());
     addSequential(new WaitCommand(3.0));
-    addSequential(new Punch());
+    if (Robot.shooter.usePhotogate()) {
+      if (Robot.shooter.isBallInside()) {
+        addSequential(new ExtendPunch());
+        addSequential(new WaitCommand(5.0));
+        addSequential(new RetractPunch());
+      }
+    } else {
+      addSequential(new ExtendPunch());
+      addSequential(new WaitCommand(5.0));
+      addSequential(new RetractPunch());
+    }
+
   }
 }
index 0d9187a441b6a734e4fc0e61ef3d848a7034d16f..6e0c7acfb443a9106e46ed27d0c40e985732ebf4 100755 (executable)
@@ -26,6 +26,7 @@ public class Shooter extends Subsystem {
   private Encoder encoder;
   private Lidar lidar;
   private Photogate photogate;
+  private boolean usePhotoGate;
 
   public Shooter() {
     shooter = new CANTalon(Constants.Shooter.PORT);
@@ -38,6 +39,7 @@ public class Shooter extends Subsystem {
 
     encoder = new Encoder(Constants.Shooter.ENCODER_PORT_A,
         Constants.Shooter.ENCODER_PORT_B, false, EncodingType.k4X);
+    usePhotoGate = true;
   }
 
   /***
@@ -49,7 +51,12 @@ public class Shooter extends Subsystem {
    */
 
   public boolean isBallInside() {
-    return photogate.isBallPresent();
+
+    if (usePhotogate())
+      return photogate.isBallPresent();
+    else
+      return true;
+
   }
 
   public void setSpeed(double speed) {
@@ -113,6 +120,14 @@ public class Shooter extends Subsystem {
     return false;
   }
 
+  public boolean usePhotogate() {
+    return this.usePhotoGate;
+  }
+
+  public void togglePhotoGate() {
+    this.usePhotoGate = !this.usePhotoGate;
+  }
+
   @Override
   protected void initDefaultCommand() {
   }