Skip to content
This repository was archived by the owner on Apr 17, 2021. It is now read-only.

Commit f9e3d7b

Browse files
author
GitHub Actions
committed
Google Java Format
1 parent 20c2bdd commit f9e3d7b

File tree

10 files changed

+41
-53
lines changed

10 files changed

+41
-53
lines changed

RobotCode2020/src/main/java/frc/robot/OI.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,21 @@
1616
import frc.robot.commands.RetractClimb;
1717
import frc.robot.commands.ArmPosition;
1818

19-
2019
/**
2120
* This class is the glue that binds the controls on the physical operator interface to the commands
2221
* and command groups that allow control of the robot.
2322
*/
2423
public class OI {
25-
//CONTROLLER 1
24+
// CONTROLLER 1
2625
public Joystick controller = new Joystick(RobotMap.CONTROLLER_1_PORT_ID);
27-
//Co-CONTROLLER
26+
// Co-CONTROLLER
2827
public Joystick coController = new Joystick(RobotMap.CONTROLLER_2_PORT_ID);
2928
public Button aCoButton = new JoystickButton(controller, RobotMap.A_BUTTON_ID);
3029
public Button bCoButton = new JoystickButton(controller, RobotMap.B_BUTTON_ID);
3130
public Button xCoButton = new JoystickButton(controller, RobotMap.X_BUTTON_ID);
3231
public Button leftBumperCoButton = new JoystickButton(controller, RobotMap.LEFT_BUMPER_BUTTON_ID);
33-
public Button rightBumperCoButton = new JoystickButton(controller, RobotMap.RIGHT_BUMPER_BUTTON_ID);
34-
32+
public Button rightBumperCoButton =
33+
new JoystickButton(controller, RobotMap.RIGHT_BUMPER_BUTTON_ID);
3534

3635
public OI() {
3736
aCoButton.whileHeld(new WinchWind());

RobotCode2020/src/main/java/frc/robot/RobotMap.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ public class RobotMap {
1717
public static final int CONTROLLER_1_PORT_ID = 0; // switches temporarily
1818
public static final int CONTROLLER_2_PORT_ID = 1;
1919

20-
2120
// arm ID
2221
public static final int MOTOR_ARM_ID = 20;
2322

2423
// intake ID
2524
public static final int MOTOR_MAILBOX_ID = 31;
26-
25+
2726
// drivetrain motors
2827
public static final int MOTOR_LEFT_BACK_ID = 12;
2928
public static final int MOTOR_RIGHT_BACK_ID = 10;
@@ -32,7 +31,7 @@ public class RobotMap {
3231

3332
public static final int MOTOR_CLIMB_EXTENDER_ID = 40;
3433
public static final int MOTOR_CLIMB_WINCH_ID = 50;
35-
34+
3635
// left joystick (horizontal)
3736
public static final int JOYSTICK_DRIVE_FORWARDS_ID = 1;
3837
// left joystick (horizontal)

RobotCode2020/src/main/java/frc/robot/commands/ArmPosition.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public ArmPosition() {
2020

2121
// Called just before this Command runs the first time
2222
@Override
23-
protected void initialize() {
24-
}
23+
protected void initialize() {}
2524

2625
// Called repeatedly when this Command is scheduled to run
2726
@Override
@@ -38,8 +37,7 @@ protected boolean isFinished() {
3837

3938
// Called once after isFinished returns true
4039
@Override
41-
protected void end() {
42-
}
40+
protected void end() {}
4341

4442
// Called when another command which requires one or more of the same
4543
// subsystems is scheduled to run

RobotCode2020/src/main/java/frc/robot/commands/ExtendClimb.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@ protected boolean isFinished() {
3838

3939
// Called once after isFinished returns true
4040
@Override
41-
protected void end() {
42-
}
41+
protected void end() {}
4342

4443
// Called when another command which requires one or more of the same
4544
// subsystems is scheduled to run
4645
@Override
47-
protected void interrupted() {
48-
49-
}
46+
protected void interrupted() {}
5047
}

RobotCode2020/src/main/java/frc/robot/commands/RetractClimb.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public RetractClimb() {
1919

2020
// Called just before this Command runs the first time
2121
@Override
22-
protected void initialize() {
23-
}
22+
protected void initialize() {}
2423

2524
// Called repeatedly when this Command is scheduled to run
2625
@Override
@@ -37,12 +36,10 @@ protected boolean isFinished() {
3736

3837
// Called once after isFinished returns true
3938
@Override
40-
protected void end() {
41-
}
39+
protected void end() {}
4240

4341
// Called when another command which requires one or more of the same
4442
// subsystems is scheduled to run
4543
@Override
46-
protected void interrupted() {
47-
}
44+
protected void interrupted() {}
4845
}

RobotCode2020/src/main/java/frc/robot/commands/autonomous/Auton.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@
1212
import frc.robot.commands.drivetrain.RotateToAngle;
1313

1414
public class Auton extends CommandGroup {
15-
/**
16-
* Hopefully works.
17-
*/
15+
/** Hopefully works. */
1816
public Auton() {
1917
// Add Commands here:
2018
// e.g. addSequential(new Command1());
2119
// addSequential(new Command2());
2220
// these will run in order.
23-
addSequential(new DriveDistance(5), 10.0);
24-
addSequential(new RotateToAngle(90.0), 10.0);
25-
//addSequential(new DriveDistance(1), 10.0);
26-
21+
addSequential(new DriveDistance(5), 10.0);
22+
addSequential(new RotateToAngle(90.0), 10.0);
23+
// addSequential(new DriveDistance(1), 10.0);
2724

2825
// To run multiple commands at the same time,
2926
// use addParallel()

RobotCode2020/src/main/java/frc/robot/commands/drivetrain/DriveDistance.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ public class DriveDistance extends Command {
1818
private double D = 0.0055;
1919
private PIDController pidDriveController = new PIDController(P, I, D);
2020
private PIDController pidTurnController = new PIDController(P, I, D);
21-
21+
2222
private double rotationsToTarget;
2323
private double ticksTarget;
2424
private int ticksPerRotation = 42;
25-
private double wheelDiameter = 0.5; //ft
25+
private double wheelDiameter = 0.5; // ft
2626

2727
/**
2828
* Drives robot a set distance w/ PID loop to keep it straight
@@ -32,7 +32,7 @@ public class DriveDistance extends Command {
3232
public DriveDistance(double distance) {
3333
requires(Robot.drivetrain);
3434
// calculate # of ticks based off distance
35-
rotationsToTarget = distance / (wheelDiameter * Math.PI) * 10.75;
35+
rotationsToTarget = distance / (wheelDiameter * Math.PI) * 10.75;
3636
pidDriveController.setTolerance(1);
3737
pidTurnController.setTolerance(0.05);
3838
}
@@ -43,19 +43,17 @@ protected void initialize() {
4343
Robot.drivetrain.calibrate();
4444
SmartDashboard.putNumber("Ticks To Target", rotationsToTarget);
4545
SmartDashboard.putString("Command", "DriveDistance");
46-
4746
}
4847

4948
// Called repeatedly when this Command is scheduled to run
5049
@Override
5150
protected void execute() {
52-
double forwardsSpeed = pidDriveController.calculate(Robot.drivetrain.getPosition(), rotationsToTarget);
51+
double forwardsSpeed =
52+
pidDriveController.calculate(Robot.drivetrain.getPosition(), rotationsToTarget);
5353
double turnSpeed = pidTurnController.calculate(Robot.drivetrain.gyro.getAngle(), 0);
5454
Robot.drivetrain.drive(forwardsSpeed, turnSpeed);
5555
}
5656

57-
58-
5957
// Make this return true when this Command no longer needs to run execute()
6058
@Override
6159
protected boolean isFinished() {

RobotCode2020/src/main/java/frc/robot/subsystems/Arm.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public Arm() {
2828
armMotor.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Absolute, 0, 10);
2929
// config PID parameters
3030
armMotor.config_kF(0, 0, 10);
31-
armMotor.config_kP(0, 0.3, 10);
32-
armMotor.config_kI(0, 0, 10);
33-
armMotor.config_kD(0, 0, 10);
31+
armMotor.config_kP(0, 0.3, 10);
32+
armMotor.config_kI(0, 0, 10);
33+
armMotor.config_kD(0, 0, 10);
3434
}
3535

3636
@Override
@@ -45,14 +45,13 @@ public void periodic() {
4545
}
4646

4747
public void turn(double value) {
48-
armMotor.set(ControlMode.PercentOutput, value);
49-
}
48+
armMotor.set(ControlMode.PercentOutput, value);
49+
}
5050

5151
public boolean atSetpoint() {
5252
return (Math.abs(armMotor.getSelectedSensorPosition() - 4600) < 30);
5353
}
5454

55-
5655
public void setSetpointUp(double setpoint) {
5756
SmartDashboard.putString("setSetpoint called:", "yes :)");
5857
armMotor.set(ControlMode.Position, 4600);

RobotCode2020/src/main/java/frc/robot/subsystems/Climb.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
import com.ctre.phoenix.motorcontrol.ControlMode;
1616
import com.ctre.phoenix.motorcontrol.can.VictorSPX;
17-
import frc.robot.commands.*;
18-
17+
import frc.robot.commands.*;
1918

2019
/** Add your docs here. */
2120
public class Climb extends Subsystem {
@@ -30,7 +29,7 @@ public void extendClimb(double voltage) {
3029
}
3130

3231
public void turnWinch(double voltage) {
33-
winchMotor.set(ControlMode.PercentOutput, voltage);
32+
winchMotor.set(ControlMode.PercentOutput, voltage);
3433
}
3534

3635
@Override

RobotCode2020/src/main/java/frc/robot/subsystems/Drivetrain.java

+12-7
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,26 @@
3030
/** Drivetrain class w/ limelight vision tracking */
3131
public class Drivetrain extends Subsystem {
3232
// motor stuff
33-
private CANSparkMax leftMotorFront = new CANSparkMax(RobotMap.MOTOR_LEFT_FRONT_ID, MotorType.kBrushless);
34-
private CANSparkMax leftMotorBack = new CANSparkMax(RobotMap.MOTOR_LEFT_BACK_ID, MotorType.kBrushless);
35-
private CANSparkMax rightMotorFront = new CANSparkMax(RobotMap.MOTOR_RIGHT_FRONT_ID, MotorType.kBrushless);
36-
private CANSparkMax rightMotorBack = new CANSparkMax(RobotMap.MOTOR_RIGHT_BACK_ID, MotorType.kBrushless);
33+
private CANSparkMax leftMotorFront =
34+
new CANSparkMax(RobotMap.MOTOR_LEFT_FRONT_ID, MotorType.kBrushless);
35+
private CANSparkMax leftMotorBack =
36+
new CANSparkMax(RobotMap.MOTOR_LEFT_BACK_ID, MotorType.kBrushless);
37+
private CANSparkMax rightMotorFront =
38+
new CANSparkMax(RobotMap.MOTOR_RIGHT_FRONT_ID, MotorType.kBrushless);
39+
private CANSparkMax rightMotorBack =
40+
new CANSparkMax(RobotMap.MOTOR_RIGHT_BACK_ID, MotorType.kBrushless);
3741

3842
private SpeedControllerGroup leftMotors = new SpeedControllerGroup(leftMotorFront, leftMotorBack);
39-
private SpeedControllerGroup rightMotors = new SpeedControllerGroup(rightMotorFront, rightMotorBack);
43+
private SpeedControllerGroup rightMotors =
44+
new SpeedControllerGroup(rightMotorFront, rightMotorBack);
4045

4146
// drivetrain
4247
private DifferentialDrive dualDrive = new DifferentialDrive(leftMotors, rightMotors);
4348

4449
// encoders
4550
private CANEncoder lEncoder = new CANEncoder(leftMotorBack);
4651
private CANEncoder rEncoder = new CANEncoder(rightMotorBack);
47-
52+
4853
// gyro
4954
public AHRS gyro;
5055

@@ -75,7 +80,7 @@ public void calibrate() {
7580

7681
/** Return average position between the encoders */
7782
public double getPosition() {
78-
return ((lEncoder.getPosition() + rEncoder.getPosition()*-1) / 2.0);
83+
return ((lEncoder.getPosition() + rEncoder.getPosition() * -1) / 2.0);
7984
}
8085

8186
/**

0 commit comments

Comments
 (0)