Saved
[3501/2017steamworks] / 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.OI;
4 import org.usfirst.frc.team3501.robot.Robot;
5
6 import edu.wpi.first.wpilibj.Joystick.AxisType;
7 import edu.wpi.first.wpilibj.command.Command;
8
9 /**
10 * This command will run throughout teleop and listens for joystick inputs to
11 * drive the driveTrain. This never finishes until teleop ends. - works in
12 * conjunction with OI.java
13 */
14 public class JoystickDrive extends Command {
15
16 public JoystickDrive() {
17 requires(Robot.getDriveTrain());
18 }
19
20 @Override
21 protected void initialize() {
22 }
23
24 @Override
25 protected void execute() {
26 final double thrust = OI.xboxController.getY();
27 final double twist = OI.xboxController.getAxis(AxisType.kZ);
28
29 Robot.getDriveTrain().joystickDrive(-thrust, -twist);
30
31 /*
32 * double left = OI.leftJoystick.getY(); double right =
33 * OI.rightJoystick.getY(); Robot.getDriveTrain().tankDrive(-left, -right);
34 */
35 }
36
37 @Override
38 protected boolean isFinished() {
39 return false;
40 }
41
42 @Override
43 protected void end() {
44 Robot.getDriveTrain().stop();
45 }
46
47 @Override
48 protected void interrupted() {
49 }
50 }