Saved
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / driving / JoystickDrive.java
CommitLineData
78b997ee
ME
1package org.usfirst.frc.team3501.robot.commands.driving;
2
a784e9d2 3import org.usfirst.frc.team3501.robot.OI;
78b997ee
ME
4import org.usfirst.frc.team3501.robot.Robot;
5
8275a069 6import edu.wpi.first.wpilibj.Joystick.AxisType;
78b997ee
ME
7import edu.wpi.first.wpilibj.command.Command;
8
9/**
3ef4d379 10 * This command will run throughout teleop and listens for joystick inputs to
f0a71840
CZ
11 * drive the driveTrain. This never finishes until teleop ends. - works in
12 * conjunction with OI.java
78b997ee
ME
13 */
14public class JoystickDrive extends Command {
15
d17d868d 16 public JoystickDrive() {
17 requires(Robot.getDriveTrain());
18 }
19
20 @Override
21 protected void initialize() {
22 }
23
24 @Override
25 protected void execute() {
8275a069
RR
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 */
d17d868d 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 }
78b997ee 50}