Skip to content

Commit

Permalink
Fixed some sonarlint stuff while I'm working
Browse files Browse the repository at this point in the history
  • Loading branch information
GearBoxFox committed Jan 20, 2024
1 parent bbf9253 commit 96d2c5b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 48 deletions.
83 changes: 37 additions & 46 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.commands.DriveCommands;
import frc.robot.commands.FeedForwardCharacterization;
Expand All @@ -34,7 +33,6 @@
import frc.robot.subsystems.shooter.ShooterIOPrototype;
import frc.robot.subsystems.shooter.ShooterSubsystem;
import org.littletonrobotics.junction.networktables.LoggedDashboardChooser;
import org.littletonrobotics.junction.networktables.LoggedDashboardNumber;

/**
* This class is where the bulk of the robot should be declared. Since Command-based is a
Expand All @@ -52,52 +50,43 @@ public class RobotContainer {

// Dashboard inputs
private final LoggedDashboardChooser<Command> autoChooser;
private final LoggedDashboardNumber flywheelSpeedInput =
new LoggedDashboardNumber("Flywheel Speed", 1500.0);

/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
switch (Constants.currentMode) {
case REAL -> {
// Real robot, instantiate hardware IO implementations
m_driveSubsystem = new DriveSubsystem(
new GyroIOPigeon1(12, true),
new ModuleIOTalonFX(Constants.DriveConstants.FL_MOD_CONSTANTS),
new ModuleIOTalonFX(Constants.DriveConstants.FR_MOD_CONSTANTS),
new ModuleIOTalonFX(Constants.DriveConstants.BL_MOD_CONSTANTS),
new ModuleIOTalonFX(Constants.DriveConstants.BR_MOD_CONSTANTS));
m_shooter = new ShooterSubsystem(new ShooterIOPrototype());
}
case SIM -> {
// Sim robot, instantiate physics sim IO implementations
m_driveSubsystem =
new DriveSubsystem(
new GyroIO() {
},
new ModuleIOSim(Constants.DriveConstants.FL_MOD_CONSTANTS),
new ModuleIOSim(Constants.DriveConstants.FR_MOD_CONSTANTS),
new ModuleIOSim(Constants.DriveConstants.BL_MOD_CONSTANTS),
new ModuleIOSim(Constants.DriveConstants.BR_MOD_CONSTANTS));
m_shooter = new ShooterSubsystem(new ShooterIOPrototype());
}
default -> {
// Replayed robot, disable IO implementations
m_driveSubsystem =
new DriveSubsystem(
new GyroIO() {
},
new ModuleIO() {
},
new ModuleIO() {
},
new ModuleIO() {
},
new ModuleIO() {
});
m_shooter = new ShooterSubsystem(new ShooterIO() {
});
}
switch (Constants.currentMode) {
case REAL -> {
// Real robot, instantiate hardware IO implementations
m_driveSubsystem = new DriveSubsystem(
new GyroIOPigeon1(12, true),
new ModuleIOTalonFX(Constants.DriveConstants.FL_MOD_CONSTANTS),
new ModuleIOTalonFX(Constants.DriveConstants.FR_MOD_CONSTANTS),
new ModuleIOTalonFX(Constants.DriveConstants.BL_MOD_CONSTANTS),
new ModuleIOTalonFX(Constants.DriveConstants.BR_MOD_CONSTANTS));
m_shooter = new ShooterSubsystem(new ShooterIOPrototype());
}
case SIM -> {
// Sim robot, instantiate physics sim IO implementations
m_driveSubsystem =
new DriveSubsystem(
new GyroIO() {},
new ModuleIOSim(Constants.DriveConstants.FL_MOD_CONSTANTS),
new ModuleIOSim(Constants.DriveConstants.FR_MOD_CONSTANTS),
new ModuleIOSim(Constants.DriveConstants.BL_MOD_CONSTANTS),
new ModuleIOSim(Constants.DriveConstants.BR_MOD_CONSTANTS));
m_shooter = new ShooterSubsystem(new ShooterIOPrototype());
}
default -> {
// Replayed robot, disable IO implementations
m_driveSubsystem =
new DriveSubsystem(
new GyroIO() {},
new ModuleIO() {},
new ModuleIO() {},
new ModuleIO() {},
new ModuleIO() {});
m_shooter = new ShooterSubsystem(new ShooterIO() {});
}
}

// Set up auto routines
autoChooser = new LoggedDashboardChooser<>("Auto Choices", AutoBuilder.buildAutoChooser());
Expand All @@ -106,7 +95,9 @@ public RobotContainer() {
autoChooser.addOption(
"Drive FF Characterization",
new FeedForwardCharacterization(
m_driveSubsystem, m_driveSubsystem::runCharacterizationVolts, m_driveSubsystem::getCharacterizationVelocity));
m_driveSubsystem,
m_driveSubsystem::runCharacterizationVolts,
m_driveSubsystem::getCharacterizationVelocity));

// Configure the button bindings
configureButtonBindings();
Expand Down Expand Up @@ -146,6 +137,6 @@ private void configureButtonBindings() {
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
return new InstantCommand();//autoChooser.get();
return autoChooser.get();
}
}
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/subsystems/shooter/ShooterIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
public interface ShooterIO {

@AutoLog
public class ShooterIOInputs {

class ShooterIOInputs {
}
default void setMotorVoltageTL(double voltage) {}
default void setMotorVoltageTR(double voltage) {}
Expand Down

0 comments on commit 96d2c5b

Please sign in to comment.