From 2c4c1f24ea0dab1ca82d05f99bf7664b86bef040 Mon Sep 17 00:00:00 2001 From: Cayden Brackett Date: Tue, 3 Dec 2024 17:14:42 -0500 Subject: [PATCH] fixed the formatting in all files --- src/main/java/frc/robot/RobotContainer.java | 19 ++++++----- .../robot/constants/DrivetrainConstants.java | 2 +- .../frc/robot/constants/FlickerConstants.java | 4 +-- .../frc/robot/constants/ShooterConstants.java | 4 +-- .../java/frc/robot/subsystems/Drivetrain.java | 18 +++++----- .../java/frc/robot/subsystems/Flicker.java | 34 +++++++++---------- .../java/frc/robot/subsystems/Shooter.java | 20 ++++++----- 7 files changed, 55 insertions(+), 46 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 11abc4d..29aa8ab 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -21,45 +21,48 @@ public class RobotContainer { private Drivetrain drivetrain; private CommandXboxController driver; public RobotContainer() { + //sets up controlers drivetrain = new Drivetrain(); flicker = new Flicker(); - driver = new CommandXboxController(OIConstants.kDriverUSB); //sets up controlers + driver = new CommandXboxController(OIConstants.kDriverUSB); configureBindings(); configureShuffleboard(); } private void configureBindings() { + //manual controls for driveing drivetrain.setDefaultCommand( drivetrain.driveArcade( driver::getLeftY, - driver::getLeftX //manual controls for driveing + driver::getLeftX ) ); flicker.setDefaultCommand(flicker.stop()); + //manual controls for shooter and flicker driver.a().onTrue(flicker.setSpeed(() ->1)); - shooter.setDefaultCommand(shooter.stop()); - driver.rightBumper().onTrue(shooter.setSpeed(()->1)); //manual controls for shooter and flicker + driver.rightBumper().onTrue(shooter.setSpeed(()->1)); } private void configureShuffleboard() { + //sets up the wiget ShuffleboardTab robotIndicatorTab = Shuffleboard.getTab(OIConstants.kRobotIndicatorsTabName); - - robotIndicatorTab.addBoolean("Sensors", flicker::photoswich) + robotIndicatorTab.addBoolean("Sensors", flicker::frisbySensor) .withPosition(0, 0). withSize(2, 1). - withWidget(BuiltInWidgets.kBooleanBox); //sets up the wiget + withWidget(BuiltInWidgets.kBooleanBox); } public Command getAutonomousCommand() { + //sets up the anumus command, it drives forward for 2 seconds, spins the shooter mototrs for 1 second, and both shooter and flicker for 3 seconds. return drivetrain.driveTank(() -> .5,() -> .5).withTimeout(2). andThen( shooter.setSpeed(()-> 1)).withTimeout(1).andThen( shooter.setSpeed(()->1)).alongWith( - flicker.setSpeed(()->1)); //sets up the anumus command, it drives forward for 2 seconds, spins the shooter mototrs for 1 second, and both shooter and flicker for 3 seconds. + flicker.setSpeed(()->1)); } } diff --git a/src/main/java/frc/robot/constants/DrivetrainConstants.java b/src/main/java/frc/robot/constants/DrivetrainConstants.java index 4604d9c..ea565d9 100644 --- a/src/main/java/frc/robot/constants/DrivetrainConstants.java +++ b/src/main/java/frc/robot/constants/DrivetrainConstants.java @@ -3,7 +3,7 @@ package frc.robot.constants; public class DrivetrainConstants { public static final int kleftFrontPWN = 0; public static final int kleftRearPWN = 1; - public static final int kRightfrontPWM = 2; + public static final int kRightFrontPWM = 2; public static final int kRightRearPWM = 3; } diff --git a/src/main/java/frc/robot/constants/FlickerConstants.java b/src/main/java/frc/robot/constants/FlickerConstants.java index 73f819c..0b86e01 100644 --- a/src/main/java/frc/robot/constants/FlickerConstants.java +++ b/src/main/java/frc/robot/constants/FlickerConstants.java @@ -1,7 +1,7 @@ package frc.robot.constants; public class FlickerConstants { - public static final int K3motorPWM = 1; + public static final int k3motorPWM = 1; - public static int Photoswitch = 1; + public static int kPhotoSwitch = 1; } diff --git a/src/main/java/frc/robot/constants/ShooterConstants.java b/src/main/java/frc/robot/constants/ShooterConstants.java index c0a95de..bc2cc78 100644 --- a/src/main/java/frc/robot/constants/ShooterConstants.java +++ b/src/main/java/frc/robot/constants/ShooterConstants.java @@ -1,6 +1,6 @@ package frc.robot.constants; public class ShooterConstants { - public static final int K1motorPWM = 0; - public static final int K2motorPWM = 0; + public static final int K1MotorPWM = 0; + public static final int K2MotorPWM = 0; } diff --git a/src/main/java/frc/robot/subsystems/Drivetrain.java b/src/main/java/frc/robot/subsystems/Drivetrain.java index 578fd4f..fbcd1f2 100644 --- a/src/main/java/frc/robot/subsystems/Drivetrain.java +++ b/src/main/java/frc/robot/subsystems/Drivetrain.java @@ -9,7 +9,8 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.constants.DrivetrainConstants; public class Drivetrain extends SubsystemBase { - private VictorSP leftFront; // tells the motors how much power they use + // tells the motors how much power they use + private VictorSP leftFront; private VictorSP leftRear; private VictorSP rightFront; private VictorSP rightRear; @@ -17,9 +18,10 @@ public class Drivetrain extends SubsystemBase { private DifferentialDrive drive; public Drivetrain() { - leftFront = new VictorSP(DrivetrainConstants.kleftFrontPWN); //turns the code inputs (like how fast or how to turn) and make it a way that the motors will understand. + //turns the code inputs (like how fast or how to turn) and make it a way that the motors will understand. + leftFront = new VictorSP(DrivetrainConstants.kleftFrontPWN); leftRear = new VictorSP(DrivetrainConstants.kleftRearPWN); - rightFront = new VictorSP(DrivetrainConstants.kRightfrontPWM); + rightFront = new VictorSP(DrivetrainConstants.kRightFrontPWM); rightRear = new VictorSP(DrivetrainConstants.kRightRearPWM); leftFront.addFollower(leftRear); @@ -27,18 +29,18 @@ public class Drivetrain extends SubsystemBase { rightFront.setInverted(true); drive = new DifferentialDrive(leftFront, rightFront); - } public Command driveArcade(DoubleSupplier xSpeed, DoubleSupplier zRotation) { return run(() -> { - drive.arcadeDrive(xSpeed.getAsDouble(), zRotation.getAsDouble()); //makes car like steering possible + //makes car like steering possible + drive.arcadeDrive(xSpeed.getAsDouble(), zRotation.getAsDouble()); }); - } public Command driveTank(DoubleSupplier leftspeed, DoubleSupplier rightspeed) { - return run (() -> { - drive.tankDrive(leftspeed.getAsDouble(), rightspeed.getAsDouble()); //makes tank steering possible + return run(() -> { + //makes tank steering possible + drive.tankDrive(leftspeed.getAsDouble(), rightspeed.getAsDouble()); }); } diff --git a/src/main/java/frc/robot/subsystems/Flicker.java b/src/main/java/frc/robot/subsystems/Flicker.java index 2705432..c9b52cf 100644 --- a/src/main/java/frc/robot/subsystems/Flicker.java +++ b/src/main/java/frc/robot/subsystems/Flicker.java @@ -11,33 +11,33 @@ import frc.robot.constants.FlickerConstants; public class Flicker extends SubsystemBase { private VictorSP motor; - private DigitalInput photoswitch; + private DigitalInput frisbySensor; public Flicker() { - motor = new VictorSP(FlickerConstants.K3motorPWM); + //sets motors and the photo switch + motor = new VictorSP(FlickerConstants.k3motorPWM); - photoswitch = new DigitalInput(FlickerConstants.Photoswitch); + frisbySensor = new DigitalInput(FlickerConstants.kPhotoSwitch); - } //sets motors and the photo switch + } - public boolean photoswich() { - return photoswitch.get(); - } //makes the photoswitch useable for the if statment - //so the code will know if the photoswitch was blocked. + public boolean frisbySensor() { + //makes the photoswitch useable for the if statment so the code will know if the photoswitch was blocked. + return frisbySensor.get(); + } public Command setSpeed(DoubleSupplier speed){ + //makes it so the motor will run but if the photoswitch can't see the frisby it will stop. return run(() -> { - - if (photoswitch.get()) { - motor.set(speed.getAsDouble()); - } else { - motor.set(0); + if (frisbySensor.get()) { + motor.set(speed.getAsDouble()); + } else { + motor.set(0); } - //makes it so the motor will run but if the photoswitch can't see the frisby it will stop. - }); - + }); } public Command stop() { + // stops the motor manually. return setSpeed(() -> 0); - } // stops the motor manually. + } } diff --git a/src/main/java/frc/robot/subsystems/Shooter.java b/src/main/java/frc/robot/subsystems/Shooter.java index 79bf08b..ec5569e 100644 --- a/src/main/java/frc/robot/subsystems/Shooter.java +++ b/src/main/java/frc/robot/subsystems/Shooter.java @@ -8,23 +8,27 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.constants.ShooterConstants; public class Shooter extends SubsystemBase{ + //makes the motors varables private VictorSP motor1; - private VictorSP motor2; //makes the motors varables + private VictorSP motor2; public Shooter() { - motor1 = new VictorSP(ShooterConstants.K1motorPWM); - motor2 = new VictorSP(ShooterConstants.K2motorPWM); + //sets up the motors to be used in the code + motor1 = new VictorSP(ShooterConstants.K1MotorPWM); + motor2 = new VictorSP(ShooterConstants.K2MotorPWM); - motor1.addFollower(motor2); //sets motors + motor1.addFollower(motor2); } public Command setSpeed(DoubleSupplier speed) { - return run(() -> { + //sets the motors speed + return run(() -> { motor1.set(speed.getAsDouble()); - }); //sets the motors speed -} + }); + } public Command stop() { + //stops the motors return setSpeed(() -> 0); } -} //stops the motors +}