Switch all methods of gyro to Robot class so DriveTrain does not have to be depended...
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / Robot.java
index 23412d6c41078e6a668de7eb126d6c825f308f49..18f5fd5af30a032d3267df813d7148b783f32139 100644 (file)
@@ -26,25 +26,38 @@ public class Robot extends IterativeRobot {
   // Sendable Choosers send a drop down menu to the Smart Dashboard.
   SendableChooser positionChooser;
   SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense,
-  positionFourDefense, positionFiveDefense;
+      positionFourDefense, positionFiveDefense;
 
   // Gyro stuff
-  public GyroLib gyro;
+  private final static double NANOSECONDS_PER_SECOND = 1000000000;
+  short rawValue;
+  public FirebotGyro gyro;
+
+  double initialSpeedNanoseconds;
+  double finalSpeedNanoseconds;
+  double initialSpeedSeconds;
+  double finalSpeedSeconds;
+  double deltaSpeed;
+  double degrees;
 
   @Override
   public void robotInit() {
-    driveTrain = new DriveTrain();
-    oi = new OI();
-    gyro = new GyroLib(I2C.Port.kOnboard, false);
+    // driveTrain = new DriveTrain();
+    gyro = new FirebotGyro(I2C.Port.kOnboard, (byte) 0x68);
+    // oi = new OI();
 
     shooter = new Shooter();
     scaler = new Scaler();
     defenseArm = new DefenseArm();
     intakeArm = new IntakeArm();
 
+    // Sendable Choosers allows the driver to select the position of the robot
+    // and the positions of the defenses from a drop-down menu on the Smart
+    // Dashboard
+    // make the Sendable Choosers
     initializeSendableChoosers();
     addPositionChooserOptions();
-    addDefensesToAllDefenseSendableChoosers();
+    addDefensesToAllDefenseSendableChooosers();
     sendSendableChoosersToSmartDashboard();
 
   }
@@ -66,7 +79,7 @@ public class Robot extends IterativeRobot {
     positionChooser.addObject("Position 5", 5);
   }
 
-  private void addDefensesToAllDefenseSendableChoosers() {
+  private void addDefensesToAllDefenseSendableChooosers() {
     addDefenseOptions(positionOneDefense);
     addDefenseOptions(positionTwoDefense);
     addDefenseOptions(positionThreeDefense);
@@ -95,14 +108,12 @@ public class Robot extends IterativeRobot {
         positionFourDefense);
     SmartDashboard.putData("Position Five Defense Chooser",
         positionFiveDefense);
-
     SmartDashboard.putData("Position Four Defense Chooser",
         positionFourDefense);
     SmartDashboard.putData("Position Five Defense Chooser",
         positionFiveDefense);
 
     shooter = new Shooter();
-
   }
 
   @Override
@@ -137,17 +148,11 @@ public class Robot extends IterativeRobot {
 
   @Override
   public void teleopInit() {
-
-    gyro.start();
-
   }
 
   @Override
   public void teleopPeriodic() {
     Scheduler.getInstance().run();
 
-    System.out.println("Degrees: " + gyro.getRotationZ().getAngle());
-
   }
-
 }