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

Commit 110e691

Browse files
author
GitHub Actions
committed
Google Java Format
1 parent 623d765 commit 110e691

File tree

9 files changed

+35
-42
lines changed

9 files changed

+35
-42
lines changed

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

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import frc.robot.commands.ExtendClimb;
1616
import frc.robot.commands.RetractClimb;
1717

18-
1918
/**
2019
* This class is the glue that binds the controls on the physical operator interface to the commands
2120
* and command groups that allow control of the robot.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class RobotMap {
2121

2222
// intake ID
2323
public static final int MOTOR_MAILBOX_ID = 31;
24-
24+
2525
// drivetrain motors
2626
public static final int MOTOR_LEFT_BACK_ID = 12;
2727
public static final int MOTOR_RIGHT_BACK_ID = 10;
@@ -30,7 +30,7 @@ public class RobotMap {
3030

3131
public static final int MOTOR_CLIMB_EXTENDER_ID = 0;
3232
public static final int MOTOR_CLIMB_WINCH_ID = 40;
33-
33+
3434
// left joystick (horizontal)
3535
public static final int JOYSTICK_DRIVE_FORWARDS_ID = 1;
3636
// left joystick (horizontal)

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public ExtendClimb() {
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
@@ -36,12 +35,10 @@ protected boolean isFinished() {
3635

3736
// Called once after isFinished returns true
3837
@Override
39-
protected void end() {
40-
}
38+
protected void end() {}
4139

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

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
@@ -36,12 +35,10 @@ protected boolean isFinished() {
3635

3736
// Called once after isFinished returns true
3837
@Override
39-
protected void end() {
40-
}
38+
protected void end() {}
4139

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

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-5
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, 10);
32-
armMotor.config_kI(0, 0, 10);
33-
armMotor.config_kD(0, 0, 10);
31+
armMotor.config_kP(0, 0, 10);
32+
armMotor.config_kI(0, 0, 10);
33+
armMotor.config_kD(0, 0, 10);
3434
}
3535

3636
@Override
@@ -45,8 +45,8 @@ 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 void setSetpoint(double setpoint) {
5252
armMotor.set(ControlMode.Position, setpoint);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void extendClimb(double voltage) {
2828
}
2929

3030
public void turnWinch(double voltage) {
31-
winchMotor.set(ControlMode.PercentOutput, voltage);
31+
winchMotor.set(ControlMode.PercentOutput, voltage);
3232
}
3333

3434
@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)