From: moo Date: Wed, 25 Mar 2026 21:48:12 +0000 (-0700) Subject: have brownout control run on startup instead of when touchpad is pressed, also protec... X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=b7612bd64adbcde69ad684a9511735ee5c33680c;p=FRC2026.git have brownout control run on startup instead of when touchpad is pressed, also protects against null errors sry i formatted robotcontainer --- diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index fe64006..af6f5c8 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -1,5 +1,6 @@ package frc.robot; +import java.util.concurrent.ScheduledExecutorService; import java.util.function.BooleanSupplier; import org.littletonrobotics.junction.Logger; @@ -19,8 +20,10 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.CommandScheduler; import edu.wpi.first.wpilibj2.command.InstantCommand; +import edu.wpi.first.wpilibj2.command.ScheduleCommand; import frc.robot.commands.drive_comm.DefaultDriveCommand; import frc.robot.commands.gpm.AutoShootCommand; +import frc.robot.commands.gpm.BrownOutControl; import frc.robot.commands.gpm.ClimbDriveCommand; import frc.robot.commands.gpm.HardstopWarning; import frc.robot.commands.gpm.IntakeMovementCommand; @@ -65,7 +68,7 @@ public class RobotContainer { private Intake intake = null; // this is inside addAuto() - //private Command auto = new DoNothing(); + // private Command auto = new DoNothing(); // Controllers are defined here private BaseDriverConfig driver = null; @@ -131,27 +134,29 @@ public class RobotContainer { driver.configureControls(); operator.configureControls(); - registerCommands(); PathGroupLoader.loadPathGroups(); - + initializeAutoBuilder(); autoChooserInit(); // put the Chooser on the SmartDashboard SmartDashboard.putData("Auto chooser", autoChooser); - - if (turret != null) { turret.setDefaultCommand(new Superstructure(turret, drive, hood, shooter, spindexer)); } + + if (shooter != null && spindexer != null && turret != null && intake != null && hood != null && drive != null) { + CommandScheduler.getInstance().schedule(new BrownOutControl(shooter, spindexer, turret, intake, hood, drive)); + } + drive.setDefaultCommand(new DefaultDriveCommand(drive, driver)); break; } - if (intake != null && hood != null && turret != null) - CommandScheduler.getInstance().schedule(new HardstopWarning(hood, intake, turret)); + if (intake != null && hood != null && turret != null) + CommandScheduler.getInstance().schedule(new HardstopWarning(hood, intake, turret)); // This is really annoying so it's disabled DriverStation.silenceJoystickConnectionWarning(true); @@ -237,16 +242,16 @@ public class RobotContainer { } - public void addAuto(String name){ - try{ + public void addAuto(String name) { + try { Command auto = new PathPlannerAuto(name); autoChooser.addOption(name, auto); } // is this the right one?? catch (AutoBuilderException e) { - e.printStackTrace(); - System.out.println("HELLOOOO AUTO \"" + name + "\" NOT FOUND"); - } + e.printStackTrace(); + System.out.println("HELLOOOO AUTO \"" + name + "\" NOT FOUND"); + } } /** @@ -257,7 +262,7 @@ public class RobotContainer { // add the options to the Chooser String defaultAuto = "Test default auto"; String leftSideAuto = "Left Week V1"; - String rightSideAuto = "Right Week V1"; + String rightSideAuto = "Right Week V1"; String shootOnlyAuto = "Shoot Only Left Week V1"; autoChooser.setDefaultOption("Default", new PathPlannerAuto(defaultAuto)); diff --git a/src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java b/src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java index f20b024..b15d453 100644 --- a/src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java +++ b/src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java @@ -199,9 +199,9 @@ public class PS5ControllerDriverConfig extends BaseDriverConfig { } // turns it on - controller.get(PS5Button.TOUCHPAD).onTrue(new InstantCommand(() -> { - new BrownOutControl(shooter, spindexer, turret, intake, hood, getDrivetrain()); - })); + // controller.get(PS5Button.TOUCHPAD).onTrue(new InstantCommand(() -> { + // new BrownOutControl(shooter, spindexer, turret, intake, hood, getDrivetrain()); + // })); } @Override