1 package org
.usfirst
.frc
.team3501
.robot
.commands
.driving
;
3 import org
.usfirst
.frc
.team3501
.robot
.Robot
;
5 import edu
.wpi
.first
.wpilibj
.command
.Command
;
8 * Runs throughout teleop and listens for joystick inputs and drives the
9 * driveTrain Never finishes until teleop ends
11 public class JoystickDrive
extends Command
{
13 public JoystickDrive() {
14 requires(Robot
.driveTrain
);
18 protected void initialize() {
22 protected void execute() {
23 double k
= (Robot
.driveTrain
.isFlipped() ?
-1 : 1);
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
* k
, right
* k
);
31 protected boolean isFinished() {
36 protected void end() {
37 Robot
.driveTrain
.stop();
41 protected void interrupted() {