From d17d868dd3c4b68452392e321e0980938a4ace76 Mon Sep 17 00:00:00 2001 From: daniel watson Date: Tue, 10 Jan 2017 20:19:36 -0800 Subject: [PATCH] fixup whitespace --- .../usfirst/frc/team3501/robot/Constants.java | 40 ++-- .../robot/commands/driving/DriveDistance.java | 60 ++--- .../robot/commands/driving/JoystickDrive.java | 58 ++--- .../robot/commands/driving/TimeDrive.java | 70 +++--- .../robot/commands/driving/TurnForAngle.java | 60 ++--- .../team3501/robot/subsystems/DriveTrain.java | 224 +++++++++--------- 6 files changed, 256 insertions(+), 256 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index 163ba28..4c31467 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -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; + } } diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/DriveDistance.java b/src/org/usfirst/frc/team3501/robot/commands/driving/DriveDistance.java index 786d6d5..d981d99 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/driving/DriveDistance.java +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/DriveDistance.java @@ -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() { + } } diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/JoystickDrive.java b/src/org/usfirst/frc/team3501/robot/commands/driving/JoystickDrive.java index f06eb2f..cea1b6b 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/driving/JoystickDrive.java +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/JoystickDrive.java @@ -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() { + } } diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java b/src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java index 465840d..1fb991e 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java @@ -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(); + } } diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForAngle.java b/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForAngle.java index 06d14f6..ecf27f5 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForAngle.java +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForAngle.java @@ -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() { + } } diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java index 23db318..acb1a85 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java @@ -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() { + } } -- 2.30.2