Remake gyro methods to print out rawValue of the gyro Rotation of Z axis
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / subsystems / DriveTrain.java
index e7610ce1672c3bc2927c41b1cbd0501f68a561bd..c42cf1704e6094681592551bff2ff23e2dc17dbd 100644 (file)
@@ -1,8 +1,10 @@
 package org.usfirst.frc.team3501.robot.subsystems;
 
 import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.FirebotGyro;
 import org.usfirst.frc.team3501.robot.Lidar;
 
+import edu.wpi.first.wpilibj.AnalogInput;
 import edu.wpi.first.wpilibj.CANTalon;
 import edu.wpi.first.wpilibj.CounterBase.EncodingType;
 import edu.wpi.first.wpilibj.Encoder;
@@ -25,11 +27,18 @@ public class DriveTrain extends Subsystem {
   public final static double INCHES_PER_PULSE = (((Math.PI)
       * OUTPUT_SPROCKET_DIAMETER / PULSES_PER_ROTATION)
       / WHEEL_SPROCKET_DIAMETER) * WHEEL_DIAMETER;
+
   // Drivetrain specific constants that relate to the PID controllers
   private final static double Kp = 1.0, Ki = 0.0,
       Kd = 0.0 * (OUTPUT_SPROCKET_DIAMETER / PULSES_PER_ROTATION)
           / (WHEEL_SPROCKET_DIAMETER) * WHEEL_DIAMETER;
 
+  public AnalogInput channel;
+
+  // Gyro stuff
+  double rawValue;
+  public FirebotGyro gyro;
+
   public DriveTrain() {
     frontLeft = new CANTalon(Constants.DriveTrain.FRONT_LEFT);
     frontRight = new CANTalon(Constants.DriveTrain.FRONT_RIGHT);
@@ -46,6 +55,8 @@ public class DriveTrain extends Subsystem {
     leftEncoder.setDistancePerPulse(INCHES_PER_PULSE);
     rightEncoder.setDistancePerPulse(INCHES_PER_PULSE);
 
+    gyro = new FirebotGyro(I2C.Port.kOnboard, (byte) 0x68);
+    gyro.initialize();
   }
 
   @Override
@@ -97,5 +108,4 @@ public class DriveTrain extends Subsystem {
     this.rearLeft.set(leftSpeed);
     this.rearRight.set(-rightSpeed);
   }
-
 }