Commit | Line | Data |
---|---|---|
33141cdd KZ |
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 | /** | |
1c94f230 KZ |
8 | * Runs throughout teleop and listens for joystick inputs and drives the |
9 | * driveTrain | |
10 | * Never finishes until teleop ends | |
33141cdd KZ |
11 | */ |
12 | public class JoystickDrive extends Command { | |
13 | ||
14 | public JoystickDrive() { | |
15 | requires(Robot.driveTrain); | |
16 | } | |
17 | ||
18 | @Override | |
19 | protected void initialize() { | |
20 | } | |
21 | ||
22 | @Override | |
23 | protected void execute() { | |
24 | // IDK why but the joystick gives positive values for pulling backwards | |
25 | double left = -Robot.oi.leftJoystick.getY(); | |
26 | double right = -Robot.oi.rightJoystick.getY(); | |
27 | Robot.driveTrain.drive(left, right); | |
28 | } | |
29 | ||
30 | @Override | |
31 | protected boolean isFinished() { | |
32 | return false; | |
33 | } | |
34 | ||
35 | @Override | |
36 | protected void end() { | |
37 | Robot.driveTrain.stop(); | |
38 | } | |
39 | ||
40 | @Override | |
41 | protected void interrupted() { | |
33141cdd KZ |
42 | } |
43 | } |