Purge code of all unused fields/classes. Only testing code.
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / driving / JoystickDrive.java
index 5d8ff9c9fee2930869a2a48af3244a0d92b66289..3db4388046fa4e532f5471c5da3b19f096585286 100644 (file)
@@ -1,13 +1,13 @@
 package org.usfirst.frc.team3501.robot.commands.driving;
 
+import org.usfirst.frc.team3501.robot.OI;
 import org.usfirst.frc.team3501.robot.Robot;
 
 import edu.wpi.first.wpilibj.command.Command;
 
 /**
  * Runs throughout teleop and listens for joystick inputs and drives the
- * driveTrain
- * Never finishes until teleop ends
+ * driveTrain Never finishes until teleop ends
  */
 public class JoystickDrive extends Command {
 
@@ -21,10 +21,11 @@ public class JoystickDrive extends Command {
 
   @Override
   protected void execute() {
+    double k = (Robot.driveTrain.isFlipped() ? -1 : 1);
     // IDK why but the joystick gives positive values for pulling backwards
-    double left = -Robot.oi.leftJoystick.getY();
-    double right = -Robot.oi.rightJoystick.getY();
-    Robot.driveTrain.drive(left, right);
+    double left = -OI.leftJoystick.getY();
+    double right = -OI.rightJoystick.getY();
+    Robot.driveTrain.drive(left * k, right * k);
   }
 
   @Override