Commit | Line | Data |
---|---|---|
78b997ee ME |
1 | package org.usfirst.frc.team3501.robot.commands.driving; |
2 | ||
a784e9d2 | 3 | import org.usfirst.frc.team3501.robot.OI; |
78b997ee ME |
4 | import org.usfirst.frc.team3501.robot.Robot; |
5 | ||
6 | import edu.wpi.first.wpilibj.command.Command; | |
7 | ||
8 | /** | |
3ef4d379 ME |
9 | * This command will run throughout teleop and listens for joystick inputs to |
10 | * drive the driveTrain. This never finishes until teleop ends. | |
11 | * - works in conjunction with OI.java | |
78b997ee ME |
12 | */ |
13 | public class JoystickDrive extends Command { | |
14 | ||
d17d868d | 15 | public JoystickDrive() { |
16 | requires(Robot.getDriveTrain()); | |
17 | } | |
18 | ||
19 | @Override | |
20 | protected void initialize() { | |
21 | } | |
22 | ||
23 | @Override | |
24 | protected void execute() { | |
5483fde9 CZ |
25 | final double thrust = OI.rightJoystick.getY(); |
26 | final double twist = OI.rightJoystick.getTwist(); | |
d17d868d | 27 | |
5483fde9 | 28 | Robot.getDriveTrain().joystickDrive(-thrust, -twist); |
d17d868d | 29 | } |
30 | ||
31 | @Override | |
32 | protected boolean isFinished() { | |
33 | return false; | |
34 | } | |
35 | ||
36 | @Override | |
37 | protected void end() { | |
38 | Robot.getDriveTrain().stop(); | |
39 | } | |
40 | ||
41 | @Override | |
42 | protected void interrupted() { | |
43 | } | |
78b997ee | 44 | } |