Remove extra newlines after open curly braces (NFC) (#3471)

This commit is contained in:
Tyler Veness
2021-07-09 00:41:30 -04:00
committed by GitHub
parent a4233e1a16
commit 9d68d95825
47 changed files with 0 additions and 67 deletions

View File

@@ -18,7 +18,6 @@ public final class CameraServerSharedStore {
if (cameraServerShared == null) {
cameraServerShared =
new CameraServerShared() {
@Override
public void reportVideoServer(int id) {}

View File

@@ -16,7 +16,6 @@ import java.util.function.BooleanSupplier;
* specified explicitly from the command implementation.
*/
public interface Command {
/** The initial subroutine of a command. Called once when the command is initially scheduled. */
default void initialize() {}

View File

@@ -12,7 +12,6 @@ import java.util.Set;
/** A {@link Sendable} base class for {@link Command}s. */
public abstract class CommandBase implements Sendable, Command {
protected Set<Subsystem> m_requirements = new HashSet<>();
protected CommandBase() {

View File

@@ -194,7 +194,6 @@ public class MecanumControllerCommand extends CommandBase {
Supplier<MecanumDriveWheelSpeeds> currentWheelSpeeds,
Consumer<MecanumDriveMotorVoltages> outputDriveVoltages,
Subsystem... requirements) {
this(
trajectory,
pose,

View File

@@ -20,7 +20,6 @@ package edu.wpi.first.wpilibj2.command;
* base for user implementations that handles this.
*/
public interface Subsystem {
/**
* This method is called periodically by the {@link CommandScheduler}. Useful for updating
* subsystem-specific state that you don't want to offload to a {@link Command}. Teams should try

View File

@@ -13,7 +13,6 @@ import edu.wpi.first.util.sendable.SendableRegistry;
* method for setting the default command.
*/
public abstract class SubsystemBase implements Subsystem, Sendable {
/** Constructor. */
public SubsystemBase() {
String name = this.getClass().getSimpleName();

View File

@@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test;
class CommandGroupErrorTest extends CommandTestBase {
@Test
void commandInMultipleGroupsTest() {
MockCommandHolder command1Holder = new MockCommandHolder(true);
Command command1 = command1Holder.getMock();
MockCommandHolder command2Holder = new MockCommandHolder(true);

View File

@@ -135,7 +135,6 @@ class ButtonTest extends CommandTestBase {
@Test
void runnableBindingTest() {
InternalButton buttonWhenPressed = new InternalButton();
InternalButton buttonWhileHeld = new InternalButton();
InternalButton buttonWhenReleased = new InternalButton();

View File

@@ -40,7 +40,6 @@ public class DoubleSolenoid implements Sendable, AutoCloseable {
* @param reverseChannel The reverse channel on the module to control (0..7).
*/
public DoubleSolenoid(PneumaticsBase module, final int forwardChannel, final int reverseChannel) {
m_module = Objects.requireNonNull(module, "Module cannot be null");
// TODO check channels

View File

@@ -5,7 +5,6 @@
package edu.wpi.first.wpilibj;
public interface PneumaticsBase extends AutoCloseable {
/**
* Sets solenoids on a pneumatics module.
*

View File

@@ -41,7 +41,6 @@ public abstract class RobotBase implements AutoCloseable {
private static void setupCameraServerShared() {
CameraServerShared shared =
new CameraServerShared() {
@Override
public void reportVideoServer(int id) {
HAL.report(tResourceType.kResourceType_PCVideoServer, id + 1);

View File

@@ -14,7 +14,6 @@ import java.util.function.Supplier;
/** Common interface for objects that can contain shuffleboard components. */
public interface ShuffleboardContainer extends ShuffleboardValue {
/**
* Gets the components that are direct children of this container.
*

View File

@@ -11,7 +11,6 @@ package edu.wpi.first.wpilibj.shuffleboard;
* <p>This class is package-private to minimize API surface area.
*/
interface ShuffleboardRoot {
/**
* Gets the tab with the given title, creating it if it does not already exist.
*

View File

@@ -7,7 +7,6 @@ package edu.wpi.first.wpilibj.shuffleboard;
import edu.wpi.first.networktables.NetworkTable;
interface ShuffleboardValue {
/**
* Gets the title of this Shuffleboard value.
*

View File

@@ -13,7 +13,6 @@ package edu.wpi.first.wpilibj.shuffleboard;
*/
abstract class ShuffleboardWidget<W extends ShuffleboardWidget<W>>
extends ShuffleboardComponent<W> {
ShuffleboardWidget(ShuffleboardContainer parent, String title) {
super(parent, title);
}

View File

@@ -155,7 +155,6 @@ public class DifferentialDrivetrainSim {
*/
@SuppressWarnings("LocalVariableName")
public void update(double dtSeconds) {
// Update state estimate with RK4
m_x = NumericalIntegration.rk4(this::getDynamics, m_x, m_u, dtSeconds);
m_y = m_x;
@@ -319,7 +318,6 @@ public class DifferentialDrivetrainSim {
@SuppressWarnings({"DuplicatedCode", "LocalVariableName", "ParameterName"})
protected Matrix<N7, N1> getDynamics(Matrix<N7, N1> x, Matrix<N2, N1> u) {
// Because G can be factored out of B, we can divide by the old ratio and multiply
// by the new ratio to get a new drivetrain model.
var B = new Matrix<>(Nat.N4(), Nat.N2());

View File

@@ -16,7 +16,6 @@ import org.junit.jupiter.api.Test;
class MatchInfoDataTest {
@Test
void testSetMatchInfo() {
MatchType matchType = MatchType.Qualification;
DriverStationDataJNI.setMatchInfo("Event Name", "Game Message", 174, 191, matchType.ordinal());

View File

@@ -21,7 +21,6 @@ public class ElevatorSimTest {
@Test
@SuppressWarnings({"LocalVariableName", "resource"})
public void testStateSpaceSimWithElevator() {
var controller = new PIDController(10, 0, 0);
var sim =

View File

@@ -55,7 +55,6 @@ public class RobotContainer {
* JoystickButton}.
*/
private void configureButtonBindings() {
// Move the arm to 2 radians above horizontal when the 'A' button is pressed.
new JoystickButton(m_driverController, Button.kA.value)
.whenPressed(

View File

@@ -55,7 +55,6 @@ public class RobotContainer {
* JoystickButton}.
*/
private void configureButtonBindings() {
// Move the arm to 2 radians above horizontal when the 'A' button is pressed.
new JoystickButton(m_driverController, Button.kA.value)
.whenPressed(() -> m_robotArm.setGoal(2), m_robotArm);

View File

@@ -78,7 +78,6 @@ public class RobotContainer {
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
// Create a voltage constraint to ensure we don't accelerate too fast
var autoVoltageConstraint =
new DifferentialDriveVoltageConstraint(

View File

@@ -55,7 +55,6 @@ public class Robot extends TimedRobot {
/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
@Override
public void autonomousInit() {
// Get selected routine from the SmartDashboard
m_autonomousCommand = m_robotContainer.getAutonomousCommand();

View File

@@ -84,7 +84,6 @@ public class RobotContainer {
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
// Create a voltage constraint to ensure we don't accelerate too fast
var autoVoltageConstraint =
new DifferentialDriveVoltageConstraint(

View File

@@ -91,7 +91,6 @@ public class Robot extends TimedRobot {
@Override
public void teleopPeriodic() {
// Sets the target speed of our flywheel. This is similar to setting the setpoint of a
// PID controller.
if (m_joystick.getTriggerPressed()) {

View File

@@ -46,7 +46,6 @@ public class SwerveModule {
int[] turningEncoderPorts,
boolean driveEncoderReversed,
boolean turningEncoderReversed) {
m_driveMotor = new Spark(driveMotorChannel);
m_turningMotor = new Spark(turningMotorChannel);

View File

@@ -97,7 +97,6 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
@Test(timeout = 2000)
public void testMultipleInterruptsTriggering() {
AtomicBoolean hasFired = new AtomicBoolean(false);
AtomicInteger counter = new AtomicInteger(0);
@@ -130,7 +129,6 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
@Test(timeout = (long) (synchronousTimeout * 1e3))
public void testSynchronousInterruptsTriggering() {
try (SynchronousInterrupt interrupt = new SynchronousInterrupt(getSource())) {
final double synchronousDelay = synchronousTimeout / 2.0;
final Runnable runnable =
@@ -176,7 +174,6 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
@Test(timeout = (long) (synchronousTimeout * 1e3))
public void testSynchronousInterruptsWaitResultRisingEdge() {
try (SynchronousInterrupt interrupt = new SynchronousInterrupt(getSource())) {
final double synchronousDelay = synchronousTimeout / 2.0;
final Runnable runnable =
() -> {

View File

@@ -157,7 +157,6 @@ public final class TestBench {
* @return a freshly allocated Servo's and a freshly allocated Gyroscope
*/
public static TiltPanCameraFixture getTiltPanCam() {
return new TiltPanCameraFixture() {
@Override
protected AnalogGyro giveGyro() {

View File

@@ -15,7 +15,6 @@ import org.ejml.simple.SimpleMatrix;
* @param <R> The number of rows in this matrix.
*/
public class Vector<R extends Num> extends Matrix<R, N1> {
/**
* Constructs an empty zero vector of the given dimensions.
*

View File

@@ -23,7 +23,6 @@ import org.ejml.simple.SimpleMatrix;
* State-Space Models" (Doctoral dissertation)
*/
public class MerweScaledSigmaPoints<S extends Num> {
private final double m_alpha;
private final int m_kappa;
private final Nat<S> m_states;

View File

@@ -29,7 +29,6 @@ import org.ejml.simple.SimpleMatrix;
@SuppressWarnings({"MemberName", "ClassTypeParameterName"})
public class UnscentedKalmanFilter<States extends Num, Inputs extends Num, Outputs extends Num>
implements KalmanTypeFilter<States, Inputs, Outputs> {
private final Nat<States> m_states;
private final Nat<Outputs> m_outputs;

View File

@@ -9,7 +9,6 @@ import edu.wpi.first.math.geometry.Rotation2d;
/** Represents the state of one swerve module. */
@SuppressWarnings("MemberName")
public class SwerveModuleState implements Comparable<SwerveModuleState> {
/** Speed of the wheel of the module. */
public double speedMetersPerSecond;

View File

@@ -81,7 +81,6 @@ public final class SplineHelper {
@SuppressWarnings("LocalVariableName")
public static CubicHermiteSpline[] getCubicSplinesFromControlVectors(
Spline.ControlVector start, Translation2d[] waypoints, Spline.ControlVector end) {
CubicHermiteSpline[] splines = new CubicHermiteSpline[waypoints.length + 1];
double[] xInitial = start.x;

View File

@@ -11,7 +11,6 @@ import edu.wpi.first.math.numbers.N1;
@SuppressWarnings("ClassTypeParameterName")
public class LinearSystem<States extends Num, Inputs extends Num, Outputs extends Num> {
/** Continuous system matrix. */
@SuppressWarnings("MemberName")
private final Matrix<States, States> m_A;
@@ -42,7 +41,6 @@ public class LinearSystem<States extends Num, Inputs extends Num, Outputs extend
Matrix<States, Inputs> b,
Matrix<Outputs, States> c,
Matrix<Outputs, Inputs> d) {
this.m_A = a;
this.m_B = b;
this.m_C = c;

View File

@@ -30,7 +30,6 @@ import org.ejml.simple.SimpleMatrix;
*/
@SuppressWarnings("ClassTypeParameterName")
public class LinearSystemLoop<States extends Num, Inputs extends Num, Outputs extends Num> {
private final LinearQuadraticRegulator<States, Inputs, Outputs> m_controller;
private final LinearPlantInversionFeedforward<States, Inputs, Outputs> m_feedforward;
private final KalmanFilter<States, Inputs, Outputs> m_observer;

View File

@@ -75,7 +75,6 @@ public final class NumericalIntegration {
Matrix<States, N1> x,
Matrix<Inputs, N1> u,
double dtSeconds) {
final var halfDt = 0.5 * dtSeconds;
Matrix<States, N1> k1 = f.apply(x, u);
Matrix<States, N1> k2 = f.apply(x.plus(k1.times(halfDt)), u);
@@ -96,7 +95,6 @@ public final class NumericalIntegration {
@SuppressWarnings({"ParameterName", "MethodTypeParameterName"})
public static <States extends Num> Matrix<States, N1> rk4(
Function<Matrix<States, N1>, Matrix<States, N1>> f, Matrix<States, N1> x, double dtSeconds) {
final var halfDt = 0.5 * dtSeconds;
Matrix<States, N1> k1 = f.apply(x);
Matrix<States, N1> k2 = f.apply(x.plus(k1.times(halfDt)));
@@ -147,7 +145,6 @@ public final class NumericalIntegration {
Matrix<Inputs, N1> u,
double dtSeconds,
double maxError) {
double dtElapsed = 0;
double previousH = dtSeconds;
// Loop until we've gotten to our desired dt
@@ -224,7 +221,6 @@ public final class NumericalIntegration {
double initialH,
double maxTruncationError,
double dtRemaining) {
double truncationErr;
double h = initialH;
Matrix<States, N1> newX;

View File

@@ -195,7 +195,6 @@ public final class LinearSystemId {
@SuppressWarnings("ParameterName")
public static LinearSystem<N2, N2, N2> identifyDrivetrainSystem(
double kVLinear, double kALinear, double kVAngular, double kAAngular) {
final double A1 = 0.5 * -(kVLinear / kALinear + kVAngular / kAAngular);
final double A2 = 0.5 * -(kVLinear / kALinear - kVAngular / kAAngular);
final double B1 = 0.5 * (1.0 / kALinear + 1.0 / kAAngular);

View File

@@ -260,7 +260,6 @@ public final class TrajectoryParameterizer {
private static void enforceAccelerationLimits(
boolean reverse, List<TrajectoryConstraint> constraints, ConstrainedState state) {
for (final var constraint : constraints) {
double factor = reverse ? -1.0 : 1.0;
final var minMaxAccel =

View File

@@ -51,7 +51,6 @@ public class DifferentialDriveVoltageConstraint implements TrajectoryConstraint
@Override
public MinMax getMinMaxAccelerationMetersPerSecondSq(
Pose2d poseMeters, double curvatureRadPerMeter, double velocityMetersPerSecond) {
var wheelSpeeds =
m_kinematics.toWheelSpeeds(
new ChassisSpeeds(

View File

@@ -11,7 +11,6 @@ import edu.wpi.first.math.geometry.Pose2d;
* trajectories.
*/
public interface TrajectoryConstraint {
/**
* Returns the max velocity given the current pose and curvature.
*

View File

@@ -48,7 +48,6 @@ public class LinearQuadraticRegulatorTest {
@Test
@SuppressWarnings("LocalVariableName")
public void testLQROnElevator() {
var qElms = VecBuilder.fill(0.02, 0.4);
var rElms = VecBuilder.fill(12.0);
var dt = 0.00505;
@@ -63,7 +62,6 @@ public class LinearQuadraticRegulatorTest {
@Test
public void testFourMotorElevator() {
var dt = 0.020;
var plant =
@@ -80,7 +78,6 @@ public class LinearQuadraticRegulatorTest {
@Test
@SuppressWarnings("LocalVariableName")
public void testLQROnArm() {
var motors = DCMotor.getVex775Pro(2);
var m = 4.0;

View File

@@ -54,7 +54,6 @@ public class LinearSystemLoopTest {
@Test
@SuppressWarnings("LocalVariableName")
public void testStateSpaceEnabled() {
m_loop.reset(VecBuilder.fill(0, 0));
Matrix<N2, N1> references = VecBuilder.fill(2.0, 0.0);
var constraints = new TrapezoidProfile.Constraints(4, 3);
@@ -84,7 +83,6 @@ public class LinearSystemLoopTest {
@Test
@SuppressWarnings("LocalVariableName")
public void testFlywheelEnabled() {
LinearSystem<N1, N1, N1> plant =
LinearSystemId.createFlywheelSystem(DCMotor.getNEO(2), 0.00289, 1.0);
KalmanFilter<N1, N1, N1> observer =
@@ -113,7 +111,6 @@ public class LinearSystemLoopTest {
var time = 0.0;
while (time < 10) {
if (time > 10) {
break;
}

View File

@@ -64,7 +64,6 @@ public class KalmanFilterTest {
@Test
@SuppressWarnings("LocalVariableName")
public void testElevatorKalmanFilter() {
var Q = VecBuilder.fill(0.05, 1.0);
var R = VecBuilder.fill(0.0001);
@@ -73,7 +72,6 @@ public class KalmanFilterTest {
@Test
public void testSwerveKFStationary() {
var random = new Random();
var filter =
@@ -121,7 +119,6 @@ public class KalmanFilterTest {
@Test
public void testSwerveKFMovingWithoutAccelerating() {
var random = new Random();
var filter =
@@ -178,7 +175,6 @@ public class KalmanFilterTest {
@Test
@SuppressWarnings("LocalVariableName")
public void testSwerveKFMovingOverTrajectory() {
var random = new Random();
var filter =

View File

@@ -171,7 +171,6 @@ public class UnscentedKalmanFilterTest {
double totalTime = trajectory.getTotalTimeSeconds();
for (int i = 0; i < (totalTime / dtSeconds); i++) {
ref = trajectory.sample(dtSeconds * i);
double vl = ref.velocityMetersPerSecond * (1 - (ref.curvatureRadPerMeter * rbMeters));
double vr = ref.velocityMetersPerSecond * (1 + (ref.curvatureRadPerMeter * rbMeters));

View File

@@ -35,7 +35,6 @@ class MecanumDriveKinematicsTest {
@Test
void testStraightLineForwardKinematicsKinematics() {
var wheelSpeeds = new MecanumDriveWheelSpeeds(3.536, 3.536, 3.536, 3.536);
var moduleStates = m_kinematics.toChassisSpeeds(wheelSpeeds);
@@ -59,7 +58,6 @@ class MecanumDriveKinematicsTest {
@Test
void testStrafeForwardKinematicsKinematics() {
var wheelSpeeds = new MecanumDriveWheelSpeeds(-2.828427, 2.828427, 2.828427, -2.828427);
var moduleStates = m_kinematics.toChassisSpeeds(wheelSpeeds);
@@ -152,7 +150,6 @@ class MecanumDriveKinematicsTest {
@Test
void testOffCenterRotationTranslationForwardKinematicsKinematics() {
var wheelSpeeds = new MecanumDriveWheelSpeeds(2.12, 21.92, -12.02, 36.06);
var moduleStates = m_kinematics.toChassisSpeeds(wheelSpeeds);

View File

@@ -52,7 +52,6 @@ class SwerveDriveKinematicsTest {
@Test
void testStraightStrafeInverseKinematics() {
ChassisSpeeds speeds = new ChassisSpeeds(0, 5, 0);
var moduleStates = m_kinematics.toSwerveModuleStates(speeds);
@@ -80,7 +79,6 @@ class SwerveDriveKinematicsTest {
@Test
void testTurnInPlaceInverseKinematics() {
ChassisSpeeds speeds = new ChassisSpeeds(0, 0, 2 * Math.PI);
var moduleStates = m_kinematics.toSwerveModuleStates(speeds);
@@ -119,7 +117,6 @@ class SwerveDriveKinematicsTest {
@Test
void testOffCenterCORRotationInverseKinematics() {
ChassisSpeeds speeds = new ChassisSpeeds(0, 0, 2 * Math.PI);
var moduleStates = m_kinematics.toSwerveModuleStates(speeds, m_fl);
@@ -188,7 +185,6 @@ class SwerveDriveKinematicsTest {
*/
@Test
void testOffCenterCORRotationAndTranslationInverseKinematics() {
ChassisSpeeds speeds = new ChassisSpeeds(0.0, 3.0, 1.5);
var moduleStates = m_kinematics.toSwerveModuleStates(speeds, new Translation2d(24, 0));

View File

@@ -41,7 +41,6 @@ class LinearSystemIDTest {
@Test
public void testElevatorSystem() {
var model = LinearSystemId.createElevatorSystem(DCMotor.getNEO(2), 5, 0.05, 12);
assertTrue(
model.getA().isEqual(Matrix.mat(Nat.N2(), Nat.N2()).fill(0, 1, 0, -99.05473), 0.001));

View File

@@ -16,7 +16,6 @@ public class NumericalIntegrationTest {
@Test
@SuppressWarnings({"ParameterName", "LocalVariableName"})
public void testExponential() {
Matrix<N1, N1> y0 = VecBuilder.fill(0.0);
//noinspection SuspiciousNameCombination
@@ -36,7 +35,6 @@ public class NumericalIntegrationTest {
@Test
@SuppressWarnings({"ParameterName", "LocalVariableName"})
public void testExponentialAdaptive() {
Matrix<N1, N1> y0 = VecBuilder.fill(0.0);
//noinspection SuspiciousNameCombination