update code
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / subsystems / DriveTrain.java
index 0a3dea262175bb2b2474772dd88990d2d92bc2ee..83f48d50d650ee0de3e95ac40dbee35e222c4e74 100644 (file)
@@ -2,6 +2,7 @@ package org.usfirst.frc.team3501.robot.subsystems;
 
 import org.usfirst.frc.team3501.robot.Constants;
 import org.usfirst.frc.team3501.robot.commands.driving.JoystickDrive;
+import org.usfirst.frc.team3501.robot.utils.PIDController;
 
 import com.ctre.CANTalon;
 
@@ -13,7 +14,8 @@ import edu.wpi.first.wpilibj.RobotDrive;
 import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class DriveTrain extends Subsystem {
-  public static double driveP = 0.012, driveI = 0.0011, driveD = -0.002;
+
+  public static double driveP, driveI, driveD;
   public static double turnP = 0.004, turnI = 0.0013, turnD = -0.005;
   public static double driveStraightGyroP = 0.01;
 
@@ -37,7 +39,12 @@ public class DriveTrain extends Subsystem {
 
   public boolean shouldBeClimbing = false;
 
+  private PIDController driveController;
+
   private DriveTrain() {
+
+    driveController = new PIDController(driveP, driveI, driveD);
+
     // MOTOR CONTROLLERS
     frontLeft = new CANTalon(Constants.DriveTrain.FRONT_LEFT);
     frontRight = new CANTalon(Constants.DriveTrain.FRONT_RIGHT);
@@ -59,14 +66,18 @@ public class DriveTrain extends Subsystem {
     this.imu = new ADXRS450_Gyro(Constants.DriveTrain.GYRO_PORT);
 
     // TODO: Not sure if MODULE_NUMBER should be the same for both
-    leftGearPiston = new DoubleSolenoid(
+    leftGearPiston = new DoubleSolenoid(Constants.DriveTrain.PISTON_MODULE,
         Constants.DriveTrain.LEFT_GEAR_PISTON_FORWARD,
         Constants.DriveTrain.LEFT_GEAR_PISTON_REVERSE);
-    rightGearPiston = new DoubleSolenoid(
+    rightGearPiston = new DoubleSolenoid(Constants.DriveTrain.PISTON_MODULE,
         Constants.DriveTrain.RIGHT_GEAR_PISTON_FORWARD,
         Constants.DriveTrain.RIGHT_GEAR_PISTON_REVERSE);
   }
 
+  public PIDController getDriveController() {
+    return this.driveController;
+  }
+
   public static DriveTrain getDriveTrain() {
     if (driveTrain == null) {
       driveTrain = new DriveTrain();