Add pid subsystem
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / driving / JoystickDrive.java
1 package org.usfirst.frc.team3501.robot.commands.driving;
2
3 import org.usfirst.frc.team3501.robot.Robot;
4
5 import edu.wpi.first.wpilibj.command.Command;
6
7 /**
8 *
9 */
10 public class JoystickDrive extends Command {
11
12 public JoystickDrive() {
13 requires(Robot.driveTrain);
14 }
15
16 @Override
17 protected void initialize() {
18 }
19
20 @Override
21 protected void execute() {
22 // IDK why but the joystick gives positive values for pulling backwards
23 double left = -Robot.oi.leftJoystick.getY();
24 double right = -Robot.oi.rightJoystick.getY();
25 Robot.driveTrain.drive(left, right);
26 }
27
28 @Override
29 protected boolean isFinished() {
30 return false;
31 }
32
33 @Override
34 protected void end() {
35 Robot.driveTrain.stop();
36 }
37
38 @Override
39 protected void interrupted() {
40 end();
41 }
42 }