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 6c004b42eea16bd0afd9db354925939176b5bd0e..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;
@@ -31,6 +33,12 @@ public class DriveTrain extends Subsystem {
       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);
@@ -47,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