change variables 'left' and 'right' that store joystick values to 'thrust' and 'twist'
authorCindy Zhang <cindyzyx9@gmail.com>
Thu, 12 Jan 2017 05:17:05 +0000 (21:17 -0800)
committerCindy Zhang <cindyzyx9@gmail.com>
Sat, 14 Jan 2017 03:19:27 +0000 (19:19 -0800)
src/org/usfirst/frc/team3501/robot/commands/driving/JoystickDrive.java
src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java

index cea1b6b919bbe92e36869d576c1eb7aa8ba70e22..d12614f06ca99b2fb64a1c03173f39037c453a7a 100755 (executable)
@@ -20,10 +20,10 @@ public class JoystickDrive extends Command {
 
   @Override
   protected void execute() {
-    final double left = OI.leftJoystick.getY();
-    final double right = OI.rightJoystick.getY();
+    final double thrust = OI.rightJoystick.getY();
+    final double twist = OI.rightJoystick.getTwist();
 
-    Robot.getDriveTrain().joystickDrive(left, right);
+    Robot.getDriveTrain().joystickDrive(-thrust, -twist);
   }
 
   @Override
index 5389b235380b3a081a6c9c7b34b4e1b72b93edfe..4bbda0fb1168a8ef9e490d356c771e5f08626779 100644 (file)
@@ -1,6 +1,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 com.ctre.CANTalon;
 
@@ -46,8 +47,8 @@ public class DriveTrain extends Subsystem {
     robotDrive.tankDrive(left, right);
   }
 
-  public void joystickDrive(final double left, final double right) {
-    robotDrive.tankDrive(left, right);
+  public void joystickDrive(final double thrust, final double twist) {
+    robotDrive.arcadeDrive(thrust, twist);
   }
 
   public void stop() {
@@ -119,6 +120,7 @@ public class DriveTrain extends Subsystem {
 
   @Override
   protected void initDefaultCommand() {
+    setDefaultCommand(new JoystickDrive());
   }
 
 }