fixup whitespace
authordaniel watson <ozzloy@gmail.com>
Wed, 11 Jan 2017 04:19:36 +0000 (20:19 -0800)
committerCindy Zhang <cindyzyx9@gmail.com>
Sat, 14 Jan 2017 03:19:26 +0000 (19:19 -0800)
src/org/usfirst/frc/team3501/robot/Constants.java
src/org/usfirst/frc/team3501/robot/commands/driving/DriveDistance.java
src/org/usfirst/frc/team3501/robot/commands/driving/JoystickDrive.java
src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java
src/org/usfirst/frc/team3501/robot/commands/driving/TurnForAngle.java
src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java

index 163ba286e42d6da44e13883bb747b0444a692a19..4c3146707a5a7f7c355e7dffd445fd79c14d793b 100644 (file)
@@ -7,28 +7,28 @@ package org.usfirst.frc.team3501.robot;
  */
 
 public class Constants {
-    public static class OI {
-        public final static int LEFT_STICK_PORT = 0;
-        public final static int RIGHT_STICK_PORT = 0;
-    }
+  public static class OI {
+    public final static int LEFT_STICK_PORT = 0;
+    public final static int RIGHT_STICK_PORT = 0;
+  }
 
-    public static class DriveTrain {
-        // MOTOR CONTROLLERS
-        public static final int FRONT_LEFT = 0;
-        public static final int FRONT_RIGHT = 0;
-        public static final int REAR_LEFT = 0;
-        public static final int REAR_RIGHT = 0;
+  public static class DriveTrain {
+    // MOTOR CONTROLLERS
+    public static final int FRONT_LEFT = 0;
+    public static final int FRONT_RIGHT = 0;
+    public static final int REAR_LEFT = 0;
+    public static final int REAR_RIGHT = 0;
 
-        // ENCODERS
-        public static final int ENCODER_LEFT_A = 0;
-        public static final int ENCODER_LEFT_B = 0;
-        public static final int ENCODER_RIGHT_A = 0;
-        public static final int ENCODER_RIGHT_B = 0;
+    // ENCODERS
+    public static final int ENCODER_LEFT_A = 0;
+    public static final int ENCODER_LEFT_B = 0;
+    public static final int ENCODER_RIGHT_A = 0;
+    public static final int ENCODER_RIGHT_B = 0;
 
-        public static final int INCHES_PER_PULSE = 0;
-    }
+    public static final int INCHES_PER_PULSE = 0;
+  }
 
-    public static enum Direction {
-        LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD;
-    }
+  public static enum Direction {
+    LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD;
+  }
 }
index 786d6d52dafd4bdd9d74d299f1db7e51c36abf86..d981d99e5b0eac798ff3949c9108a609f99dd6c3 100755 (executable)
@@ -9,34 +9,34 @@ import edu.wpi.first.wpilibj.command.Command;
  */
 public class DriveDistance extends Command {
 
-    public DriveDistance() {
-        requires(Robot.getDriveTrain());
-    }
-
-    // Called just before this Command runs the first time
-    @Override
-    protected void initialize() {
-    }
-
-    // Called repeatedly when this Command is scheduled to run
-    @Override
-    protected void execute() {
-    }
-
-    // Make this return true when this Command no longer needs to run execute()
-    @Override
-    protected boolean isFinished() {
-        return false;
-    }
-
-    // Called once after isFinished returns true
-    @Override
-    protected void end() {
-    }
-
-    // Called when another command which requires one or more of the same
-    // subsystems is scheduled to run
-    @Override
-    protected void interrupted() {
-    }
+  public DriveDistance() {
+    requires(Robot.getDriveTrain());
+  }
+
+  // Called just before this Command runs the first time
+  @Override
+  protected void initialize() {
+  }
+
+  // Called repeatedly when this Command is scheduled to run
+  @Override
+  protected void execute() {
+  }
+
+  // Make this return true when this Command no longer needs to run execute()
+  @Override
+  protected boolean isFinished() {
+    return false;
+  }
+
+  // Called once after isFinished returns true
+  @Override
+  protected void end() {
+  }
+
+  // Called when another command which requires one or more of the same
+  // subsystems is scheduled to run
+  @Override
+  protected void interrupted() {
+  }
 }
index f06eb2f37713c71603d3cb65bfa336ccac71e708..cea1b6b919bbe92e36869d576c1eb7aa8ba70e22 100755 (executable)
@@ -10,33 +10,33 @@ import edu.wpi.first.wpilibj.command.Command;
  */
 public class JoystickDrive extends Command {
 
-    public JoystickDrive() {
-        requires(Robot.getDriveTrain());
-    }
-
-    @Override
-    protected void initialize() {
-    }
-
-    @Override
-    protected void execute() {
-        double left = OI.leftJoystick.getY();
-        double right = OI.rightJoystick.getY();
-
-        Robot.getDriveTrain().joystickDrive(left, right);
-    }
-
-    @Override
-    protected boolean isFinished() {
-        return false;
-    }
-
-    @Override
-    protected void end() {
-        Robot.getDriveTrain().stop();
-    }
-
-    @Override
-    protected void interrupted() {
-    }
+  public JoystickDrive() {
+    requires(Robot.getDriveTrain());
+  }
+
+  @Override
+  protected void initialize() {
+  }
+
+  @Override
+  protected void execute() {
+    final double left = OI.leftJoystick.getY();
+    final double right = OI.rightJoystick.getY();
+
+    Robot.getDriveTrain().joystickDrive(left, right);
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return false;
+  }
+
+  @Override
+  protected void end() {
+    Robot.getDriveTrain().stop();
+  }
+
+  @Override
+  protected void interrupted() {
+  }
 }
index 465840d75dbbe03f3a2dd0a388782ea86ac4a9e8..1fb991e43e2041b87c14a08d541e5e12b7a807e5 100755 (executable)
@@ -9,39 +9,39 @@ import edu.wpi.first.wpilibj.command.Command;
  *
  */
 public class TimeDrive extends Command {
-    Timer timer;
-    double motorVal, time;
-
-    public TimeDrive(double time, double motorVal) {
-        requires(Robot.getDriveTrain());
-
-        timer = new Timer();
-        this.time = time;
-        this.motorVal = motorVal;
-    }
-
-    @Override
-    protected void initialize() {
-        timer.start();
-        Robot.getDriveTrain().setMotorValues(motorVal, motorVal);
-    }
-
-    @Override
-    protected void execute() {
-    }
-
-    @Override
-    protected boolean isFinished() {
-        return timer.get() >= time;
-    }
-
-    @Override
-    protected void end() {
-        Robot.getDriveTrain().stop();
-    }
-
-    @Override
-    protected void interrupted() {
-        end();
-    }
+  Timer timer;
+  double motorVal, time;
+
+  public TimeDrive(final double time, final double motorVal) {
+    requires(Robot.getDriveTrain());
+
+    timer = new Timer();
+    this.time = time;
+    this.motorVal = motorVal;
+  }
+
+  @Override
+  protected void initialize() {
+    timer.start();
+    Robot.getDriveTrain().setMotorValues(motorVal, motorVal);
+  }
+
+  @Override
+  protected void execute() {
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return timer.get() >= time;
+  }
+
+  @Override
+  protected void end() {
+    Robot.getDriveTrain().stop();
+  }
+
+  @Override
+  protected void interrupted() {
+    end();
+  }
 }
index 06d14f6c4a1ba407dafb081655f5cba7e2b3545b..ecf27f59b1605ce12a889b263d90da712ac26f2c 100755 (executable)
@@ -9,34 +9,34 @@ import edu.wpi.first.wpilibj.command.Command;
  */
 public class TurnForAngle extends Command {
 
-    public TurnForAngle() {
-        requires(Robot.getDriveTrain());
-    }
-
-    // Called just before this Command runs the first time
-    @Override
-    protected void initialize() {
-    }
-
-    // Called repeatedly when this Command is scheduled to run
-    @Override
-    protected void execute() {
-    }
-
-    // Make this return true when this Command no longer needs to run execute()
-    @Override
-    protected boolean isFinished() {
-        return false;
-    }
-
-    // Called once after isFinished returns true
-    @Override
-    protected void end() {
-    }
-
-    // Called when another command which requires one or more of the same
-    // subsystems is scheduled to run
-    @Override
-    protected void interrupted() {
-    }
+  public TurnForAngle() {
+    requires(Robot.getDriveTrain());
+  }
+
+  // Called just before this Command runs the first time
+  @Override
+  protected void initialize() {
+  }
+
+  // Called repeatedly when this Command is scheduled to run
+  @Override
+  protected void execute() {
+  }
+
+  // Make this return true when this Command no longer needs to run execute()
+  @Override
+  protected boolean isFinished() {
+    return false;
+  }
+
+  // Called once after isFinished returns true
+  @Override
+  protected void end() {
+  }
+
+  // Called when another command which requires one or more of the same
+  // subsystems is scheduled to run
+  @Override
+  protected void interrupted() {
+  }
 }
index 23db318cedcf233020e81f98e98707739c88ec5a..acb1a85ab257681c5b13e74db681ff857da3ce25 100644 (file)
@@ -2,122 +2,122 @@ package org.usfirst.frc.team3501.robot.subsystems;
 
 import org.usfirst.frc.team3501.robot.Constants;
 
-import com.ctre.CANTalon;
-
+import edu.wpi.first.wpilibj.CANTalon;
 import edu.wpi.first.wpilibj.Encoder;
 import edu.wpi.first.wpilibj.RobotDrive;
 import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class DriveTrain extends Subsystem {
-    private static DriveTrain driveTrain;
-    private CANTalon frontLeft, frontRight, rearLeft, rearRight;
-    private RobotDrive robotDrive;
-    private Encoder leftEncoder, rightEncoder;
-
-    private DriveTrain() {
-        // MOTOR CONTROLLERS
-        frontLeft = new CANTalon(Constants.DriveTrain.FRONT_LEFT);
-        frontRight = new CANTalon(Constants.DriveTrain.FRONT_RIGHT);
-        rearLeft = new CANTalon(Constants.DriveTrain.REAR_LEFT);
-        rearRight = new CANTalon(Constants.DriveTrain.REAR_RIGHT);
-
-        // ENCODERS
-        leftEncoder = new Encoder(Constants.DriveTrain.ENCODER_LEFT_A,
-                Constants.DriveTrain.ENCODER_LEFT_B);
-        rightEncoder = new Encoder(Constants.DriveTrain.ENCODER_RIGHT_A,
-                Constants.DriveTrain.ENCODER_RIGHT_B);
-
-        leftEncoder.setDistancePerPulse(Constants.DriveTrain.INCHES_PER_PULSE);
-        rightEncoder.setDistancePerPulse(Constants.DriveTrain.INCHES_PER_PULSE);
-
-        // ROBOT DRIVE
-        robotDrive = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);
-    }
-
-    public static DriveTrain getDriveTrain() {
-        if (driveTrain == null)
-            driveTrain = new DriveTrain();
-        return driveTrain;
-    }
-
-    // DRIVE METHODS
-    public void setMotorValues(double left, double right) {
-        robotDrive.tankDrive(left, right);
-    }
-
-    public void joystickDrive(double left, double right) {
-        robotDrive.tankDrive(left, right);
-    }
-
-    public void stop() {
-        setMotorValues(0, 0);
-    }
-
-    public double getFrontLeftMotorVal() {
-        return frontLeft.get();
-    }
-
-    public double getFrontRightMotorVal() {
-        return frontRight.get();
-    }
-
-    public double getRearLeftMotorVal() {
-        return frontLeft.get();
-    }
-
-    public double getRearRightMotorVal() {
-        return frontLeft.get();
-    }
-
-    public CANTalon getFrontLeft() {
-        return frontLeft;
-    }
-
-    public CANTalon getFrontRight() {
-        return frontRight;
-    }
-
-    public CANTalon getRearLeft() {
-        return rearLeft;
-    }
-
-    public CANTalon getRearRight() {
-        return rearRight;
-    }
-
-    // ENCODER METHODS
-
-    public double getLeftEncoder() {
-        return leftEncoder.getDistance();
-    }
-
-    public double getRightEncoder() {
-        return rightEncoder.getDistance();
-    }
-
-    public double getAvgEncoderDistance() {
-        return (leftEncoder.getDistance() + rightEncoder.getDistance()) / 2;
-    }
-
-    public void resetEncoders() {
-        leftEncoder.reset();
-        rightEncoder.reset();
-    }
-
-    public double getLeftSpeed() {
-        return leftEncoder.getRate();
-    }
-
-    public double getRightSpeed() {
-        return rightEncoder.getRate();
-    }
-
-    public double getSpeed() {
-        return (getLeftSpeed() + getRightSpeed()) / 2.0;
-    }
-
-    @Override
-    protected void initDefaultCommand() {
-    }
+  private static DriveTrain driveTrain;
+  private final CANTalon frontLeft, frontRight, rearLeft, rearRight;
+  private final RobotDrive robotDrive;
+  private final Encoder leftEncoder, rightEncoder;
+
+  private DriveTrain() {
+    // MOTOR CONTROLLERS
+    frontLeft = new CANTalon(Constants.DriveTrain.FRONT_LEFT);
+    frontRight = new CANTalon(Constants.DriveTrain.FRONT_RIGHT);
+    rearLeft = new CANTalon(Constants.DriveTrain.REAR_LEFT);
+    rearRight = new CANTalon(Constants.DriveTrain.REAR_RIGHT);
+
+    // ENCODERS
+    leftEncoder = new Encoder(Constants.DriveTrain.ENCODER_LEFT_A,
+        Constants.DriveTrain.ENCODER_LEFT_B);
+    rightEncoder = new Encoder(Constants.DriveTrain.ENCODER_RIGHT_A,
+        Constants.DriveTrain.ENCODER_RIGHT_B);
+
+    leftEncoder.setDistancePerPulse(Constants.DriveTrain.INCHES_PER_PULSE);
+    rightEncoder.setDistancePerPulse(Constants.DriveTrain.INCHES_PER_PULSE);
+
+    // ROBOT DRIVE
+    robotDrive = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);
+  }
+
+  public static DriveTrain getDriveTrain() {
+    if (driveTrain == null) {
+      driveTrain = new DriveTrain();
+    }
+    return driveTrain;
+  }
+
+  // DRIVE METHODS
+  public void setMotorValues(final double left, final double right) {
+    robotDrive.tankDrive(left, right);
+  }
+
+  public void joystickDrive(final double left, final double right) {
+    robotDrive.tankDrive(left, right);
+  }
+
+  public void stop() {
+    setMotorValues(0, 0);
+  }
+
+  public double getFrontLeftMotorVal() {
+    return frontLeft.get();
+  }
+
+  public double getFrontRightMotorVal() {
+    return frontRight.get();
+  }
+
+  public double getRearLeftMotorVal() {
+    return frontLeft.get();
+  }
+
+  public double getRearRightMotorVal() {
+    return frontLeft.get();
+  }
+
+  public CANTalon getFrontLeft() {
+    return frontLeft;
+  }
+
+  public CANTalon getFrontRight() {
+    return frontRight;
+  }
+
+  public CANTalon getRearLeft() {
+    return rearLeft;
+  }
+
+  public CANTalon getRearRight() {
+    return rearRight;
+  }
+
+  // ENCODER METHODS
+
+  public double getLeftEncoder() {
+    return leftEncoder.getDistance();
+  }
+
+  public double getRightEncoder() {
+    return rightEncoder.getDistance();
+  }
+
+  public double getAvgEncoderDistance() {
+    return (leftEncoder.getDistance() + rightEncoder.getDistance()) / 2;
+  }
+
+  public void resetEncoders() {
+    leftEncoder.reset();
+    rightEncoder.reset();
+  }
+
+  public double getLeftSpeed() {
+    return leftEncoder.getRate();
+  }
+
+  public double getRightSpeed() {
+    return rightEncoder.getRate();
+  }
+
+  public double getSpeed() {
+    return (getLeftSpeed() + getRightSpeed()) / 2.0;
+  }
+
+  @Override
+  protected void initDefaultCommand() {
+  }
 
 }