X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc3501%2FRiceCatRobot%2Fcommands%2FTurnFor.java;h=4abe13bd3f980ad756606282c51fabd86997107e;hb=e3bfff965c6d5a25b0d98b12b73fbf7eed623326;hp=9be37790378ebf54cbb258255eb5412b559929e2;hpb=b5f932ecccf219b28cbebf44c8896347621f6364;p=3501%2F2015-FRC-Spark diff --git a/src/org/usfirst/frc3501/RiceCatRobot/commands/TurnFor.java b/src/org/usfirst/frc3501/RiceCatRobot/commands/TurnFor.java index 9be3779..4abe13b 100644 --- a/src/org/usfirst/frc3501/RiceCatRobot/commands/TurnFor.java +++ b/src/org/usfirst/frc3501/RiceCatRobot/commands/TurnFor.java @@ -7,48 +7,48 @@ import edu.wpi.first.wpilibj.Timer; import edu.wpi.first.wpilibj.command.Command; public class TurnFor extends Command { - private double seconds; - private Timer timer; - private Direction direction; - - public TurnFor(double seconds, Direction direction) { - this.seconds = seconds; - this.direction = direction; - } - - @Override - protected void initialize() { - timer = new Timer(); - timer.start(); - } - - @Override - protected void execute() { - if (direction == Direction.LEFT) { - Robot.driveTrain.arcadeDrive(0, -0.5); - } else if (direction == Direction.RIGHT) { - Robot.driveTrain.arcadeDrive(0, 0.5); - } else { - Robot.driveTrain.arcadeDrive(0, 0); - } + private double seconds; + private Timer timer; + private Direction direction; + + public TurnFor(double seconds, Direction direction) { + this.seconds = seconds; + this.direction = direction; + } + + @Override + protected void initialize() { + timer = new Timer(); + timer.start(); + } + + @Override + protected void execute() { + if (direction == Direction.LEFT) { + Robot.driveTrain.arcadeDrive(0, -0.5); + } else if (direction == Direction.RIGHT) { + Robot.driveTrain.arcadeDrive(0, 0.5); + } else { + Robot.driveTrain.arcadeDrive(0, 0); } - - @Override - protected boolean isFinished() { - System.out.println(timer.get()); - System.out.println(seconds); - if (timer.get() > seconds) { - Robot.driveTrain.arcadeDrive(0, 0); - } - return timer.get() > seconds; + } + + @Override + protected boolean isFinished() { + System.out.println(timer.get()); + System.out.println(seconds); + if (timer.get() > seconds) { + Robot.driveTrain.arcadeDrive(0, 0); } + return timer.get() > seconds; + } - @Override - protected void end() { - } + @Override + protected void end() { + } - @Override - protected void interrupted() { - end(); - } + @Override + protected void interrupted() { + end(); + } }