Minor fixes after merging meryem/auton
authorHarel Dor <hareldor@gmail.com>
Tue, 22 Mar 2016 23:16:14 +0000 (16:16 -0700)
committerHarel Dor <hareldor@gmail.com>
Tue, 22 Mar 2016 23:16:14 +0000 (16:16 -0700)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/Robot.java
src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java
src/org/usfirst/frc/team3501/robot/commands/intakearm/Photogate.java
src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java

index 14714a72bc90214a9f43892a36957b8aef64d0cd..d63f88d34c7e8f017fd43256d1c0408d566829ae 100644 (file)
@@ -37,10 +37,6 @@ public class Constants {
   }
 
   public static class DriveTrain {
-    public static final int TANK = 0;
-    public static final int ARCADE = 1;
-    public static final int DRIVE_TYPE = TANK;
-
     // Limits changes in speed during joystick driving
     public static final double kADJUST = 8;
 
@@ -64,8 +60,7 @@ public class Constants {
     public final static int ENCODER_RIGHT_A = 3;
     public final static int ENCODER_RIGHT_B = 4;
 
-    public static final double INCHES_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI)
-        / 256;
+    public static final double INCHES_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI) / 256;
 
     public static double kp = 0.013, ki = 0.000015, kd = -0.002;
     public static double encoderTolerance = 8.0;
index 1fe6b76305ef1335b6a5810acf54c252a589ac49..ee2e03da66e5fbf8ff3ab8926d64e57eaec685b8 100644 (file)
@@ -1,6 +1,5 @@
 package org.usfirst.frc.team3501.robot;
 
-import org.usfirst.frc.team3501.robot.Constants.Auton;
 import org.usfirst.frc.team3501.robot.Constants.Defense;
 import org.usfirst.frc.team3501.robot.commands.auton.ChooseStrategy;
 import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear;
@@ -31,9 +30,9 @@ public class Robot extends IterativeRobot {
     driveTrain = new DriveTrain();
     shooter = new Shooter();
     intakeArm = new IntakeArm();
+    photogate = new Photogate();
 
     oi = new OI();
-    photogate = new Photogate();
 
     defenseChooser = new SendableChooser();
     addDefenseOptions(defenseChooser);
@@ -52,16 +51,12 @@ public class Robot extends IterativeRobot {
   private void addDefenseOptions(SendableChooser chooser) {
     chooser.addDefault("Portcullis", Defense.PORTCULLIS);
     chooser.addObject("Sally Port", Defense.SALLY_PORT);
-    chooser.addObject("Rough Terrain" + Auton.ROUGH_TERRAIN_SPEED + " "
-        + Auton.ROUGH_TERRAIN_TIME, Defense.ROUGH_TERRAIN);
-    chooser.addObject("Low Bar" + " Will probably work...", Defense.LOW_BAR);
+    chooser.addObject("Rough Terrain", Defense.ROUGH_TERRAIN);
+    chooser.addObject("Low Bar", Defense.LOW_BAR);
     chooser.addObject("Chival De Frise", Defense.CHIVAL_DE_FRISE);
     chooser.addObject("Drawbridge", Defense.DRAWBRIDGE);
-    chooser.addObject("Moat" + Auton.MOAT_SPEED + " " + Auton.MOAT_TIME,
-        Defense.MOAT);
-    chooser.addObject(
-        "Rock Wall" + Auton.ROCK_WALL_SPEED + " " + Auton.ROCK_WALL_TIME,
-        Defense.ROCK_WALL);
+    chooser.addObject("Moat", Defense.MOAT);
+    chooser.addObject("Rock Wall", Defense.ROCK_WALL);
     chooser.addObject("No Auton", Defense.NONE);
   }
 
index e4c1d75bc360afdcdb9e4ab9d7177ae61c2179bc..89cac8bced8cb93da8f4fd718ec257b67163806b 100644 (file)
@@ -38,7 +38,7 @@ public class TimeDrive extends Command {
 
   @Override
   protected boolean isFinished() {
-    return time >= time;
+    return timer.get() >= time;
   }
 
   @Override
index aff5fc2d623a2b2a6ee5a2003f49c34d34e87df8..bf0c7b07fb88da5363e331b0c4ff511382e316dd 100644 (file)
@@ -7,7 +7,7 @@ import edu.wpi.first.wpilibj.AnalogInput;
  * reflective method to sense the presence of the boulder within the robot's
  * shooting chamber. This class specifically checks for the ball's presence
  * using a threshold of voltages outputted from the phototransistor.
- *
+ * 
  * @author niyatisriram
  */
 public class Photogate extends AnalogInput {
@@ -17,22 +17,19 @@ public class Photogate extends AnalogInput {
 
   /***
    * The constructor inputs the channel of the transistor and the threshold
-   * value.
-   * The threshold is a specific value, representing the outputted voltage of
-   * the phototransistor. This value will be somewhere within the range [0,
-   * 4095] Find the value by testing and finding an average value for which the
-   * ball is present when the output is greater, and absent when the output is
-   * less.
+   * value. The threshold is a specific value, representing the outputted
+   * voltage of the phototransistor. This value will be somewhere within the
+   * range [0, 4095] Find the value by testing and finding an average value for
+   * which the ball is present when the output is greater, and absent when the
+   * output is less.
    */
   public Photogate() {
     super(0);
-    this.threshold = threshold;
-
   }
 
   /***
-   * @return whether the ball is present or not
-   *         USE TO DECIDE WHEN OUTTAKE NEEDS TO HAPPEN FOR BALL TO BE SECURE
+   * @return whether the ball is present or not USE TO DECIDE WHEN OUTTAKE NEEDS
+   *         TO HAPPEN FOR BALL TO BE SECURE
    */
   public boolean isBallPresent() {
     if (this.getVoltage() > threshold) {
index 1a4e6e5b96c04dfc58689e377aa2ec5ba9dd1ae8..a0134a43a7fbe0d6c792924c1da98dabff741c14 100644 (file)
@@ -194,35 +194,15 @@ public class DriveTrain extends PIDSubsystem {
   }
 
   public void joystickDrive(double left, double right) {
-    int type = Constants.DriveTrain.DRIVE_TYPE;
-
     // Handle flipping of the "front" of the robot
     double k = (isFlipped() ? -1 : 1);
 
-    robotDrive.tankDrive(-left, -right);
-
-    // if (type == Constants.DriveTrain.TANK) {
-    // // TODO Test this for negation and for voltage vs. [-1,1] outputs
-    // double leftSpeed = (-frontLeft.get() + -rearLeft.get()) / 2;
-    // double rightSpeed = (-frontRight.get() + -rearRight.get()) / 2;
-    // left = ((Constants.DriveTrain.kADJUST - 1) * leftSpeed + left)
-    // / Constants.DriveTrain.kADJUST;
-    // right = ((Constants.DriveTrain.kADJUST - 1) * rightSpeed + right)
-    // / Constants.DriveTrain.kADJUST;
-    // robotDrive.tankDrive(-left * k, -right * k);
-    // } else if (type == Constants.DriveTrain.ARCADE) {
-    // double speed = (-frontLeft.get() + -rearLeft.get() + -frontRight.get() +
-    // -rearRight
-    // .get()) / 2;
-    // left = ((Constants.DriveTrain.kADJUST - 1) * speed + left)
-    // / Constants.DriveTrain.kADJUST;
-    // robotDrive.arcadeDrive(left * k, right);
-    // }
+    robotDrive.tankDrive(-left * k, -right * k);
   }
 
   public void setMotorSpeeds(double left, double right) {
     double k = (isFlipped() ? -1 : 1);
-    robotDrive.tankDrive(-left, -right);
+    robotDrive.tankDrive(-left * k, -right * k);
   }
 
   /**